Page 1 of 1

Simplest HID Report?

Posted: Mon Oct 25, 2010 11:03 am
by Talib
Referring to the following page:

http://vusb.wikidot.com/examples

especially the following lines:

Descriptors can be provided in one of four ways:

1 You can decide to use V-USB's default descriptor (with eventually resides in flash memory).
2 In flash memory.
3 In RAM.
4 By means of a function which returns the descriptor.


I would like to know how to use the first option. Basically I modified the HID-Mouse for my test application. I will basically just be sending data from the Host to the device via Control endpoint 0 as per first example on: http://vusb.wikidot.com/driver-api The problem I am having is that when I comment out the following in the HID-Mouse example:

PROGRAM char usbHidReportDescriptor[52] ....... etc

it does not want to compile. I thus want to use the default descriptor instead of that one. How do I do it or am I missing the bus completely. All this is new to me and all the USB settings is a bit overwhelming.

Re: WIKI Clarification ... default descriptor

Posted: Mon Oct 25, 2010 1:09 pm
by Talib
Basically, what i am also asking, what is the settings to make the simplest HID device (as not to require drivers)?

Re: WIKI Clarification ... default descriptor

Posted: Mon Oct 25, 2010 2:25 pm
by Talib
Ok, from what I can determine, is that I can't make a HID device without a Report. So what I am trying to do now is as described in the wiki:

Vendor type requests sent to custom HID class device

The advantages of a custom class and a HID device can be (kind of) combined. Libusb can access endpoint 0 of all devices, even those which already have a driver attached to them such as HID devices.

You can therefore create an HID class device with a simple report structure which is never used. This prevents the "New Device" dialog on Windows. Then access it with libusb or libusb-win32 as if it were a custom class device.

Advantages:

Complexity of HID can be avoided.
Same API can be used on Unix and Windows.
Prevents the "New Device" dialog on Windows.
Disadvantages:

On Windows, you still must ship libusb-win32 with your code. However, it's sufficient to have it in the same directory as your application.


I found this document:http://www.devasys.com/PD11x/JHWP.pdf

In there there is an example,Example 2 – Buttons and Lights, with the report that I have tried to modify to:

Code: Select all

const byte ReportDescriptor[] = {
6, 0, 255, // Usage_Page (Vendor Defined)
9, 1, // Usage (I/O Device)
0x19, 1, // Usage_Minimum (LED 1)
0x29, 1, // Usage_Maximum (LED 1)
0x91, 2, // Output (Data,Var,Abs) = LEDs (5 bits)
0xC0 // End_Collection
};


It is not working, any help would be appreciated.