Rockbox

Tasklist

FS#10218 - USB HID keymaps - please test

Attached to Project: Rockbox
Opened by Tomer Shalev (tomers) - Tuesday, 19 May 2009, 07:01 GMT
Last edited by Frank Gevaerts (fg) - Saturday, 23 May 2009, 14:43 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Please test my latest work on having Rockbox identify as a Human Interface Device when it is connected through USB.

It suppose to act as a Multimedia Keyboard, sending key codes to the OS, such as volume and track control.
I created keymaps for all platforms, but not all of them have drivers that know how to configure USB interrupt transfers in the USB controller.

Please try it and post your feedback. Thanks!
   hid.patch (82.4 KiB)
This task depends upon

Closed by  Frank Gevaerts (fg)
Saturday, 23 May 2009, 14:43 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed as r21054
Comment by Tomer Shalev (tomers) - Tuesday, 19 May 2009, 07:08 GMT
The followings are instructions to download, apply, and compile the patch:

$ svn co svn://svn.rockbox.org/rockbox/trunk rockbox
$ wget http://www.rockbox.org/tracker/task/10218?getfile=19454 -O hid.patch
$ cd rockbox
$ patch -p0 -i ../hid.patch
$ mkdir build && cd build/ && ../tools/configure
$ make
...
Comment by Steve Bavin (pondlife) - Tuesday, 19 May 2009, 11:12 GMT
Hi Tomer,

Should this work on the H300? I see you've defined a keymap, but I guess that the hardware USB support won't allow this.

For whatever it's worth, I'd find more use for the opposite (i.e. USB input to control Rockbox) - I guess this is HID host support?
Comment by Tomer Shalev (tomers) - Tuesday, 19 May 2009, 19:40 GMT
Attached a cleaner patch. No logical changes from last patch, but with some redundant changes removed.
   hid.patch (65.9 KiB)
Comment by Tomer Shalev (tomers) - Tuesday, 19 May 2009, 20:19 GMT
> Should this work on the H300? I see you've defined a keymap, but I guess that the hardware USB support won't allow this.
Unfortunately, the H300 does not uses Rockbox's USB stack (HAVE_USBSTACK is not defined).
Indeed, I defined keymaps for all platforms, regardless of whether they use the Rockbox stack. These keymaps should be removed.

> For whatever it's worth, I'd find more use for the opposite (i.e. USB input to control Rockbox) - I guess this is HID host support?
You are right. A custom driver should be implemented and used on the host side, and Rockbox should be set to send messages, possible using the USB HID protocol.
Read more here: http://www.edn.com/article/CA243218.html
Comment by Tomer Shalev (tomers) - Tuesday, 19 May 2009, 21:15 GMT
Updated patch:
Removed platforms without HAVE_USBSTACK defined.
   hid.patch (33.4 KiB)
Comment by Maurus Cuelenaere (mcuelenaere) - Wednesday, 20 May 2009, 11:25 GMT
I'm not sure where you got this, but the Onda VX747 only has 4 physical buttons (BUTTON_VOL_DOWN, BUTTON_VOL_UP, BUTTON_MENU & BUTTON_POWER). (so no BUTTON_UP)

Also I think you should set the touchscreen mode to grid mode on a touchscreen target when entering usb_handler and set it back to the original mode when leaving it, otherwise the emulated touch buttons won't work when a user has set it to absolute point mode. In the end there should be a better solution for touchscreen targets IMO involving visual confirmation so you know what action happens when you press something on the screen.

Haven't tested this patch (yet) though.
Comment by Tomer Shalev (tomers) - Wednesday, 20 May 2009, 20:45 GMT
Updated patch, according to mcuelenaere's remarks (thanks!)

Fixed Onda VX747 key mappings
Set the touchscreen mode to grid mode on a touchscreen target when entering usb_handler and set it back to the original mode when leaving it

> In the end there should be a better solution for touchscreen targets IMO involving visual confirmation so you know what action happens when you press something on the screen.
Agreed. The should be a visual buttons on screen for buttons mode, and there should be an option in the menu to switch to tablet mode, when the device acts as a touchpad that moves the mouse cursor on the host's screen.

This is call for developers - please confirm the keymapping are working for your platform.

I've tested this patch on Sansa E200.

To test it, just compile this patch, reboot RB, and attach it to USB. Open media software on your OS, and verify you can control the volume and tracks played according to your keymap (apps/keymaps/keymap-XXX)

Thanks!


   hid.patch (33.7 KiB)
Comment by Maurus Cuelenaere (mcuelenaere) - Wednesday, 20 May 2009, 21:33 GMT
I tried it on a Onda VX747 and it works (apart from the issue I told you about on IRC), but in order to get the physical buttons to work you need to replace line 314 in apps/keymaps/keymap-touchscreen.c with this: return target_get_context_mapping(CONTEXT_USB_HID);

This of course disables the emulated touch buttons, but I'm not sure how to fix this issue..
Comment by Matthew Bonnett (Vchat20) - Thursday, 21 May 2009, 00:29 GMT
Tested the latest patch file on my Sansa e200v1 with the latest SVN build and works flawlessly that I can tell. Winamp is controlled just as I'd expect as are other media apps. Kudos!

I'd really love to see someone go all out on the usb interface in rockbox for those targets that have full support like a PC->rockbox display interface and usb audio support.
Comment by Tomer Shalev (tomers) - Thursday, 21 May 2009, 07:58 GMT
Updated patch. Fixed remarks by mcuelenaere (thanks!)

Platforms status:

Works: e200
Other issues: ondavx747 (unrelated to this patch)

Not tested:
c100, c200, clip, creativezv, creativezvm, gigabeat-s, h10, hdd1630, ipod, mr100, ondavx767, sa9200

Please test with your platform. Thanks!


   hid.patch (33.7 KiB)
Comment by Maurus Cuelenaere (mcuelenaere) - Thursday, 21 May 2009, 10:45 GMT
Regarding the creativezv & creativezvm: these don't have a fully working USB driver yet so they can't be tested atm (apart from the fact that the port isn't in a very advanced stage).
Regarding the ondavx767: this has the same USB driver as the ondavx747, but it doesn't have a working LCD driver (yet); so there's no real way of testing it (and the only tester with one is wpyh AFAIK); but the patch should probably work.

edit:
targets with emulated touchscreen buttons only (no physical buttons) won't work with this patch as it'll always ask for the target context mapping and so skipping the touchscreen context mapping; IMO somehow the keymap driver should get adjusted to handle both emulated touchscreen buttons and physical buttons -> this should probably go in another Flyspray item.

edit2:
never mind the above comment, I didn't fully understand how the keymap driver works.
@tomers:
you should replace LAST_ITEM_IN_LIST with LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_USB_HID) in keymap-touchscreen.c (and revert my previous keymap-touchscreen.c suggestion)
Comment by Tomer Shalev (tomers) - Friday, 22 May 2009, 04:08 GMT
Updated patch
~~~~~~~~~~~
- Fixed more remarks by mcuelenaere (thanks!)
- Removed Creative platforms
- Remove Onda VX767

Platforms status
~~~~~~~~~~~~
Needs testing:
- c100
- c200
- clip
- gigabeat-s
- h10
- hdd1630
- ipod
- mr100
- sa9200

Works:
- e200

Have issues:
- ondavx747 (unrelated to this patch)

Please test with your platform. Thanks!

The followings are instructions to download, apply, and compile the patch:

$ svn co svn://svn.rockbox.org/rockbox/trunk rockbox && cd rockbox
# Download hid.patch
$ patch -p0 -i ../hid.patch
$ mkdir build && cd build/ && ../tools/configure
$ make

To test it, just compile this patch, reboot RB, and attach it to USB. Open media software on your OS, and verify you can control the volume and tracks played according to your keymap (apps/keymaps/keymap-XXX)

Tomer
   hid.patch (29.6 KiB)
Comment by Tomer Shalev (tomers) - Friday, 22 May 2009, 20:26 GMT
iPod keymap works!

Platforms status
~~~~~~~~~~~~
Needs testing:
- c100
- c200
- clip
- gigabeat-s
- h10
- hdd1630
- mr100
- sa9200

Works:
- e200
- ipod

Have issues:
- ondavx747 (unrelated to this patch)

Loading...