Hi Xiaofan,

Thank you for reply. I did test using "SimpleHIDWrite" and come to some interesting observations: (1) At first I tried "SimpleHIDWrite" and it was not detecting my device. Then I uninstalled the driver from Driver Manager window. And then
I tried using "SimpleHIDWrite" and it is started working.
This is because, I have used "inf-wizard.exe" utility to generate the inf file and this utility also installed it.

(2) Now my device using the windows hid driver.
Then I tried running my Python Program. The program just goes to infinite loop after the call set_configuration() function. And does not come out even if I press Ctrl+Z. Our terminal does not close even I use "Task Manager". I have to shutdown PC to close the terminal.

(3) The I come across the following post. Which said, I should download the binary snapshots and put the DLL inside windows\system32 directory.
http://www.mail-archive.com/pyusb-users@lists.sourceforge.net/msg00263.html

The I downloaded the snapshot "***2011.03.08 (pbr336) <http://libusb-winusb-wip.googlecode.com/files/libusb_2011.03.08.7z>"* from "http://www.libusb.org/wiki/windows_backend";. And copied "D:\>\....\libusb_2011.03.08\MS32\dll\libusb-1.0.dll" file to "windows\system32" folder.

(4) The I tried running my Python Program again. Bow it is not hanging after the call to "set_configuration()" function. But it is giving the following error:
--------------------------------
Traceback (most recent call last):
  File "Display_Descriptor_Fields5.py", line 69, in <module>
    dev.set_configuration()
File "C:\lang\Python27\lib\site-packages\usb\core.py", line 530, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
File "C:\lang\Python27\lib\site-packages\usb\core.py", line 91, in managed_set_configuration
    self.managed_open()
File "C:\lang\Python27\lib\site-packages\usb\core.py", line 70, in managed_open
    self.handle = self.backend.open_device(self.dev)
File "C:\lang\Python27\lib\site-packages\usb\_debug.py", line 52, in do_trace
    return f(*args, **named_args)
File "C:\lang\Python27\lib\site-packages\usb\backend\libusb10.py", line 446, in open_device
    _check(_lib.libusb_open(dev.devid, byref(handle)))
File "C:\lang\Python27\lib\site-packages\usb\backend\libusb10.py", line 357, in _check
    raise USBError(_str_error[retval.value])
usb.core.USBError: Operation not supported or unimplemented on this platform
Press any key to continue . . .
------------------------------------

Please guide me. I need the guidence, where am I wrong? My device is simple, so I don't mind using windows driver.


Thanks,

Regards,
Prashant


On 26/04/2011 2:37 p.m., Xiaofan Chen wrote:
On Tue, Apr 26, 2011 at 8:34 AM, Prashant Patel<prash...@wipath.co.nz>  wrote:
Hi,

I am new to PyUSB and libusb-win32. I am trying to send data to my HID
device to turn LED ON/OFF along with some characters to display on LCD on
the Device. As my HID Device got the ready made code from Renesas Rx62N USB
Device API. It is working fine.
How do you know it is working fine? Have you tested it with any host
program?

For example: you can try out SimpleHIDWrite as a testing tool.
http://www.lvr.com/hidpage.htm

And Even PyUSB device can read the fields of
device descriptor, configuration descriptor, interface descriptor and
endpoint descriptor.

Now I want to send 17bytes of data to my device. My device got only
Interrupt IN Endpoint-3. So I think I need to use Control Transfer to send
data to my device.
If you only have IN EP3 and you do not have an Interrupt Out Endpoint,
then yes you need to use Control transfer for OUT report.

I tried a lot different ways but it is giving me error on
the following line.
I have tried other bmRequestType but does not work.
dev.ctrl_transfer(bmRequestType=0x42, bRequest=0x09, wValue=0x02,
wIndex=0x00, data_or_wLength=msg, timeout=100)
In order for this to work, your firmware needs to support
this request.

And I think you want to use Set_Report request? Right?
You may want to read the HID Class specification first.

http://www.usb.org/developers/devclass_docs/HID1_11.pdf
7.2.2 Set_Report Request
The Set_Report request allows the host to send a report to the device,
possibly setting the state of input, output, or feature controls.
Part                                          Description
bmRequestType                        00100001
bRequest                                  SET_REPORT (9)
wValue                                     Report Type and Report ID
wIndex                                      Interface
wLength                                    Report Length
Data                                         Report

raise USBError(errmsg)
usb.core.USBError: libusb0-dll:err [control_msg] sending control message
failed, win error: A device attached to the system is not functioning.

I have attached the descriptor files along with the file of my code.

Please guide me, what should I do to get it working. Or where am I wrong?
I think you need to work on the firmware first before trying out
pyusb.


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to