Hi everyone,

I'm having trouble comunicating with a custom made (from a PIC 18f4550
micro-controller) HID device. Nowadays is used with windows and the default
HID driver in vb6 but I would like to port it to linux (ubuntu 10.10) and
pyusb (1.0a).

The device is simple, when it receives 3 bytes via HID it responses 3 bytes
back with data. The people who made it told me that everything is handled
via end point 0 and default config).

As I want to port it to linux I read this tutorial
http://pyusb.sourceforge.net/docs/1.0/tutorial.html and tried to communicate
via default config endpoint configuration:

#prueba.py

import usb.core

#busco dispositivo
dev = usb.core.find(idVendor=1240,idProduct=32)
if dev is None:
    raise ValueError('Device not found')

interface = dev.get_interface_altsetting()
if dev.is_kernel_driver_active(interface.bInterfaceNumber) is True:
        dev.detach_kernel_driver(interface.bInterfaceNumber)


dev.set_configuration()

#mensaje de 3 bytes
msg = '\x02\x03\x00'

#bmRequestType y bRequest as said in
http://www.jungo.com/st/support/documentation/windriver/811/wdusb_man_mhtml/node55.html#usb_standard_dev_req_codes


dev.ctrl_transfer(0x40, 0x02, 0, 0, msg)


and I get this error which I don't fully understand:

Traceback (most recent call last):
  File "ejemplo.py", line 39, in <module>
    print  dev.ctrl_transfer(0x40, 0x02, 0, 0, msg)
  File "/home/administrador/pyusb-1.0.0-a0/usb/core.py", line 668, in
ctrl_transfer
    self.__get_timeout(timeout)
  File "/home/administrador/pyusb-1.0.0-a0/usb/_debug.py", line 53, in
do_trace
    return f(*args, **named_args)
  File "/home/administrador/pyusb-1.0.0-a0/usb/backend/libusb10.py", line
538, in ctrl_transfer
    timeout))
  File "/home/administrador/pyusb-1.0.0-a0/usb/backend/libusb10.py", line
353, in _check
    raise USBError(_str_error[retval.value])
  *usb.core.USBError: Pipe error*

Could someone guide me ? help me see what I'm doing wrong ?

Thanks in advance !
Marcos.


PD: I tried to sniff usb ports with this tutorial
http://biot.com/blog/usb-sniffing-on-linux but nothing seems to be happening
excepto when I reset the device.
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to