Thanks Wander,
Device is not reset this time. I have removed the reset line.
But I am not receiving any response from the printer.
Do I have to delay some time for reading or
the recieved array is to be manipulated some way.
There is another code example that is in C and its working fine.

*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()
> 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


The output is still the same.
*Output:*

> # python hardware_monitor_printer.py
> data written:  1
> data type:  <type 'array.array'>
> received data:  array('B', [0, 0, 0, 0, 0, 0])


*Device info is:*

> Device:
>   Device class: 0
>   Device sub class: 0
>   Device protocol: 0
>   Max packet size: 64
>   idVendor: 3540
>   idProduct: 424
>   Device Version: 281
>   Configuration: 1
>     Total length: 32
>     selfPowered: 1
>     remoteWakeup: 0
>     maxPower: 4
>     Interface: 0
>     Alternate Setting: 0
>       Interface class: 7
>       Interface sub class: 1
>       Interface protocol: 2
>       Endpoint: 0x81
>         Type: 2
>         Max packet size: 64
>         Interval: 0
>       Endpoint: 0x2
>         Type: 2
>         Max packet size: 64
>         Interval: 0


Could you please analyse the situation here....??
------------------------------------------------------------------------------
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

Reply via email to