[Tutor] pyUSB linux + unknown device

Michael Langford mlangford.cs03 at gtalumni.org
Tue May 13 21:59:34 CEST 2008


This should get you started. You're need to go to figure out your data
format, and you're going to need to go through the data, most likely with a
snooper.

http://www.nabble.com/Using-pyusb-td16164343.html

       --Michael

On Mon, May 12, 2008 at 8:03 PM, Downbound <afinn at alumni.purdue.edu> wrote:

>
> 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.
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080513/7c2a69e7/attachment.htm>


More information about the Tutor mailing list