Ok, I installed the binary backend in addition to the Python bindings. Now it
can find a backend, and I am pretty sure that it is finding my device as well.
When I run the script, it returns:
<usb.core.Device object at 0x000000000251B080>
Traceback (most recent call last):
File “usb_test.py”, line 17, in <module>
interface_number = cfg[0].bInterfaceNumber
File “C:\Python27\usb\core.py”, line 459, in __getitem__
return Interface(self.device, index[0], index[1], self.index)
TypeError: ‘int’object is not sbuscriptable
I am not sure how to solve this error. All I want to do in the end is write
the bytes 0x9F 0x02 0x05 and 0x01 to the device. Any ideas on how to get past
this? Thanks for the help by the way.
Thanks,
Bryson
From: Ian Daniher [mailto:it.dani...@gmail.com]
Sent: Tuesday, November 29, 2011 10:18 AM
To: pyusb-users@lists.sourceforge.net
Subject: [EXTERNAL] Re: [pyusb-users] "No backend available" error
Do you have LibUSB installed? You'll need a binary backend in addition to the
Python bindings.
You can follow the installation instructions located at
http://sourceforge.net/apps/trac/libusb-win32/wiki.
On Tue, Nov 29, 2011 at 11:11, Barney, Bryson
<bbar...@sandia.gov<mailto:bbar...@sandia.gov>> wrote:
Hi,
I am new here, and a new user of PyUSB. I have a very simple HID Isochronous
application to use this for, so I thought that I would start out by running the
example that is shown in the “Programming with PyUSB 1.0” tutorial. I am
running this on windows 7 with python27
I get through the following lines:
import usb.core
import usb.util
# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
Then “ValueError: no backend abailable” appears, which is an error from line
846 in core.py. It looks like I have all three backends (libusb01.py,
libusb10.py, and openusb.py) in the usb/backend directory. Do you by any
chance know why it cannot find a backend? Any help with this would be much
appreciated.
Thanks,
Bryson
Just in case, here is the script that I am trying to run:
import usb.core
import usb.util
# find our device
dev = usb.core.find(idVendor=0x0B40, idProduct=0x0133)
# was it found?
if dev is None:
raise ValueError('Device not found')
# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
interface_number = cfg[0].bInterfaceNumber
alternate_settting = usb.control.get_interface(interface_number)
intf = usb.util.find_descriptor(
cfg, bInterfaceNumber = interface_number,
bAlternateSetting = alternate_setting
)
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT
)
assert ep is not None
# write the data
ep.write('test')
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net<mailto:pyusb-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/pyusb-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users