Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Tomer Shalev - 2009-05-19
Last edited by Frank Gevaerts - 2009-05-23

FS#10218 - USB HID keymaps - please test

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)
Closed by  Frank Gevaerts
2009-05-23 14:43
Reason for closing:  Accepted
Additional comments about closing:  

Committed as r21054

Tomer Shalev commented on 2009-05-19 07:08

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

Steve Bavin commented on 2009-05-19 11:12

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?

Tomer Shalev commented on 2009-05-19 19:40

Attached a cleaner patch. No logical changes from last patch, but with some redundant changes removed.

   hid.patch (65.9 KiB)
Tomer Shalev commented on 2009-05-19 20:19
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
Tomer Shalev commented on 2009-05-19 21:15

Updated patch:
Removed platforms without HAVE_USBSTACK defined.

   hid.patch (33.4 KiB)
Maurus Cuelenaere commented on 2009-05-20 11:25

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.

Tomer Shalev commented on 2009-05-20 20:45

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)
Maurus Cuelenaere commented on 2009-05-20 21:33

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..

Matthew Bonnett commented on 2009-05-21 00:29

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.

Tomer Shalev commented on 2009-05-21 07:58

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)
Maurus Cuelenaere commented on 2009-05-21 10:45

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)

Tomer Shalev commented on 2009-05-22 04:08

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)
Tomer Shalev commented on 2009-05-22 20:26

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...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing