• Status New
  • Percent Complete
  • Task Type Patches
  • Category User Interface → Simulator
  • 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 pamaury - 2010-01-17

FS#10916 - Add usb capability to simulator on Linux hosts

This patch adds to the simulator the ability to simulate usb on a Linux host.
To do this, you'll need to download, build and install a device driver. You can download it here: Just download the "linux kernel module". See install instruction in it but it's make && make install. Of course you'll need root rights. There also a wiki about it (

Now to have usb simulation works correctly you'll of course need to load the driver
modprobe vhci-hcd
And you'll probably need to edit the access rights of the device control device:
violent example: chmod 0666 /dev/vhci-ctrl
other example: chown root:<myself> /dev/vhci-ctrl
Or you can add a udev rule if you can make this work.

You can then run the simulator normally (note the the detection is at runtime so you don't need to have it work before launching the simulator).
Press 'u' to simulate usb insertion and 'u' once more the simulate usb removal.

Some miscellaneous remarks:
-the patch enables usb hid but for some reasons it doesn't work in main menu. However, the remote_control plugins works
-the patch enables usbserial which of no interest here but a way to test bulk transfers
-the patch DOESN'T enable usbstorage because storage simulation is a stub currently.

If it doesn't work, you can still uncomment this line in usb-drc.c:
And this line in usb-core.c:
/*#define LOGF_ENABLE*/
But beware ! Your console will end up full of obscure messages.

I'm particulary interested in compile feedback under Windows and OSX.
And of course I'm interested in working feedback ranging from device detection to working state (HID and usbserial) for example.

Here is a much better version. It supports usbstorage (using ramdisk). It uses a real thread, is much faster, supports buffer and URB splitting, … It's also much more complicated !

edit: I noticed that I modified io.c to add a fflush(stderr), which is a debug stuff only to remove.

A new version, nearly everything was modified, tweaked, … It seems to works under Linux and also under Windows (ran into virtualbox) with UMS+HID.
There are debugging stuff in this patch.

New version:
-sync with r24542
-make all threads acknowledge usb insertion correctly
-prevent rockbox from issuing a panic on slave mode exit because the ramdisk is not formated and RB can't mount anything


Available keyboard shortcuts


Task Details

Task Editing