From: Арам А. <abo...@gm...> - 2021-04-22 10:39:25
|
---------- Forwarded message --------- От: Aram Abovyan <abo...@ya...> Date: чт, 22 апр. 2021 г., 13:37 Subject: To: abo...@gm... <abo...@gm...> I am very new to PyUSB and any help from PyUSB experts will be highly appreciated. . When I applied the following few lines in IDLE Python GUI, --------------------------------------------------------------- import os os.environ['PYUSB_DEBUG'] = 'debug'import usb.core usb.core.find() ---------------------------------------------------------------- I have got the following response : ======================= ======================= 2021-04-22 10:29:59,680 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL 'C:\Windows\system32\libusb-1.0.dll', handle 6b600000 at 0x3dc53fd250>) 2021-04-22 10:29:59,688 INFO:usb.core:find(): using backend "usb.backend.libusb1" 2021-04-22 10:29:59,688 DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() 2021-04-22 10:30:02,122 DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device object at 0x0000003DC73C5DC0>) 2021-04-22 10:30:02,123 DEBUG:usb.backend.libusb1:_LibUSB._finalize_object() I have googled that, but did not understand much from the serach- results. What am I missing out? |
From: Jonas M. <jo...@pr...> - 2021-04-22 12:35:50
|
On Thu, Apr 22, 2021 at 01:38:58PM +0300, Арам Абовян wrote: > ---------- Forwarded message --------- > От: Aram Abovyan <abo...@ya...> > Date: чт, 22 апр. 2021 г., 13:37 > Subject: > To: abo...@gm... <abo...@gm...> > > > I am very new to PyUSB and any help from PyUSB experts will be highly > appreciated. . > > When I applied the following few lines in IDLE Python GUI, > --------------------------------------------------------------- > > import os > os.environ['PYUSB_DEBUG'] = 'debug'import usb.core > usb.core.find() > > ---------------------------------------------------------------- > > I have got the following response : > > ======================= ======================= > > > > 2021-04-22 10:29:59,680 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL 'C:\Windows\system32\libusb-1.0.dll', handle 6b600000 at 0x3dc53fd250>) > 2021-04-22 10:29:59,688 INFO:usb.core:find(): using backend "usb.backend.libusb1" > 2021-04-22 10:29:59,688 DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() > 2021-04-22 10:30:02,122 DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device object at 0x0000003DC73C5DC0>) > 2021-04-22 10:30:02,123 DEBUG:usb.backend.libusb1:_LibUSB._finalize_object() > > > > I have googled that, but did not understand much from the serach- > results. There is absolutely nothing wrong here. You enabled PYUSB_DEBUG, and called usb.core.find(). The default is for find() to find (at most) a single USB device, which, according to the debug output, it did (even though it appears that you omitted the IDLE output that looks something like `<DEVICE ID ffff:ffff on Bus 001 Address 001>`). Maybe you wanted to store the device returned by find() somewhere? Also, generally speaking, you either want to find one of a specific device usb.core.find(idVendor=<...>, idProduct=<...>) or all devices (optionally also filtering by idVendor and/or idProduct) usb.core.find(find_all=True) usb.core.find(find_all=True, idVendor=<...>) usb.core.find(find_all=True, idVendor=<...>, idProduct=<...>) but rarely do you need a single randomly picked device. My suggestion is for you to (continue to) follow the PyUSB tutorial: https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst Thanks, Jonas > > > What am I missing out? > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users |
From: Арам А. <abo...@gm...> - 2021-04-25 17:54:49
|
thanks for the previous answer. I also get the error. When I applied the following few lines in IDLE Python GUI: import usb.core dev = usb.core.find(idVendor=0x10c4, idProduct=0xea61) ep = dev[0].interfaces()[0].endpoints()[0] i = dev[0].interfaces()[0].bInterfaceNumber dev.reset() if dev.is_kernel_driver_active(i): dev.datach_kernel_driver(i) dev.set_configuration() eaddr = ep.bEndpointAddress r = dev.read(eaddr, 1024) print(r) I have got the following response : Traceback (most recent call last): File "C:\Users\Администратор\Desktop\davis\main.py", line 17, in <module> if dev.is_kernel_driver_active(i): File "C:\Users\Администратор\Desktop\davis\venv\lib\site-packages\usb\core.py", line 1098, in is_kernel_driver_active return self._ctx.backend.is_kernel_driver_active( File "C:\Users\Администратор\Desktop\davis\venv\lib\site-packages\usb\backend\libusb1.py", line 915, in is_kernel_driver_active return bool(_check(self.lib.libusb_kernel_driver_active(dev_handle.handle, File "C:\Users\Администратор\Desktop\davis\venv\lib\site-packages\usb\backend\libusb1.py", line 600, in _check raise NotImplementedError(_strerror(ret)) NotImplementedError: Operation not supported or unimplemented on this platform чт, 22 апр. 2021 г., 15:36 Jonas Malaco via pyusb-users < pyu...@li...>: > On Thu, Apr 22, 2021 at 01:38:58PM +0300, Арам Абовян wrote: > > ---------- Forwarded message --------- > > От: Aram Abovyan <abo...@ya...> > > Date: чт, 22 апр. 2021 г., 13:37 > > Subject: > > To: abo...@gm... <abo...@gm...> > > > > > > I am very new to PyUSB and any help from PyUSB experts will be highly > > appreciated. . > > > > When I applied the following few lines in IDLE Python GUI, > > --------------------------------------------------------------- > > > > import os > > os.environ['PYUSB_DEBUG'] = 'debug'import usb.core > > usb.core.find() > > > > ---------------------------------------------------------------- > > > > I have got the following response : > > > > ======================= ======================= > > > > > > > > 2021-04-22 10:29:59,680 > DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL > 'C:\Windows\system32\libusb-1.0.dll', handle 6b600000 at 0x3dc53fd250>) > > 2021-04-22 10:29:59,688 INFO:usb.core:find(): using backend > "usb.backend.libusb1" > > 2021-04-22 10:29:59,688 > DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() > > 2021-04-22 10:30:02,122 > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > object at 0x0000003DC73C5DC0>) > > 2021-04-22 10:30:02,123 > DEBUG:usb.backend.libusb1:_LibUSB._finalize_object() > > > > > > > > I have googled that, but did not understand much from the serach- > > results. > > There is absolutely nothing wrong here. > > You enabled PYUSB_DEBUG, and called usb.core.find(). > > The default is for find() to find (at most) a single USB device, which, > according to the debug output, it did (even though it appears that you > omitted the IDLE output that looks something like `<DEVICE ID ffff:ffff > on Bus 001 Address 001>`). > > Maybe you wanted to store the device returned by find() somewhere? > > Also, generally speaking, you either want to find one of a specific device > usb.core.find(idVendor=<...>, idProduct=<...>) > or all devices (optionally also filtering by idVendor and/or idProduct) > usb.core.find(find_all=True) > usb.core.find(find_all=True, idVendor=<...>) > usb.core.find(find_all=True, idVendor=<...>, idProduct=<...>) > but rarely do you need a single randomly picked device. > > My suggestion is for you to (continue to) follow the PyUSB tutorial: > https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst > > Thanks, > Jonas > > > > > > > What am I missing out? > > > > _______________________________________________ > > pyusb-users mailing list > > pyu...@li... > > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Jonas M. <jo...@pr...> - 2021-04-25 21:45:06
|
On Sun, Apr 25, 2021 at 08:54:20PM +0300, Арам Абовян wrote: > thanks for the previous answer. I also get the error. > > > When I applied the following few lines in IDLE Python GUI: > > import usb.core > > dev = usb.core.find(idVendor=0x10c4, idProduct=0xea61) > ep = dev[0].interfaces()[0].endpoints()[0] > i = dev[0].interfaces()[0].bInterfaceNumber > dev.reset() > > if dev.is_kernel_driver_active(i): > dev.datach_kernel_driver(i) The is_kernel_driver_active() and detach_kernel_driver() methods are not implemented by LibUSB on Windows.[1] If you still need to detach the driver, that is, if the current OS driver is not compatible with LibUSB, you must to it manually: the recommended method on Windows is to use Zadig,[2] and suggest you stick with the WinUSB option unless you have a good reason not to. That said, don't replace the driver if you don't need to; you could unintentionally block access to the device from other programs, as well as invite problems from potential corner cases. [1] https://libusb.sourceforge.io/api-1.0/group__libusb__dev.html#ga1cabd4660a274f715eeb82de112e0779 [2] https://github.com/libusb/libusb/wiki/FAQ#How_to_use_libusb_under_Windows Jonas > > dev.set_configuration() > eaddr = ep.bEndpointAddress > > r = dev.read(eaddr, 1024) > > print(r) > > > I have got the following response : > Traceback (most recent call last): > File "C:\Users\Администратор\Desktop\davis\main.py", line 17, in <module> > if dev.is_kernel_driver_active(i): > File > "C:\Users\Администратор\Desktop\davis\venv\lib\site-packages\usb\core.py", > line 1098, in is_kernel_driver_active > return self._ctx.backend.is_kernel_driver_active( > File > "C:\Users\Администратор\Desktop\davis\venv\lib\site-packages\usb\backend\libusb1.py", > line 915, in is_kernel_driver_active > return > bool(_check(self.lib.libusb_kernel_driver_active(dev_handle.handle, > File > "C:\Users\Администратор\Desktop\davis\venv\lib\site-packages\usb\backend\libusb1.py", > line 600, in _check > raise NotImplementedError(_strerror(ret)) > NotImplementedError: Operation not supported or unimplemented on this > platform > > > чт, 22 апр. 2021 г., 15:36 Jonas Malaco via pyusb-users < > pyu...@li...>: > > > On Thu, Apr 22, 2021 at 01:38:58PM +0300, Арам Абовян wrote: > > > ---------- Forwarded message --------- > > > От: Aram Abovyan <abo...@ya...> > > > Date: чт, 22 апр. 2021 г., 13:37 > > > Subject: > > > To: abo...@gm... <abo...@gm...> > > > > > > > > > I am very new to PyUSB and any help from PyUSB experts will be highly > > > appreciated. . > > > > > > When I applied the following few lines in IDLE Python GUI, > > > --------------------------------------------------------------- > > > > > > import os > > > os.environ['PYUSB_DEBUG'] = 'debug'import usb.core > > > usb.core.find() > > > > > > ---------------------------------------------------------------- > > > > > > I have got the following response : > > > > > > ======================= ======================= > > > > > > > > > > > > 2021-04-22 10:29:59,680 > > DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL > > 'C:\Windows\system32\libusb-1.0.dll', handle 6b600000 at 0x3dc53fd250>) > > > 2021-04-22 10:29:59,688 INFO:usb.core:find(): using backend > > "usb.backend.libusb1" > > > 2021-04-22 10:29:59,688 > > DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices() > > > 2021-04-22 10:30:02,122 > > DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device > > object at 0x0000003DC73C5DC0>) > > > 2021-04-22 10:30:02,123 > > DEBUG:usb.backend.libusb1:_LibUSB._finalize_object() > > > > > > > > > > > > I have googled that, but did not understand much from the serach- > > > results. > > > > There is absolutely nothing wrong here. > > > > You enabled PYUSB_DEBUG, and called usb.core.find(). > > > > The default is for find() to find (at most) a single USB device, which, > > according to the debug output, it did (even though it appears that you > > omitted the IDLE output that looks something like `<DEVICE ID ffff:ffff > > on Bus 001 Address 001>`). > > > > Maybe you wanted to store the device returned by find() somewhere? > > > > Also, generally speaking, you either want to find one of a specific device > > usb.core.find(idVendor=<...>, idProduct=<...>) > > or all devices (optionally also filtering by idVendor and/or idProduct) > > usb.core.find(find_all=True) > > usb.core.find(find_all=True, idVendor=<...>) > > usb.core.find(find_all=True, idVendor=<...>, idProduct=<...>) > > but rarely do you need a single randomly picked device. > > > > My suggestion is for you to (continue to) follow the PyUSB tutorial: > > https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst > > > > Thanks, > > Jonas > > > > > > > > > > > What am I missing out? > > > > > > > _______________________________________________ > > > pyusb-users mailing list > > > pyu...@li... > > > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > > > > > _______________________________________________ > > pyusb-users mailing list > > pyu...@li... > > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users |