libusb and linux

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
eslavko
Rank 1
Rank 1
Posts: 36
Joined: Sat Dec 18, 2010 6:37 pm

libusb and linux

Post by eslavko » Fri Nov 29, 2013 9:33 pm

Helo...
I have little ADC working in windows. Now I like to port to linux (raspberry/beaglebone).
ADC act as HID. The working solution is writen in basic. After oppening USB (to get handle) I just repeated read like this

Code: Select all

declare function HidD_GetFeature lib "hid.dll" alias "HidD_GetFeature" (hnd As integer,buf As integer,len As integer) As Integer
HidD_GetFeature(HidHandle,buffer,9)


Now for linux I tried python and libusb. After twigling with permissions (dont need to be sudo any more) I can find and open interface based on name, but cant got any data from usb. Any idea?

The as short as possible python test. I tryed many values for request_type and request, but without success.

Code: Select all

import usb1

#Try to open my stick - no error checking at all
context = usb1.USBContext()
for device in context.getDeviceList(skip_on_error=True):
    if device.getProduct()=='IsolADC':
        devh=device.open()
       
print devh  #just print descriptor to see

#now try to get 8 bytes from control point
request_type=0# (1<<5) #HID CLASS
request=0 #1 #GET REPORT
value=0
index=0
length=8

tmp= devh.controlRead(request_type, request, value, index, length,0)
print len(tmp)
print '>',tmp


Post Reply