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
437 stars 103 forks source link

Support for Allwinner A10/A20 devices #21

Closed greso closed 9 years ago

greso commented 9 years ago

Hi, I have patched USBProxy to add support for Allwinner A10/A20 based devices like Olimex lime. It obviously breaks support for all other platforms but I was not able to figure out how to do it properly.

I tested it on a cubieboard with sunxi 3.4 kernel as there seems to be no support for gadgetfs in the mainline kernel yet.

There are two patches the first one adds a compiler flag to remove "stack smashing detected" errors I got when compiling with "gcc (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2". The second one adds support for the sunxi based gadgetfs driver.

Patch 1: https://github.com/greso/USBProxy/commit/a6c87a689343af507cef55681eeb2ec79eb55586 Patch 2: https://github.com/greso/USBProxy/commit/6563ecf75ebc19b716e96a7b9691f33e27686a76

I hope this information is useful for you even if it will become obsolete when you fix issue #1 :-)

Cheers Sören

jaapcrezee commented 9 years ago

Hello Sören,

On 12/07/14 17:40, Sören Gregor wrote:

Hi, I have patched USBProxy to add support for Allwinner A10/A20 based devices like Olimex lime. It obviously breaks support for all other platforms but I was not able to figure out how to do it properly.

I tested it on a cubieboard with sunxi 3.4 kernel as there seems to be no support for gadgetfs in the mainline kernel yet.

There are two patches the first one adds a compiler flag to remove "stack smashing detected" errors I got when compiling with "gcc (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2". The second one adds support for the sunxi based gadgetfs driver.

Patch 1: greso@a6c87a6 https://github.com/greso/USBProxy/commit/a6c87a689343af507cef55681eeb2ec79eb55586

Are you unable to find and fix the underlying issue? Just stopping the stack protector does not seem a real fix to me.

Patch 2: greso@6563ecf https://github.com/greso/USBProxy/commit/6563ecf75ebc19b716e96a7b9691f33e27686a76

Can you make some code to detect which file is present and should be used? In that case you do not brake other devices.

Maybe Dominic has other opinions... :)

Kind regards,

Jaap Crezee

greso commented 9 years ago

Hi Jaap,

I spent some more time creating a patch that detects the gadget filename to use the right endpoints: https://github.com/greso/USBProxy/commit/eacf3d9bafca3a2bcaf97c32f7bea87a88cd1bee

I also could figure out where the stack smashing happens. There are two places where it happens: https://github.com/greso/USBProxy/commit/f840f663661a01cbb1934555aea5ec2a80b213d2 As you see I increased the char size to 22 but I think this still is not quiet right. The char contains a string that includes a PID and I believe it could get bigger than five digits. Here is an example string: /USBProxy(15234)-81-EP

Cheers Sören

dominicgs commented 9 years ago

Sören,

This is great stuff, thank you. Are you using the Olimex Lime board? I have one but I haven't used USBProxy with it yet.

Do you want to send me pull requests for these changes? If you send them as separate requests then I can accept the first and we can discuss the second.

Thanks, Dominic

greso commented 9 years ago

Hi Dominic,

I created the two pull requests https://github.com/dominicgs/USBProxy/pull/22 https://github.com/dominicgs/USBProxy/pull/23

Cheers Sören

dominicgs commented 9 years ago

Both merged, thank you very much for taking the time to do this.