When one's scientific equipment is another's BadUSB



  • As an experimental laboratory, every now and then we buy all kinds of exotic equipment, join it together using curses and electrical tape and then use our computers to make it do our bidding. Increasingly, there's a tendency to switch away from strange custom cables to be wired to a serial port (well, a USB-serial adapter, anyway) to more modern interfaces, like USB (except those are still mostly virtual serial ports), although some devices take pride in their poliglotism and have not only USB and RS-232, but also an Ethernet interface.

    Now, we all know that USB is a cursed protocol. People who doubt that are welcome to follow the links from the Wikipedia page on USB-CDC and find themselves in a maze of twistly little PDF documents, each describing some small aspect of the overall picture of USB Communication Devices and referencing all other documents (and their errata). I followed them once when I was curious about implementing a virtual serial port with V-USB on an ATTiny85 I had handy. I don't want to follow them again.

    Still, it all mostly works, so we didn't suspect much in the way of problems when we plugged in our new USB3 Vision camera and ran the vendor software to play with it.

    Then the video stream froze. We thought it was a minor glitch and restarted the stream. It worked for a while, but then froze again. After some prodding, we decided to reconnect the camera. That was when we discovered that (1) USB hot-plug no longer works until reboot and that (2) the computer gets stuck shutting down before rebooting and needs a hard reset. Every time.

    Well, perhaps it's a bad computer, or some driver incompatibility Windows update bullshit, surely it would work on a different one? It seemed to work for a minute or so. Then the camera stopped responding. Then the rest of the computer stopped responding. At all. Not even the CapsLock LED; the kernel was completely stuck.

    You might be saying, perhaps it's a driver problem. USB3 Vision is a known standard. Just ditch the buggy vendor's kernel drivers and run a userspace implementation. Worst case scenario? It crashes, you restart it. Computer keeps working. CapsLock uptime up to five nines.

    After another reboot, we found the driver in %windir%\System32\drivers, renamed it and only then plugged in the camera. The device manager told us there was a problem because a driver could not be loaded. The system seemed stable, but then we checked whether USB hot-plug still worked; it didn't.

    The next camera we buy? It's gonna have a gigabit Ethernet interface. I'm sure they'll screw it up too, but it'll probably be less spectacular.


  • Fake News

    @aitap Is it USB powered? Sounds almost like the device pulls so much current that the USB host controller for the used port simply packs its stuff and goes home for the day.



  • Can confirm. USB 3 vision just sucks that bad. The api is "standardized" insofar as objects and functions have similar names across vendors. The best U3v cameras I've found yet only require power cycling a few times a day.


  • Banned

    One would think webcam would be a solved problem by now.



  • @JBert Thanks for reminding me! There's an external power supply. We ran some tests with it and observed no difference.



  • @Gąska said in When one's scientific equipment is another's BadUSB:

    One would think webcam would be a solved problem by now.

    From the Wikipedia page, this is a standard for industrial cameras — which of course are entirely different from webcams. One of the two takes in light, turns it into a digital picture and transmits it to a computer. The other … um … takes in light, turns it into a digital picture and transmits it to a computer?



  • USB video cameras - or rather video cameras with some usb video grabber - are a night mare. We also often detect that suddenly the device can no more be found in the device manager. Electric power off, then on again, works often. Not always. Sometimes, the drivers need to be re-installed. Sometimes with several reboots / electric power off on cycles etc.
    :wtf:



  • @Gurth https://www.phase1vision.com/blog/the-benefits-of-usb-3-0-vision-standard-cameras

    Benefits of USB 3.0 Cameras

    Using USB 3.0 interfaces for industrial and medical applications can provide many benefits over alternative interfaces. Mainly, the benefit of USB 3.0 interfaces are their high-bandwidth and simple connectivity.

    Bandwidth can often reach excesses of 350 MB/s. This makes it one of the highest bandwidth vision interfaces, just behind Camera Link. There used to be a huge gap in bandwidth between Camera Link and GigE – USB 3.0 now provides a great alternative in between these interfaces.

    USB 3.0 interfaces facilitate plug and play compatibility. Essentially, they are extremely easy to implement, and most PCs support this type of connectivity, making it potentially viable in a wide range of settings.

    The USB Vision Standard is also a widely respected vision standard in the industry. Most of the time, when you choose a USB 3.0 interface, you know you’re getting a reliable solution.

    There are certainly many other benefits of USB 3.0 cameras for industrial and medical applications, but it’s high bandwidth with simple connectivity are some of the most impactful. Browse USB 3.0 Vision cameras today.

    TL;DR: No reason to not buy a V4L camera that connects over USB 3.0 instead.



  • @BernieTheBernie said in When one's scientific equipment is another's BadUSB:

    USB video cameras - or rather video cameras with some usb video grabber - are a night mare. We also often detect that suddenly the device can no more be found in the device manager. Electric power off, then on again, works often. Not always. Sometimes, the drivers need to be re-installed. Sometimes with several reboots / electric power off on cycles etc.
    :wtf:

    I use an hdmi->usb adapter for my camera, and it's worked every time. I'm a bit surprised that it works as good as it does, since I've had more problems with internal webcams and cameras that can talk usb.



  • @Carnage I'm not so surprised. It converts from a well-known format. No extra features. No camera control (exposure time, zoom, etc..). No shortcuts. Only one job.



  • @acrow said in When one's scientific equipment is another's BadUSB:

    @Carnage I'm not so surprised. It converts from a well-known format. No extra features. No camera control (exposure time, zoom, etc..). No shortcuts. Only one job.

    It's still a usb dongle. They tend to be good at acting up.


  • Notification Spam Recipient

    @Carnage said in When one's scientific equipment is another's BadUSB:

    @acrow said in When one's scientific equipment is another's BadUSB:

    @Carnage I'm not so surprised. It converts from a well-known format. No extra features. No camera control (exposure time, zoom, etc..). No shortcuts. Only one job.

    It's still a usb dongle. They tend to be good at acting up.

    Especially with prolonged use, heated or wet environments, or... normal everyday use.



  • @Circuitsoft said in When one's scientific equipment is another's BadUSB:

    The best U3v cameras I've found yet only require power cycling a few times a day.

    Wow, that's just horrible. Would you mind telling me which brand of cameras is the least bad, in your experience? I only need precise exposure control, a 12-bit ADC and external synchronisation.


  • ♿ (Parody)

    @BernieTheBernie said in When one's scientific equipment is another's BadUSB:

    USB video cameras - or rather video cameras with some usb video grabber - are a night mare. We also often detect that suddenly the device can no more be found in the device manager. Electric power off, then on again, works often. Not always. Sometimes, the drivers need to be re-installed. Sometimes with several reboots / electric power off on cycles etc.
    :wtf:

    Switching back to my work machine using my KVM, I often get popups about Windows installing mouse drivers. :wtf:



  • @BernieTheBernie said in When one's scientific equipment is another's BadUSB:

    USB video cameras - or rather video cameras with some usb video grabber - are a night mare.

    Even just USB3 webcams. Plenty of glitches if you go for a capture mode that actually requires USB3 bandwidth. There are a few different groups of USB 3 connections on my motherboard. If I connect to one specific group, the chip controlling those ports pretty much gives up until a reboot. Other ports mostly work, but it's never been reliably stable.



  • Reminds me of the fun I had with a combination thermal infrared and optical USB camera a few years ago. They went with the most "obvious" way of sending two video streams: Encode the IR images in a proprietary format and add them as columns of extra pixels on the right edge of the visual image then pretend you're a normal camera.

    Their desktop software would untangle that mess and show it on screen. They also had a COM+ API to read the image stream out of the running desktop application, which they demoed by showing live video in Excel for some reason.

    Nice "feature" of that API: It was serviced from the GUI event queue of the desktop app, so when the app pops up a dialog anything connected to the app no longer gets video.

    They later brought out a "network box" that was supposed to offer network access to the video. That turned out to be a SFF PC running windows you could hook up to using remote desktop.



  • @aitap Allied Vision are head-and-shoulders above FLIR. Haven't tried Basler yet, but the fact that a back dust-cover is an accessory sold separately isn't very confidence inspiring...



  • @cvi said in When one's scientific equipment is another's BadUSB:

    If I connect to one specific group, the chip controlling those ports pretty much gives up until a reboot.

    This sounds like you have multiple USB3 controllers on motherboard (and some 3rd party controllers are known to only vaguely implement the USB standard).



  • @ender said in When one's scientific equipment is another's BadUSB:

    some 3rd party controllers are known to only vaguely implement the USB standard

    And the rest don't even try. 🏆



  • @ender Yeah - the ones that malfunctions reliably are on the 3rd party controller.

    Now that I think of it, the two ports on the 3rd party controller are the ones that supposedly support USB 3.1 Gen 2 (the others are Gen 1). The main problem with the controller giving up is that the ethernet port is also connected to it, so when it dies, no more internets for me.



  • @Circuitsoft Oh well. Ours is actually FLIR. There seem to exist some combinations of computer and USB port where it seems to work in a relatively stable fashion, like when we plug the camera in a USB2 port 🏆