On Tue, Apr 27, 2021 at 08:18:09AM +0000, CM-Wu  Ben - 吳文鐘 wrote:
> Hi,
> I got a problem when dealing with control transfer on win7.
> 
> After set backend(libusb1), find usb device, I can send standard/class USB 
> request via dev.ctrl_transfer() successfully, but failed when sending vendor 
> request.
> 
> the reason is 'Entity not found'
> Is there any restrictions when sending vendor request?

Not generally, no.

But the OS driver may not support it (e.g. Windows Generic HID).

Try running with LIBUSB_DEBUG=4, that may give you some useful
information.

> 
> following is the debug message..
> 
> 2021-04-27 15:37:18,888 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL 
> '.\libusb-1.0.24\VS2019\MS64\dll\libusb-1.0.dll', handle ef8d0000 at 3576248>)
> 2021-04-27 15:37:18,894 DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices()
> 2021-04-27 15:37:18,976 
> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
>  object at 0x00000000035DFB88>)
> 2021-04-27 15:37:18,976 
> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
>  object at 0x00000000035DFE08>)
> 2021-04-27 15:37:18,976 
> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
>  object at 0x00000000035DFB08>)
> 2021-04-27 15:37:18,976 
> DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device
>  object at 0x00000000035DFE48>)
> -------------------- standard request: get string id=0xEE
> 2021-04-27 15:37:18,977 
> DEBUG:usb.backend.libusb1:_LibUSB.open_device(<usb.backend.libusb1._Device 
> object at 0x00000000035DFE48>)
> 2021-04-27 15:37:18,980 
> DEBUG:usb.backend.libusb1:_LibUSB.ctrl_transfer(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>, 128, 6, 1006, 1033, array('B', [0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 1000)
> -------------------- class request: write/read interface 3
> 2021-04-27 15:37:18,983 
> DEBUG:usb.backend.libusb1:_LibUSB.claim_interface(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>, 3)
> 2021-04-27 15:37:18,983 
> DEBUG:usb.backend.libusb1:_LibUSB.ctrl_transfer(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>, 33, 9, 513, 3, array('B', [1, 0, 254, 4, 0, 
> 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 1000)
> 2021-04-27 15:37:18,986 
> DEBUG:usb.backend.libusb1:_LibUSB.ctrl_transfer(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>, 161, 1, 257, 3, array('B', [0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 1000)
> -------------------- vendor request:
> 2021-04-27 15:37:18,989 
> DEBUG:usb.backend.libusb1:_LibUSB.ctrl_transfer(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>, 195, 2, 0, 0, array('B', [0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 1000)
> Traceback (most recent call last):
>   File "D:\Python\myusb.py", line 98, in <module>
>     vendor_reg_read()
>   File "D:\Python\myusb.py", line 75, in vendor_reg_read
>     ret = dev.ctrl_transfer(0xc3, 0x02, 0x00, 0, 0x10)
>   File "D:\Python\walac-pyusb-3ec29ca\usb\core.py", line 1043, in 
> ctrl_transfer
>     self.__get_timeout(timeout))
>   File "D:\Python\walac-pyusb-3ec29ca\usb\_debug.py", line 60, in do_trace
>     return f(*args, **named_args)
>   File "D:\Python\walac-pyusb-3ec29ca\usb\backend\libusb1.py", line 883, in 
> ctrl_transfer
>     timeout))
>   File "D:\Python\walac-pyusb-3ec29ca\usb\backend\libusb1.py", line 595, in 
> _check
>     raise USBError(_strerror(ret), ret, _libusb_errno[ret])
> usb.core.USBError: [Errno 2] Entity not found
> 2021-04-27 15:37:19,003 
> DEBUG:usb.backend.libusb1:_LibUSB.release_interface(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>, 3)
> 2021-04-27 15:37:19,005 
> DEBUG:usb.backend.libusb1:_LibUSB.close_device(<usb.backend.libusb1._DeviceHandle
>  object at 0x00000000035DFD88>)
> 2021-04-27 15:37:19,005 DEBUG:usb.backend.libusb1:_LibUSB._finalize_object()
> 
> 『The information contained in this email and attachment is confidential and 
> is for the use of the intended recipient only. Any disclosure, copying or 
> distribution of this email and attachment without the sender's consent is 
> strictly prohibited. If you are not the intended recipient, please promptly 
> notify the sender and delete this email and attachment entirely without 
> using, retaining, or disclosing any of its contents. The recipient is 
> responsible for ensuring that this email is virus free and the sender accepts 
> no liability for any damages caused by virus transmitted by this email.』


> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users



_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to