Hello,
This is my code I am currently working with. I didn't found helpful links
neither better tutorials.
This code is compiled after immense searches.
#!/usr/bin/python
import usb
vendor_id = 0x0dd4
product_id = 0x01a8
busses = usb.busses()
for bus in busses:
devices = bus.devices
for dev in devices:
if dev.idVendor == vendor_id and dev.idProduct == product_id:
conf = dev.configurations[0]
intf = conf.interfaces[0][0]
dh = dev.open()
dh.setConfiguration(conf)
dh.claimInterface(intf)
dh.setAltInterface(intf)
try:
for i in range (1, 4):
print dh.getString(i, 40)
except IOError as e:
print e
#: can I explicitly use endpoint like this ?
ep = 1
#: buff is some hex value that I need to send to the printer
buff = 0x10
timeout = 100
try:
dh.interruptWrite(ep,buff,timeout)
except Exception as e:
print e
===============================
The output of program :
$ sudo python hardware_monitor_printer.py
Traceback (most recent call last):
File "hardware_monitor_printer.py", line 15, in <module>
dh.setConfiguration(conf)
usb.USBError: could not set config 1: Device or resource busy
*************************************************
I am new to usb module. Any help would be appreciated.
Thanks in regards
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users