-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usbipd lists not all available devices #193
Comments
@dhutter Essentially, the algorithm is as follows: enumerate all USB hubs, enumerate all their children, exclude the hubs themselves, retrieve a bunch of properties for each device -> list. Any of these stages could be at fault:
|
Meanwhile, I cloned the Git-repro and installed VC2022, so I'm ready to go. However, regarding the DVB-card, the recorded stream has a lot of dropouts (especially in HD-TV). Looking at the logs (dmesg), I got dozens of error messages like: [10106.442542] vhci_hcd: unlink->seqnum 772023 Are these messages caused by an overload of usbip? A typical HD-stream produces about 7 GByte per hour. Is it just too much data squeezed through the IP channel? |
@dhutter For bulk endpoints I've reached 100+ MiB/s on a USB 3 flash drive, so bandwidth is fine. But timing/latency may be a problem for high rate isochronous endpoints. I never did more than bluetooth audio, which is a much lower rate than HD video. Is the device using isochronous endpoints? You can check with usbview.exe, part of Windows SDK. |
it does. Bus speed is high but not SuperSpeed. It has several endpoints with isochronous transfer type . The highest has 3 transactions per microframe with about 1KBytes max. I've attached the output of usbview in case you are interested in some details. |
@dhutter
|
I think I located the source of trouble concerning the recognition of the USB device: Concerning the latency problems of the isochronous endpoints, increasing the priority of the usbipd process shows no significant improvements. Looking at the recorded MPEG2-TS stream, only about one of 50 TS-packets has been dropped (but that's still enough to pixelize each fame). I'm wondering if these packets have been dropped because they arrived out of their designated time slots (for instance, because they are delayed due to some additional concurrent IP-traffic between the host and the VM). Usually, a sufficiently large buffer on the receiver side buffering the packets from the host and forwarding them in regular time slices downstream may help. Is there any option to increase such buffers? |
@dhutter
I could tweak the send buffer in |
the registry does not contain attributes "UpperFilters" or "LowerFilters"; neither for the given class nor for its subclasses of the individual USB devices. The drivers for the front and rear hubs differ. Both are standard Microsoft drivers: the rear hub usbhub3.sys in version 10.1.19041 1202 (from 8/2021) and the front hub usbhub.sys in version 10.1.19041 1 (from 6/2006). I've read a very interesting but also rather old (2006) paper from Hirofuchi et al. on "USB/IP - a Peripheral Bus Extension for Device Sharing over IP Network". If I understand it correctly, they discuss (in Sec. 4.1.2) in particular how the URB queuing depth (number of URBs that are encoded in a single IP packet) has to match the likely delays introduced by the IP network. This decision is done by the host. However, I'm not sure how far their protocol of USP/IP matches actual specs. |
@dhutter |
|
@dhutter |
Congrats! From my subjective impression, I would say that also the jitter has decreased although HD streams are only stable for about 50 secs then the picture gets pixelized, recovers after some seconds, and then gets pixelized again. Looks like not all TS-packets make it in time. But anyway, this is a different issue. |
@dhutter |
dmesg shows a regular sequence of "unlink seqnum.." and a following "urb already given back" message. The occurring seqnums increase typically by 4 till 8. |
@dhutter For example, when I test with bluetooth audio (i.e. a USB bluetooth dongle via
And after that, everything is fine. But I don't know how DVB capture feels about underruns/latency/timeout. Maybe it just cancels the current stream (UNLINK) and then starts again. Pulseaudio at least recognizes the latency/jitter and simply increases its buffer windows, after which everything is fine. |
the UNLINK messages occur regularly during streaming (see attached file) . In DVB it's a bit more complex as there are always multiple, interleaved MPEG transport streams. Each of these streams is a sequence of packets. A packet has 188 bytes and contains a sequence byte that indicates its relative position in the sequence. The USB-device streams this bunch of streams (corresponding to multiple channels and different types (Audio/Video/Subtext/EPG...)) downstream to some software. The timing (e.g. synchronizing A/V) is only done at the very end inside the renderer. |
just for curiosity: the dropouts are always one (!) single byte. The first byte is lost after 64 MByte of recording and then the next bytes are lost constantly every 21 MByte later (it fluctuates between 21 and 21.07 MBytes). (However, these absolute numbers refer only to the particular channel I recorded (there is another channel streamed on the same frequency and thus also delivered by the DVB-device) |
That's very interesting (and suspect!) indeed. As we all know, there are only 2 types of bugs: null-pointer-dereferences, index-out-of-bounds, and off-by-one-errors. This smells like the latter... |
Tshark is fine but what is the name for the usbip interface? usbmon1 does not exist in WSL. |
Ah. I guess that isn't enabled in the WSL kernel. I use hyper-v, with a full Ubuntu kernel. There I can just modprobe usbmon. If you want it in WSL you will have to compile your own kernel. |
ok, compiling the kernel is not a problem (did it before to include all the dvb-usb modules and required firmware). udev is not available/configured in WSL |
(Win 10 pro, 21H2; usbipd v. 1.30)
First, thanks for this nice piece of code !
I have experienced the problem with "usbipd wsl list" that dependig on the port the usb device is plugged in, the usbipd command lists the device or not. In contrast, the powershell command "Get-PnpDevice -PresentOnly" lists it independent of the port used.
The device is a dvb-2 USB-card (TT s2-4600). Its original Windows driver has not been ported to Win10 but causes an instant bluescreen now. Therefore, I deinstalled the entire driver and the device is no longer operational in Win 10.
Get-PnpDevice returns (regardless of the chosen USB-port) the output "Error dvb-s2 USB\VID_0B48..."
Now, the idea is to use the Linux-driver integrated in Ubuntu to use the device. If I plug the card into the front plug (USB-2), usbipd correctly lists the device:
BUSID DEVICE STATE
3-1 dvb-s2 Not attached
7-3 USB-Eingabegerät Not attached
7-4 Microsoft-Hardware - USB-Maus Not attached
and I can attach it to WSL2, record successfully any TV-broadcasting (using vdr) and store the recording back in the windows filesystem. However, once I use the rear plugs (USB-3) and execute "usbipd wsl list", the device is lost (although Windows knows about it as said before).
Any idea what is going on?
The text was updated successfully, but these errors were encountered: