Hello all.

So I have some working c code for a temperature Temper1v1.1 usb temperature
sensor I recently bought: http://pastie.org/3354037

But I want to port this to using pure python via pyusb.

Based on the working c code I came up with the following:

------------

import usb.core

dev = usb.core.find(idVendor=0x0c45,idProduct=0x7401)

if dev.is_kernel_driver_active(0):
    dev.detach_kernel_driver(0)
    dev.detach_kernel_driver(1)

dev.set_configuration()

request = ''.join([chr(x) for x in
[0x01,0x80,0x33,0x01,0x00,0x00,0x00,0x00]])

dev.ctrl_transfer(0x21,9,0x200,0x1,request,8)

ret = dev.read(0x82,8,0)

print(ret)

------------

However, this fails with the following Traceback

------------


Traceback (most recent call last):
  File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/core.py",
line 177, in get_endpoint_type
    return self._ep_type_map[key]
KeyError: (130, 0, 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "temper1.py", line 15, in <module>
    ret = dev.read(0x82,8,0)
  File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/core.py",
line 629, in read
    fn = fn_map[self._ctx.get_endpoint_type(self, endpoint, intf)]
  File
"/home/lrvick/.virtualenvs/temper1/lib/python3.2/site-packages/usb/core.py",
line 180, in get_endpoint_type
    etype = util.endpoint_type(e.bmAttributes)
AttributeError: 'NoneType' object has no attribute 'bmAttributes'

------------


Clearly I am doing something wrong but I have no idea what to try next.
 Any ideas?


-- 
Lance R. Vick
__________________________________________________
Cell      -  407.283.7596
Gtalk     -  la...@lrvick.net
Website   -  http://lrvick.net
PGP Key   -  http://lrvick.net/0x36C8AAA9.asc
keyserver -  subkeys.pgp.net
__________________________________________________
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to