From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 5 13:44:22 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E538D106564A for ; Mon, 5 Sep 2011 13:44:22 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 6E76A8FC20 for ; Mon, 5 Sep 2011 13:44:22 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=MmhuielNmoAwiWCiiefMnqMoo9XwPcHPH2oGFNV1oLM= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=ze3EKyZnpQUA:10 a=WQU8e4WWZSUA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=24EVkJ6CNt3X5WJoCMUA:9 a=wPNLvfGTeEIA:10 a=gn1vydRif76bWShp:21 a=BdaDqphQex-B8GSz:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 174542095; Mon, 05 Sep 2011 15:44:19 +0200 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Mon, 5 Sep 2011 15:41:41 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: In-Reply-To: X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109051541.41092.hselasky@c2i.net> Cc: Daniel Grech Subject: Re: Detach USB Device Driver and Attach it to ugen driver at runtime X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 13:44:23 -0000 On Monday 05 September 2011 15:40:44 Daniel Grech wrote: > Hi, I'm using libusb to gain access to raw USB Data from userspace. My > problem is that this library only works with devices which are treated as > generic devices ("handled by the ugen driver"). I need a mechanism that > will allow me to detach any device specific drivers that are attached to a > device and attach the ugen driver instead. I want to do this without > re-compiling the FreeBSD Kernel. Thanks in advance for your help. Hi, The following functions should be implemented: int libusb20_dev_detach_kernel_driver(struct libusb20_device *pdev, uint8_t iface_index); int libusb_detach_kernel_driver(libusb_device_handle *devh, int interface) or int libusb_detach_kernel_driver_np(libusb_device_handle *devh, int interface) Detach a kernel driver from an interface. This is needed to claim an interface required by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active, LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. This function is non-portable. man libusb20 man libusb --HPS