usb-tools / USBProxy-legacy

A proxy for USB devices, libUSB and gadgetFS - this project is unmaintained, try here: https://github.com/usb-tools/Facedancer
GNU General Public License v2.0
431 stars 102 forks source link

Lagg on OS X or Linux #59

Closed knellt closed 2 years ago

knellt commented 8 years ago

Im running the latest release img on a beaglebone black rev c and it works well when connected to a Windows machine, but the mouse is almost unusable on Linux or OS X machines, any idea why this could be?

dominicgs commented 8 years ago

The release image is very old, I recommend running git pull from the USBProxy directory and then rebuilding the project.

knellt commented 8 years ago

That was the first thing I tried, had to update gcc and g++ and then I got it working but the lagg is actually worse than before.

JesusFreke commented 8 years ago

I have a similar problem when trying to proxy a joystick that continuously sends events at basically the maximum rate. It will receive something like 4-5 events from the joystick in the time it takes to send 1 packet to the endpoint via gadgetfs.

As best as I can tell, the problem is that in relay_write() in RelayWriter.cpp, it waits until the previous write has completed before starting the next write, which seems like a complicated way to do synchronous IO using the asynchronous functions.

If I modify it so that it doesn't wait for the previous write to complete, it is able to keep up with the stream of events coming from the joystick.

@dominicgs Is this something you would consider accepting a patch for? I'm not sure if there might be unintended side effects of doing the IO like this..

JesusFreke commented 8 years ago

Actually, I see that the GadgetFS host proxy would probably need to be rewritten so that it properly supports having multiple async writes out at the same time.

dominicgs commented 8 years ago

I would accept that patch. It's worth submitting anyway as I plan to switch out GadgetFS for ConfigFS as soon as I get time to work on it.

lindi2 commented 8 years ago

With git 021e810a88ea81e37c5e252f371bf2cf7173b47a handling traffic between a logitech mouse and Debian 8 host I get 15 updates per second.

lindi2 commented 8 years ago

With

diff --git a/src/lib/RelayWriter.cpp b/src/lib/RelayWriter.cpp
index 532f779..8bf1570 100644
--- a/src/lib/RelayWriter.cpp
+++ b/src/lib/RelayWriter.cpp
@@ -141,7 +141,7 @@ void RelayWriter::relay_write() {
                        }
                        if (p->transmit) {
                                proxy->send_data(endpoint,attributes,maxPacketSize,p->data,p->wLength);
-                               writing=true;
+                               //writing=true;
                        }
                } else {
                        writing=!(proxy->send_wait_complete(endpoint, READ_TIMEOUT_MS));

I get 84 updates per second.

straithe commented 2 years ago

I'm sorry there has been no response to this in a very long time. @N1KLoT are you still experiencing this issue?

straithe commented 2 years ago

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.