usbredirect doesn't know how to handle multiple identical USB devices
Thanks for creating usbredirect
! I would like to use it in my environment, but it fails when I try to connect more than one of the same USB device. In my situation I have a server with two PL2303 USB/Serial adapters. I need to present both of those devices to the same Virtual Machine -- the virtctl usbredir ...
command leans on usbredirct
to do the actual work.
I can redirect one of the devices just fine, but when I attempt to redirect the second device I get a seg fault. Is this an issue, or am I doing it wrong? Is there a way that I can generate more logs about this? Is there a way to tell usbredirect
to use a specific bus+device instead of vendor:product?
Thanks!
# list the USB devices
[root@node1 ~]# lsusb | grep -e PL2303
Bus 005 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P #serial adapter #1
Bus 005 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P #serial adapter #2
# redirect the first device
[root@node1 ~]# virtctl usbredir 067b:2303 my-virtual-machine
{"component":"","level":"info","msg":"port_arg: 'localhost:44981'","pos":"usbredir.go:157","timestamp":"2022-12-16T16:54:32.278783Z"}
{"component":"","level":"info","msg":"args: '[--device 067b:2303 --to localhost:44981]'","pos":"usbredir.go:158","timestamp":"2022-12-16T16:54:32.278867Z"}
{"component":"","level":"info","msg":"Executing commandline: 'usbredirect [--device 067b:2303 --to localhost:44981]'","pos":"usbredir.go:159","timestamp":"2022-12-16T16:54:32.278895Z"}
{"component":"","level":"info","msg":"Connected to usbredirect at 291.145066ms","pos":"usbredir.go:126","timestamp":"2022-12-16T16:54:32.569896Z"}
# move the process into the background
^Z
[1]+ Stopped virtctl usbredir 067b:2303 my-virtual-machine
[root@node1 ~]# bg
[1]+ virtctl usbredir 067b:2303 my-virtual-machine &
[root@node1 ~]#
# segfault trying to redirect the second device
[root@node1 ~]# virtctl usbredir 067b:2303 my-virtual-machine
{"component":"","level":"info","msg":"port_arg: 'localhost:36181'","pos":"usbredir.go:157","timestamp":"2022-12-16T16:54:48.188632Z"}
{"component":"","level":"info","msg":"args: '[--device 067b:2303 --to localhost:36181]'","pos":"usbredir.go:158","timestamp":"2022-12-16T16:54:48.189435Z"}
{"component":"","level":"info","msg":"Executing commandline: 'usbredirect [--device 067b:2303 --to localhost:36181]'","pos":"usbredir.go:159","timestamp":"2022-12-16T16:54:48.189481Z"}
{"component":"","level":"error","msg":"Failed to execut usbredirect due signal: segmentation fault (core dumped), output: \n(usbredirect:89): usbredirect-WARNING **: 16:54:48.504: Error starting usbredirhost\n","pos":"usbredir.go:164","timestamp":"2022-12-16T16:54:51.294214Z"}
Error encountered: signal: segmentation fault (core dumped)