This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/simtrace@lists.osmocom.org/.
Tom Schouten tom at zwizwa.beOn 08/09/2013 02:59 AM, Peter Stuge wrote:
> Tom Schouten wrote:
>>>>> Another method would be type=vendor recipient=device control requests
>>>>> over the default endpoint.
>> Well... I tried this for the CDC and I get "Device or resource busy".
> What did you try exactly?
# using pyusb 0.x
# this is running while CDC is claimed by usb-serial
import usb
def find(idVendor, idProduct):
busses = usb.busses()
for bus in busses:
devices = bus.devices
for dev in devices:
if ((dev.idVendor == idVendor) and
(dev.idProduct == idProduct)):
return dev
return 'wrong'
dev = find(idVendor=0x03eb, idProduct=0x6119)
dh = dev.open()
# dh.detachKernelDriver(0)
dh.claimInterface(0) # -> usb.USBError: could not claim interface 0:
Device or resource busy
dh.controlMsg(1,1,[0,0,0,0])
>
>> It doesn't work if the device is already opened by another process or a
>> kernel driver.
> There is always a kernel driver for every single interface, also when
> using libusb. It is just a different kernel driver. It is not possible
> to communicate with a USB device without a kernel driver, also using
> libusb.
>
> "open the device" is not really a significant concept with USB, it is
> much more important what happens with individual interfaces. libccid
> uses libusb to claim the CCID interface, but that is distinct from
> the default endpoint.
>
>
>> It seems plausible a USB device can only be opened once,
> That's not the case however.
>
I see. I'm confusing device and interface.
So basically, I would add another interface to the USB firmware, which
then can be claimed by a different process. Since all control transfers
use the default endpoint, this won't need extra endpoints which we don't
have.
Neat.
Thanks!