Quantcast

New project: libusb over TCP/IP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

New project: libusb over TCP/IP

Marek Vavruša
Hi folks,

for anyone interested - I have started a library, which is able to
interact with USB subsystem over TCP/IP.
It basically intercepts dynamic calls to libusb functions in your
executable, forwards the function call to remote server and interprets
the result locally. I'm very excited about this approach, because it
works with existing system executables as is - no need to recompile or
any extra work whatsoever!

I'm using it already for virtualization of our university education
devices (FTDI2232 + MSP430) on clients.
The wrapper basically renders remote USB subsystem just as if it was
connected to local computer, so there's plenty of uses.

 - Virtualization of devices.
 - Sharing your devices with friends over network.
 - Debugging / Flashing your devices remotely. OpenMoko anyone?

Feature overview:

 - Implemented in C/C++, works under POSIX.
 - Generic server and client executables, libusb transport implemented.
 - No authentication or safe authentication / tunnelling with SSH.
 - BER / ASN.1 based communication protocol.
 - TCP connection, but optimized for realtime latency.
 - Extensible communication protocol implementation.

Example (lsusb to dump USB devices on server):
Server: ./usbexportd
Client (no auth): ./usbnet -h server:22222 -l libusbnet.so "lsusb"
Client (SSH auth): ./usbnet -a user@server -l libusbnet.so "lsusb"

GitHub (with source packages): http://github.com/vavrusa/libusbnet
Git repository: git://github.com/vavrusa/libusbnet.git

Library was designed for as easily extensible to other libraries,
there's just need to implement the actual function transports.
It is still in early development, but it reached usable state and all
libusb functions are already implemented.
The library is also designed with security in mind, so the best
approach is to let server bind to localhost only,
and use SSH public-key authentication method. This employs standard
system-wide security policies well known to
administrators.

So if you have thoughts or are brave enough to try it, please let me
know. I'll be glad for any feedback or bugreports.

Cheers,
Marek Vavrusa

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New project: libusb over TCP/IP

Marek Vavruša
On Tue, Feb 16, 2010 at 11:52 PM, Jim Paris <[hidden email]> wrote:

> Marek Vavruša wrote:
>> Hi folks,
>>
>> for anyone interested - I have started a library, which is able to
>> interact with USB subsystem over TCP/IP.
> ...
>> So if you have thoughts or are brave enough to try it, please let me
>> know. I'll be glad for any feedback or bugreports.
>
> Interesting... I don't have an immediate use for this, but I've come
> across cases in the past where it would have been useful so I'll be
> sure to keep it in mind.
>
> I was glancing through the source to see how endian issues were
> handled, and it seems like they're not -- everything looks fine if
> they're the same, but it looks like it wouldn't work with a
> little-endian server and a big-endian client.  Is that correct?

Correct. I'm in phase of bugfixing and creating usable documentation,
so I'm going to implement htons conversions as soon as I can.
Thanks for pointing this out!

>
> I also noticed the error below; 16-bit values would be truncated to
> 8-bit (although I guess this isn't used by the current code):

Thanks for the patch, applied! I must have been really sleepy at a time :-)

>
> -jim
>
> diff --git a/src/proto/protocol.cpp b/src/proto/protocol.cpp
> index e0ade66..c44450b 100644
> --- a/src/proto/protocol.cpp
> +++ b/src/proto/protocol.cpp
> @@ -67,7 +67,8 @@ Block& Block::addNumeric(uint8_t type, uint8_t len, uint32_t val)
>    pushPacked(len);
>
>    // Cast to ensure correct data on both Big and Little-Endian hosts
> -   uint8_t val8 = val, val16 = val;
> +   uint8_t val8 = val;
> +   uint16_t val16 = val;
>    if(len == sizeof(uint32_t)) append((const char*) &val,   sizeof(uint32_t));
>    if(len == sizeof(uint16_t)) append((const char*) &val16, sizeof(uint16_t));
>    if(len == sizeof(uint8_t))  append((const char*) &val8,  sizeof(uint8_t));
>
>

Just a  out of interest, interrupt transfers are another untested part
of the code. Anyone capable of testing it or could point me to a
device using it?

Thanks,
Marek Vavrusa

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]

Loading...