Error in USB module in python
<p>This is my code.
This code is supposed to monitor the printer status</p>

<pre><code>#!/usr/bin/python
import usb

class HardwareMonitor_printer(object):
    def __init__(self, vendor_id, product_id):
        self.device_found = False # True if device found
        busses = usb.busses() # enumerate busses    
        self.handle = None
        print 'busses: ',busses
        for bus in busses:
            print 'bus: ',bus
            devices = bus.devices
            print 'devices: ',devices
            for dev in devices:
                if dev.idVendor == vendor_id and dev.idProduct == product_id: # device matches    
                    self.dev = dev
                    self.conf = self.dev.configurations[0]
                    self.intf = self.conf.interfaces[0][0]
                    self.endpoints = []
                    for endpoint in self.intf.endpoints:
                        self.endpoints.append(endpoint)
                    self.device_found = True
                    return

    def open(self):
        if self.handle:
            self.handle = None
        try:
            self.handle = self.dev.open()
            self.handle.detachKernelDriver(0)
            self.handle.detachKernelDriver(1)
            self.handle.setConfiguration(self.conf)
            self.handle.claimInterface(self.intf)
            self.handle.setConfiguration(1)
            self.handle.claimInterface(1)
            self.handle.setAltInterface(self.intf)
            return True
        except:
            return False

    def write(self, ep , buff, timeout=100):
        try:
            return self.handle.interruptWrite(ep, buff, timeout) #return bytes written    
        except Exception as e:
            print e
            return 0

    def read(self, ep, size, timeout=100):
        try:
            return self.handle.interruptRead(ep, size, timeout) # return data read    
        except:
            return []

    def getDeviceName(self):
        try:
            for i in range (1, 4):
                print self.handle.getString(i,25)
        except IOError as e:
            print e

    def endpoint(self):
        return self.endpoints

if __name__ == '__main__':    
    printer= HardwareMonitor_printer(0x0dd4,0x01a8)
    if printer.device_found:
        printer.open()
        printer.getDeviceName()
        #I somehow need to write into usb device
        print printer.write(1 , [0x10], 1000)
        time.sleep(1)
        byteread = printer.read(0x10, 64)
        print 'rx data: ',byteread
</code></pre>

<p>This is my output.</p>

<pre><code>$ sudo python hardware_monitor.py
CUSTOM Engineering S.p.A.
TG2480-H
Self Power Mode
error submitting URB: No such file or directory
0
rx data:  []
</code></pre>

<p>Big thanks that you guyz replied... :)
The program is supposed to monitor the status of the printer.
As you can see I can trace the device -> TG2480-H
The thing I need now is to write some hex values to the device
so that the I can parse the response...
But its showing errror
"error submitting URB: No such file or directory"</p>

<p>Any Idea.....!!!
I am new to usb module</p>
