Rockbox

Tasklist

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

Attached to Project: Rockbox
Opened by amaury pouly (pamaury) - Sunday, 17 January 2010, 00:31 GMT
Task Type Patches
Category Simulator
Status New
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 0%
Votes 0
Private No

Details

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:
http://sourceforge.net/projects/usb-vhci/files/
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 (http://sourceforge.net/apps/mediawiki/usb-vhci/index.php?title=Main_Page)

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:
/*#define USB_VHCI_DRIVER_DEBUG*/
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.
This task depends upon

Comment by amaury pouly (pamaury) - Thursday, 21 January 2010, 21:54 GMT
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.
Comment by amaury pouly (pamaury) - Wednesday, 27 January 2010, 19:15 GMT
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.
Comment by amaury pouly (pamaury) - Sunday, 07 February 2010, 12:12 GMT
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

Loading...