[Tutor] pyUSB linux + unknown device

Downbound afinn at alumni.purdue.edu
Tue May 13 02:03:44 CEST 2008


I'm trying to make an interface between my weather station and my linux
server however the only output the weather station has is USB. Further,
there are only windows drivers for this Honeywell weather station. Thus, I'm
trying to use Python and pyUSB to interface. I THINK i've gotten pretty
close. It appears the device is identifying as an Unknown Product by Tenx
Technology, Inc. on USB 1.10. I can gleen all the information about the
device that you can get from 'configurations' but I'm stuck on the next
step. . Reading. Now, I'm betting the device simply is dumping packets just
like the serial device would on all other weather stations I've encountered.
However, I'm not SURE. I've pasted my code below but I'm getting this error:
"usb.USBError: error submitting URB: Device or resource busy"

Anyone have any thoughts or suggestions on where I should go from here. .
This is my first shot at PyUSB if you hadn't noticed.

import re, sys, usb, string

class DeviceDescriptor:
  def __init__(self):
    1
    
  def getDevice(self):
    buses = usb.busses()
    for bus in buses:
      for device in bus.devices:
        if hex(device.idVendor)[2:] == '1130':
          print 'Device Found:
%s:%s'%(hex(device.idVendor),hex(device.idProduct))
          return device
    print 'FAILED TO FIND THE WEATHER STATION!'
    return None

class main:

  def __init__(self):
    self.device_descriptor = DeviceDescriptor()
    self.device = self.device_descriptor.getDevice()
    self.handle = self.device.open()

  def close(self):
    self.handle.releaseInterface()

  def getDataPacket(self, bytesToGet):
    #self.handle.bulkWrite(1,"v"+(7)*"Z",1000)
    return self.handle.interruptRead(0x81,3,1000)


if __name__ == "__main__":
  data = main()
  print data.getDataPacket(10)
-- 
View this message in context: http://www.nabble.com/pyUSB-linux-%2B-unknown-device-tp17198596p17198596.html
Sent from the Python - tutor mailing list archive at Nabble.com.



More information about the Tutor mailing list