[Spice-devel] WIP: usbredir rust bindings
Victor Toso
victortoso at redhat.com
Wed Aug 4 12:45:16 UTC 2021
Hi,
On Tue, Aug 03, 2021 at 02:46:51PM +0400, Marc-André Lureau wrote:
> Hi
>
> Just to let you know that I started a usbredir binding to Rust:
> https://gitlab.freedesktop.org/elmarco/usbredir-rs
>
> Atm, it compiles with a custom rusb. I have some MR there (
> https://github.com/a1ien/rusb/pull/97 &
> https://github.com/a1ien/rusb/pull/101)
>
> See the example:
> https://gitlab.freedesktop.org/elmarco/usbredir-rs/-/blob/main/usbredirhost/examples/usbredir.rs
Awesome work!
I'm actually in favor of moving usbredir codebase to Rust in the
future as it is not that big ~ 6k lines of code (usbredirhost and
usbredirparser).
> Atm, I pass an open fd with bash for testing, ex:
> exec 3<>/dev/tcp/localhost/7777
> target/debug/examples/usbredir '1050:0407' --fd 3
>
> Next, it could be extended this with [--tcp host:port], [--unix path],
> [-l|--listen]. Then I suppose it will be close to
> https://gitlab.freedesktop.org/spice/usbredir/-/blob/master/tools/usbredirect.c
>
> (Note that the Rust code doesn't use poll(), since it isn't portable. See
> https://libusb.sourceforge.io/api-1.0/group__libusb__poll.html#libusb_pollmain.
> The libusb/usbredir APIs don't make it easy to handle events..)
Yes and I think it is fine.
Cheers,
Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20210804/9aa3808b/attachment.sig>
More information about the Spice-devel
mailing list