[usbproxy] Re: Modify Descriptors

  • From: Rikkert ten Klooster <hjtenklooster@xxxxxxxxx>
  • To: usbproxy@xxxxxxxxxxxxx
  • Date: Wed, 28 Oct 2015 11:24:09 +0100

Hello Dominic,

Thanks for your quick response!

On 27 Oct 2015, at 17:30, Dominic Spill <dominicgs@xxxxxxxxx> wrote:

On 27 October 2015 at 15:30, Rikkert ten Klooster
<hjtenklooster@xxxxxxxxx> wrote:

I’ve managed to write some simple filter plugins, which is working great.

That's great. I'm glad it's working for you.

However, I’d like to be able to work with the USB Device descriptors. I
would like to modify the fields of the descriptors, such as idVendor,
idProduct, bcdDevice.

Issue #2 on github describes that requests aren’t filtered, is there maybe a
workaround to do so? For now I’d just like to change it for a PoC (even if
it’s just quick and dirty). Anyone who can point me in the right direction,
as in which file or class I could work with to do so?

You're right, this has been on my list of things to solve for a while
now. I think we can address it temporarily by making the changes in
the constructors of the various levels of the descriptor hierarchy.
If you look in src/lib/ you will see C++ source files named for the
various levels of the descriptors: Device.cpp, Configuration.cpp,
Interface.cpp, etc. If you hard code changes in there, it will
achieve what you want.
I’ve tried hardcoding changes in idVendor / idProduct. I've also tried
changes in so in other files such as DeviceProxy_LibUSB.cpp, without any result.
Unless lsusb in linux is broke, it doesn’t give me the altered descriptor
information, but gives me the original idProduct / idVendor values.
Do you have any idea what I’m doing wrong? I’ve also added a line in the
constructor containing:
std::cerr << “My custom error\n”;
This error wasn’t printed to the terminal, So i’m wondering if the part
gets executed at all?

In the future we should definitely filter those packets, which
probably means having one of the proxies build the model rather than
the manager and passing the packets through the filters. There are a
few questions here, which proxy should build the model? Do we want the
model to represent the real device? Or the modified one?
I’m not sure about this, perhaps you would need a new model, containing
all the descriptor information, and create 2 objects, one for the original,
and one for the altered device?



Other related posts: