Hello Wander,
I can write into the device. As you said earlier it was a bulk transfer.
I have tried with this code. But the return is an array of zeros.
Does it require a loop or something I am missing.
*
*
*Code*
#!/usr/bin/python
import sys
import usb.core
import usb.util
VENDOR_ID = 0x0dd4
PRODUCT_ID = 0x01a8
device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
if device is None:
sys.exit("Could not find Printer.")
if device.is_kernel_driver_active(0):
try:
device.detach_kernel_driver(0)
except usb.core.USBError as e:
sys.exit("Could not detatch kernel driver: %s" % str(e))
try:
device.set_configuration()
device.reset()
except usb.core.USBError as e:
sys.exit("Could not set configuration: %s" % str(e))
################################################
data = []
read_complete = False
print 'data written: ', device.write(2, [0x10])
try:
data = device.read( 2,6)
except Exception as e:
print e
print 'data type: ', type(data)
print 'received data: ', data
*Output*
$ sudo python hardware_monitor_printer.py
data written: 1
data type: <type 'array.array'>
received data: array('B', [0, 0, 0, 0, 0, 0])
#############################################
As you can see, I want to write '\x10' into the device
and the device is supposed to return the status.
I have a example in C that can monitor the status. But I am
struggling very much in python.
Thanks
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
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-dev2
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users