Hi all,
Thanks for your contineous support from this site.
I want to detect my board as HID mouse when plugged to USB port of PC. For that I guess I need to write HID mouse driver.
I am using LPC2148 controller. Can i gett some reference code for it?
Thanks & Regards, Kamal
Tuong,
> I changed the report desciptor following HID 1.1 pdf, but the host PC still detects it as a HID-compliant game controller??
Delete (uninstall) the device instance (game controller) once using USBDeview.
Windows keep records of device configuration on the registry. When the device configuration change, Windows often fail to refresh the record. Deleting the device instance trashes the record on the registry.
USBDeview lists up all USB device instances, regardless of current connection.
USBDeview www.nirsoft.net/.../usb_devices_view.html
OR
You are able to show up all registered devices in Device Manager. 1) Copy these two lines to a blank text file, and rename the file to DevManager.bat
set devmgr_show_nonpresent_devices=1 start devmgmt.msc
2) Double click DevManager.bat, and Device Manager comes up. Under 'View' menu, select 'Show hidden devices'
Tsuneo
Dear Tsuneo,
Thanks so much for your guidance! I have my PC detects MCB2140 as a USB keyboard and play arround with 2 bytes report in, one for modify keys one for array keys. But I still have one stupid question, need your help!!
Actually, in HID1_11.pdf, there is a report example for a standard keyboard, which the report data is 8 bytes format(1 modify keys, 1 reserve, 6 for array keys). And I see that Windows only has the maximum number of combined keys is 3 or 4, ex: CTRL+ALT+DEL, so I wonder why the standard keyboard has the report in data format is 8, is it redundant??
Please help me clear! Tuong Nguyen
I don't know if this is relevant to USB but a key press in Windows can use any number of modifiers.
CTRL+ALT+DEL is just the single key DEL with CTRL and ALT as modifiers.
But the next issue is that a keyboard can handle n-key rollover, in which it keeps track of n concurrently pressed characters, and then reports the key releases first when you do release any of the n pressed keys.
So in a game, you may press one key to move forward, while pressing another to slide sideways, while pressing a third key to fire a weapon and potentially a fourth key to aim through a sniper scope. For a gamer, it is important to select a good keyboard that supports a large "n", so it is able to keep track of many concurrently pressed keys.
> so I wonder why the standard keyboard has the report in data format is 8, is it redundant??
Keyboard puts an input report which shows the current status of all keys (snapshot) - not just the key which makes or breaks. Keyboard puts input reports regularly, or just at the timing when any key-down/-up occurs (*1). In either case, the input report is a snapshot of all keys.
The format of the standard input report for keyboard is as follows,
Byte 0 Modifier keys bitmap of left and right CTRL, SHIFT, ALT, GUI keys 1 Reserved 2 Keycode array[0] 6 byte keycode array for the keys other than modifier 3 Keycode array[1] 4 Keycode array[2] 5 Keycode array[3] 6 Keycode array[4] 7 Keycode array[5]
The Modifier keys field holds the ON/OFF status of the modifier keys on each bit, just when the report is made. The Keycode array lists up only the keys which are currently ON, up to six keys - 6-keys rollover (*2).
Comparing the last report and new one, HID host knows make/break of keys. If a keycode appears in the new report, but not in the last one, the key makes. If a keycode is shown again in the new report, the key is still pressed. If a keycode disappears in the new report, the key is released.
Thanking to this format, shooting games on your PC is able to move the hero diagonally, when you push the up and left cursor keys at the same time. Also you can fire while you are moving :-)
I don't know why a reserved byte is there between the modifier and the array. Maybe, they thought more modifier keys may be equipped in future.
(*1) chosen by SET_IDLE requests (*2) Increasing the array size on the report descriptor, input report can hold more keys. For example, 100-keys rollover :-)
Dear Tsuneo and Per Westermark,
Thanks so much for your sharing! I think I've got what I need.
Tuong Nguyen