From: Roland K. <ro...@ro...> - 2018-05-17 01:40:36
|
.. my first post .. I have a device (Atmel running their vendor development USB stack). It has one configuration, one interface two alternates as they use an isochronous endpoint and you can’t have that in the default configuration. With the simplest example I can come up with I get ‘Errno 2 - entity not found’ on any access to any endpoint on the device. Heres the python, this is on MacOS MacBook-Pro:eic rols$ python3 Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import usb >>> dev=usb.core.find(idVendor=0x3eb,idProduct=0x2423) >>> dev.set_configuration() >>> dev.set_interface_altsetting(0,1) >>> dev.write(0x83,'test') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/usb/core.py", line 948, in write self.__get_timeout(timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/usb/backend/libusb1.py", line 824, in bulk_write timeout) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/usb/backend/libusb1.py", line 920, in __write _check(retval) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 2] Entity not found >>> There’s a print of the device at the bottom showing that it does have one config and interface 0 has an alternate. I note that the framework has correctly deduced the endpoint is bulk (it’s in bulk_write) and I tried a few others and ended up in the same place in different functions (read_bulk, write_int.. etc) so it has definitely parsed the descriptor properly and is calling the right thing. the USB Prober on the Mac shows the interface is configured, it wasn’t before I did the dev.set_configuration() so I’m definitely talking to it and as it’s a device I’m building I can see the correct setup calls were made to the board, pretty sure it’s in config 0, interface 0/alternate 1. I’ve tried explicitly claiming it, no difference. I don’t believe the OS claims this interface as it’s all totally vendor and when restarted it comes up unconfigured. I get the same error reading or writing to any of the non-control interfaces. Is there a step I missed here? DEVICE ID 03eb:2423 on Bus 020 Address 035 ================= bLength : 0x12 (18 bytes) bDescriptorType : 0x1 Device bcdUSB : 0x200 USB 2.0 bDeviceClass : 0x0 Specified at interface bDeviceSubClass : 0x0 bDeviceProtocol : 0x0 bMaxPacketSize0 : 0x40 (64 bytes) idVendor : 0x03eb idProduct : 0x2423 bcdDevice : 0x100 Device 1.0 iManufacturer : 0x0 iProduct : 0x0 iSerialNumber : 0x0 bNumConfigurations : 0x1 CONFIGURATION 1: 100 mA ================================== bLength : 0x9 (9 bytes) bDescriptorType : 0x2 Configuration wTotalLength : 0x45 (69 bytes) bNumInterfaces : 0x1 bConfigurationValue : 0x1 iConfiguration : 0x0 bmAttributes : 0x80 Bus Powered bMaxPower : 0x32 (100 mA) INTERFACE 0: Vendor Specific =========================== bLength : 0x9 (9 bytes) bDescriptorType : 0x4 Interface bInterfaceNumber : 0x0 bAlternateSetting : 0x0 bNumEndpoints : 0x0 bInterfaceClass : 0xff Vendor Specific bInterfaceSubClass : 0xff bInterfaceProtocol : 0xff iInterface : 0x0 INTERFACE 0, 1: Vendor Specific ======================== bLength : 0x9 (9 bytes) bDescriptorType : 0x4 Interface bInterfaceNumber : 0x0 bAlternateSetting : 0x1 bNumEndpoints : 0x6 bInterfaceClass : 0xff Vendor Specific bInterfaceSubClass : 0xff bInterfaceProtocol : 0xff iInterface : 0x0 ENDPOINT 0x81: Interrupt IN ========================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x81 IN bmAttributes : 0x3 Interrupt wMaxPacketSize : 0x40 (64 bytes) bInterval : 0x1 ENDPOINT 0x2: Interrupt OUT ========================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x2 OUT bmAttributes : 0x3 Interrupt wMaxPacketSize : 0x40 (64 bytes) bInterval : 0x1 ENDPOINT 0x83: Bulk IN =============================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x83 IN bmAttributes : 0x2 Bulk wMaxPacketSize : 0x40 (64 bytes) bInterval : 0x0 ENDPOINT 0x4: Bulk OUT =============================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x4 OUT bmAttributes : 0x2 Bulk wMaxPacketSize : 0x40 (64 bytes) bInterval : 0x0 ENDPOINT 0x85: Isochronous IN ======================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x85 IN bmAttributes : 0x1 Isochronous wMaxPacketSize : 0x100 (256 bytes) bInterval : 0x1 ENDPOINT 0x6: Isochronous OUT ======================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x6 OUT bmAttributes : 0x1 Isochronous wMaxPacketSize : 0x100 (256 bytes) bInterval : 0x1 >>> |
From: Xiaofan C. <xia...@gm...> - 2018-06-10 05:46:35
|
On Wed, May 16, 2018 at 9:35 PM, Roland King <ro...@ro...> wrote: > .. my first post .. > > I have a device (Atmel running their vendor development USB stack). > > It has one configuration, one interface two alternates as they use an > isochronous endpoint and you can’t have that in the default configuration. > With the simplest example I can come up with I get ‘Errno 2 - entity not > found’ on any access to any endpoint on the device. I think pyusb may not work well with isochronous transfer. I have never tried myself. You may want to try out using C first to see if the device works under plain libusb under Mac OS X. You can also try this. It claims to support isochronous transfer. https://github.com/vpelletier/python-libusb1 -- Xiaofan |
From: Xiaofan C. <xia...@gm...> - 2018-06-18 11:34:23
|
On Sun, Jun 10, 2018 at 1:46 PM, Xiaofan Chen <xia...@gm...> wrote: > On Wed, May 16, 2018 at 9:35 PM, Roland King <ro...@ro...> wrote: >> .. my first post .. >> >> I have a device (Atmel running their vendor development USB stack). >> >> It has one configuration, one interface two alternates as they use an >> isochronous endpoint and you can’t have that in the default configuration. >> With the simplest example I can come up with I get ‘Errno 2 - entity not >> found’ on any access to any endpoint on the device. > > I think pyusb may not work well with isochronous transfer. I have never > tried myself. It seems that you are not using isoc transfer but bulk so it should work. On the other hand, I am not so sure if device understand this command. dev.write(0x83,'test') And you may want to specify the time out value. > You may want to try out using C first to see if the device works under > plain libusb under Mac OS X. > > You can also try this. It claims to support isochronous transfer. > https://github.com/vpelletier/python-libusb1 -- Xiaofan |
From: Roland K. <ro...@ro...> - 2018-06-18 12:04:11
|
(This reply is delayed because my email provider has been on one of sourceforge’s email blacklists and replies were being rejected) Thanks for the reply - I had this problem quite a few weeks ago now and solved it myself and the details are not as clear as they were when I wrote the mail in May. Didn’t have anything to do with Isochronous transfers, I wasn’t using the Isoc endpoints at all, they just happened to exist in the example Atmel code I was using. As far as I got before moving on it seemed the selection of the alternate interface was more to do with the problem, I recall that when debugging it I never saw the command on the device to select it and that would mean it stayed in base configuration which only had a control endpoint. Anyway I moved on at that point, abstracted out code for what I actually wanted on the device, which was one setting and just a couple of bulk pipes and implemented that. That simpler device model works just fine so I’ve left the issue behind. Will probably have some more questions as things get more complicated. Currently running pyusb in a wxPython app I have reads running on a thread so the UI event loop is separate. Not sure yet that’s the best scalable way to do things and so I may look at polling pyusb off the idle event instead .. which may also give me device insertion/removal which I’d quite like. Get to those a bit later. > On 10 Jun 2018, at 13:46, Xiaofan Chen <xia...@gm...> wrote: > > On Wed, May 16, 2018 at 9:35 PM, Roland King <ro...@ro...> wrote: >> .. my first post .. >> >> I have a device (Atmel running their vendor development USB stack). >> >> It has one configuration, one interface two alternates as they use an >> isochronous endpoint and you can’t have that in the default configuration. >> With the simplest example I can come up with I get ‘Errno 2 - entity not >> found’ on any access to any endpoint on the device. > > I think pyusb may not work well with isochronous transfer. I have never > tried myself. > > You may want to try out using C first to see if the device works under > plain libusb under Mac OS X. > > You can also try this. It claims to support isochronous transfer. > https://github.com/vpelletier/python-libusb1 > > -- > Xiaofan > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users |