Hi people. I am on the middle of an electronic project which handles USB throught the device TUSB3410 which is a USB to serial converter. The main problem of this device is the intense lack of documentation and examples of how to program it. Any way, researching a lot i found that the BSD project has made a firmware for it called UTICOM, but this firmware doesnt support the standard CDC protocol, and it implements its own, with its own driver.
The device works perfectly under linux, the driver is correctly setup and the closed-source firmware of Texas Instruments is loaded, and the virtual serial port correctly configured and functional. But what i need from this device is to be able to use it through a userspace software with USB. This is not yet the problem, because i could in last instance, use the virtual serial port, but it requires special permissions. Any way, this device also haves the beauty of having 4 general purpose IO (the so called GPIOs) which, no examples uses. I started by reading the linux driver to familiarice with the control masages used with it, and i found that some control messages seem to edit any register on the memory which allows me to control the GPIOs as i want. This is where i am using PyUSB now, to see if i can control this GPIO's. At first i only want to change what i know that works. That is change the state of DTR and RTS by copying the code used in the driver to pyusb. I think i have done that, but pyusb crashes with this error: Traceback (most recent call last): File "./pyusb.py", line 156, in <module> xdata_set_register(dev,UART1_MCR, MCR_DTR | MCR_RTS, 0xFF) File "./pyusb.py", line 136, in xdata_set_register command, value, moduleid, msg) == len(msg) File "/usr/local/lib/python2.6/site-packages/usb/core.py", line 668, in ctrl_transfer self.__get_timeout(timeout) File "/usr/local/lib/python2.6/site-packages/usb/_debug.py", line 53, in do_trace return f(*args, **named_args) File "/usr/local/lib/python2.6/site-packages/usb/backend/libusb10.py", line 541, in ctrl_transfer timeout)) File "/usr/local/lib/python2.6/site-packages/usb/backend/libusb10.py", line 356, in _check raise USBError(_str_error[retval.value]) usb.core.USBError: Input/output error I am executing it with root privileges until i know for sure that is not pyusb the problem. This are the lines causing the crash: msg = message(ADDRTYPE_XDATA, DATATYPE_BYTE, 1, addr, data) print msg requesttype = (usb.util.CTRL_TYPE_VENDOR | usb.util.CTRL_RECIPIENT_DEVICE | usb.util.CTRL_OUT) command = USBCTRL_WRITE_DATA value = 0 moduleid = USBCTRL_RAM_PORT assert dev.ctrl_transfer(requesttype, command, value, moduleid, msg) == len(msg) the function message() formats the data which is passed like in the kernel. The result of this function is: [48, 1, 1, 0, 0, 255, 164, 48, 255] Now i am not sure if this fails - because of an error on pyusb - because the control message is badly built and the device doesnt answer (i read something about a timeout function) - because it is not possible to comunicate with a device which has a real driver assigned to it - any of the other 3 Does somebody have an idea?? Thanks Diego ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users