|
![]() USB
![]() OpenSUSE 11.1 libhid-0-2.16 problem
|
| next newest topic | next oldest topic |
| Author | Topic: OpenSUSE 11.1 libhid-0-2.16 problem |
|
hjsteger New Member |
I've developed USB-to-I2C bridge firmware running on the C8051F340DK board. I based this firmware on the following examples; HIDtoUART example and the SMBus example. I removed the UART functionality from the HIDtoUART and replaced it with SMBus_Master firmware. In addition, using Microsoft Visual Studio 2008, I modified the host-side HIDtoUART code to support this application. Running on a Windows XP PC, the host application and firmware work reliably and have no noticeable problems. Ultimately though, this firmware needs to work with an HID interface on a Linux-based PC. With my initial attempts with Linux's HID interface, my results have been alot less reliable. For USB writes to the C8051 endpoint, there are no problems. But it seems that if I open the USB interface, read data from the C8051 endpoint, and then close the USB interface, this process works every other time. It seems as though either something doesn't close properly with the Linux HID interface or something doesn't initialize properly but so far these are only preliminary guesses as to what is going on. The version of Linux I am using is OpenSUSE 11.1. The HID interface is an open source libhid-0-2.16. Does anyone have any incite into this problem? Are there known differences that may be relevant to this problem between SLABHIDDEvice.dll running on Windows and libhid-0-2.16 for Linux? IP: Logged |
|
Tsuneo Member |
I don't fiddle libhid at all, but I heard it is based on libusb. For libusb, HID device should be detached from the default hiddev driver, using usb_detach_kernel_driver_np() In this post on Microchip forum, xiaofan shows libusb code for HID which works successfully. Tsuneo IP: Logged |
|
Tsuneo Member |
It may be a problem of the data toggle initialization at Set_Configuration and Set_Interface handler. SiLabs USB examples don't initialize data toggle at Set_Configuration and Set_Interface handler. Data toggle is reset just at bus reset. This problem doesn't reveal on the most of drivers on Windows and MacOS X. But libusb code (both on Linux and Win32) may put Set_Configuration twice or more, without preceding bus reset. Also, libusb code may put Set_Interface at any time. Here is a fix of Set_Configuration handler. C:\SiLabs\MCU\Examples\C8051F34x\USB_HID\HIDtoUARTExample\F3xx_USB0_Standard_Requests.c
C:\SiLabs\MCU\Examples\C8051F34x\USB_HID\HIDtoUARTExample\F3xx_USB0_Standard_Requests.c
Tsuneo [Revised] [This message has been edited by Tsuneo (edited July 30, 2010).] IP: Logged |
|
hjsteger New Member |
Thanks for this information. I added these changes to the Set Configuration and Set Interface routines but they didn't fix the problem I am seeing. I am going to use a USB Bus Analyzer and compare traces that I get using Windows and those when using Linux. Hopefully, I will see something significantly different between the two that will help pinpoint this problem. IP: Logged |
|
hjsteger New Member |
Using a USB bus analyzer, I was able to capture Data Toggle errors that are atleast one cause for the problems with this USB-to-IIC Bridge using a Linux-based host. I have a screenshot of the analyzer trace but I don't see a way that I can attach a file to this posting. Is there a place where I can post this file? IP: Logged |
|
hjsteger New Member |
I looked more carefully at the analyzer trace and found something strange. There's an OUT DATA0 transaction that the target ACKs followed by an IN DATA0 transaction. Under what conditions would a target successfully receive the data of an OUT packet but not transition its toggle bit? Doesn't the fact that the target ACKs the OUT DATA0 packet mean that the target received the data successfully? Shouldn't the target transition its toggle bit at this point? IP: Logged |
|
hjsteger New Member |
Never mind that last posting - that was a newbie error. I figured out that each endpoint has its own toggle bit. The IN and the OUT toggle bits are separate. My mistake! IP: Logged |
|
hjsteger New Member |
Regarding the fix added to Set_Configuration, it seems that Set_Configuration is only called when the OS first recognizes the USB device. Is there a specific command supported by Linux's libhid that will call Set_Configuration? IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?