Closed matlo closed 2 years ago
I haven't looked at dummy_hcd before, but it looks like a very useful tool to pair with USBProxy.
I think the problem is that we don't yet support the controllers that dummy_hcd emulates, but it should only be a minor change to add support.
Some things to try first: 1) Try dummy_hcd with one of the pre-built gadgets, such as the serial device or mass storage. This just makes sure that it's not a problem with dummy_hcd on your system. 2) Try the following:
modprobe dummy_hcd
modprobe gadgetfs
mkdir /tmp/gadget
mount gadgetfs /tmp/gadget
ls /tmp/gadget
The filesystem should contain a single file that specifies which type of controller it is emulating. Then hopefully we can just add that to the list that we check for.
Oh, wait, I misread the output. We clearly support it as the device appears. This looks like it's some deeper bug.
I started usb-mitm with gdb, and suspended the execution before the open_endpoint() function. The program tries to open /tmp/gadget-ZgqpOH/ep1in, but there's no such file:
ll /tmp/gadget-ZgqpOH/
total 0
-rw------- 1 root root 0 mars 27 19:45 dummy_udc
-rw------- 1 root root 0 mars 27 19:45 ep10in-int
-rw------- 1 root root 0 mars 27 19:45 ep10out
-rw------- 1 root root 0 mars 27 19:45 ep11in-bulk
-rw------- 1 root root 0 mars 27 19:45 ep11out
-rw------- 1 root root 0 mars 27 19:45 ep12in
-rw------- 1 root root 0 mars 27 19:45 ep12out-bulk
-rw------- 1 root root 0 mars 27 19:45 ep13in-iso
-rw------- 1 root root 0 mars 27 19:45 ep13out
-rw------- 1 root root 0 mars 27 19:45 ep14in
-rw------- 1 root root 0 mars 27 19:45 ep14out-iso
-rw------- 1 root root 0 mars 27 19:45 ep15in-int
-rw------- 1 root root 0 mars 27 19:45 ep15out
-rw------- 1 root root 0 mars 27 19:45 ep1in-bulk
-rw------- 1 root root 0 mars 27 19:45 ep1out-bulk
-rw------- 1 root root 0 mars 27 19:45 ep2in-bulk
-rw------- 1 root root 0 mars 27 19:45 ep2out-bulk
-rw------- 1 root root 0 mars 27 19:45 ep3in-iso
-rw------- 1 root root 0 mars 27 19:45 ep3out
-rw------- 1 root root 0 mars 27 19:45 ep4in
-rw------- 1 root root 0 mars 27 19:45 ep4out-iso
-rw------- 1 root root 0 mars 27 19:45 ep5in-int
-rw------- 1 root root 0 mars 27 19:45 ep5out
-rw------- 1 root root 0 mars 27 19:45 ep6in-bulk
-rw------- 1 root root 0 mars 27 19:45 ep6out
-rw------- 1 root root 0 mars 27 19:45 ep7in
-rw------- 1 root root 0 mars 27 19:45 ep7out-bulk
-rw------- 1 root root 0 mars 27 19:45 ep8in-iso
-rw------- 1 root root 0 mars 27 19:45 ep8out
-rw------- 1 root root 0 mars 27 19:45 ep9in
-rw------- 1 root root 0 mars 27 19:45 ep9out-iso
Right, but there's a file called ep1in-bulk
which we should be opening instead.
This is confusing, that's a very large list of endpoints, most of which don't exist in the descriptors that we wrote to dummy_udc.
I built and ran this locally earlier today and hit a different error, but I think it was probably related. I was having reads fail from one of the files.
Looks like this line needs to be updated to also check for dummy_udc: https://github.com/dominicgs/USBProxy/blob/master/src/Plugins/Hosts/GadgetFS_helpers.c#L247
I hardcoded "in-bulk" and got it to work :) There's some packet buffering, I think my mouse is too fast (bInterval is 1ms). I also had to comment out the libusb_hotplug_register_callback stuff in DeviceProxy_LibUSB.cpp because usb-mitm fails at unmouting gadgetfs...
Yes, the unmounting thing is strange, I don't see that behaviour with real gadget devices.
There's a bug where the gadgetfs module "used by" count is -1. This is something we see on the BBB but it uses an unsigned int rather than a signed one (which seems strange).
I'll probably fix the logic to match the sw_usb_udc
device.
Actually, ep1in-bulk means that the endpoint has a fixed (direction, type). I think we should probe the available endpoints and map each device endpoint to the first available endpoint that can have the same direction and type. Example with dummy_hcd: endpoint 1, interrupt in => ep4in endpoint 2, interrupt in => ep5in-int What do you think about it?
@matlo Did you get any further with this issue? I've just merged your other changes and would be keen for dummy_hcd support.
No I didn't. I'm not sure I'll have time to work on it.
I'm sorry you haven't gotten a response in a while, @matlo. Are you still experiencing this issue?
I'm going to close this as there hasn't been a response in a while, but please re-open this issue or open a new one if you still need assistance.
Hi, I'm trying to make USBProxy work with dummy_hcd. I'm using Ubuntu 14.04 which runs a 3.13 linux kernel. I built the gadgetfs and dummy_hcd modules:
I loaded the dummy_hcd module:
And I started usb-mitm:
Here is the output of dmesg:
It seems something wrong happens at 56.933786. Has anyone managed to get USBProxy work with dummy_hcd? Any suggestion?