System designTroubleshooting

USB camera visible but won't open after a crash: reset it remotely

USB camera enumerates but won't open after a crash? Cut the hub port's power, unbind and rebind the xHCI controller, or bounce the host's mains, in that order.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01Why the camera is visible but will not open
  2. 02Two-minute checks before any reset
  3. 03Fix 1: cut the camera port's power from the shell
  4. 04Fix 2: unbind and rebind the host controller
  5. 05Fix 3: cut the host's mains with a managed outlet
  6. 06When firmware is the missing piece
  7. 07Worked example: recovery budget for a cell 6 h from the nearest hands
  8. 08Build the cell so the next crash costs two minutes
  9. 09Recovery runbook
  10. 10Questions

A USB3 camera that still enumerates but refuses to open after the host crashed is one of the most expensive failures in an unmanned cell: the cure is a five-second power cut, and the nearest hands are hours away. Here are the three remote recoveries, in the order to try them — hub port power cut, host-controller unbind and rebind, managed mains bounce — what each one actually clears, and the wiring change that turns the next crash into a two-minute fix over SSH. The commands are Linux; the Windows equivalent is noted where it differs.

Why the camera is visible but will not open

After the crash, lsusb still lists the camera and the vendor viewer shows it in its device tree. The open call then hangs and dies on a timeout — the reported case prints -12 from the vendor API. Enumeration succeeded, open failed, and no reboot fixed it.

The reason is power. USB bus power (VBUS, 5 V) comes from the host board or the controller card, and on most boards and PCIe cards it stays energized across a warm restart: the OS goes down and comes back, but the camera never loses power and its firmware keeps the configured session from the dead host. The fresh OS can still read descriptors at the port, which is why the camera appears in enumeration. The open request, though, asks the camera firmware to accept a new session — and a camera that believes the old session is still live does not answer in time. A warm reboot resets software, not the camera, so it cannot clear this state. A real cut of VBUS can.

Two neighbors look similar and have their own fixes. A camera held open by a dead process is a stale lock, not a dead session: see recovering a camera stuck in use after a crash. A camera missing from enumeration entirely is a link or supply problem: see the USB checks for a camera with power but not detected.

Two-minute checks before any reset

  1. Present? Run lsusb. Camera listed: this guide applies. Not listed: use the not-detected checks above instead.
  2. Speed? Run lsusb -t and read the camera's line. 5000M is a healthy SuperSpeed link; 480M means it fell back to High Speed and the problem is link quality, not stale state — that path is covered in fixing a camera that enumerates as USB 2.0 on a USB 3.0 port.
  3. Owner? lspci | grep -i xhci lists the USB host controllers; lsusb -t maps each bus to its controller. Note which controller the cameras hang on and which one carries your keyboard, serial adapters or USB Ethernet — that decides the blast radius of the next step.
  4. Error? Try the open once and record the exact text. A timeout at open points at stale session state; a failure while setting parameters points elsewhere.
  5. Sharers? Count the other devices on that controller. They all re-enumerate when it resets — count on roughly 5-10 s of downtime for each of them.

Fix 1: cut the camera port's power from the shell

If the camera hangs off a powered hub that switches ports individually, this is the cleanest remote fix: dropping VBUS resets the camera exactly like an unplug, clearing both the port state and the camera's held session in one move.

The open-source command-line tool uhubctl lists every hub, port and power state it can see, and switches the ports whose hub descriptor says they are individually switchable. Switch the camera's port off, wait five seconds for the supply capacitors to discharge, switch it back on, and give the camera 2-3 s to re-enumerate. The test that proves the reset: the camera must disappear from lsusb while the port is off and reappear after.

Not every hub qualifies. Some switch their ports only as a group, some cannot cut port power at all, and charging-oriented ports hold power by design. Prove it on the bench before deployment: switch each camera port off once and watch lsusb. A hub that cannot drop the camera cannot do this job — fall through to fix 2. For other ways to cut camera power remotely (a relay on the supply line, a smart plug on the camera's adapter), see power cycle a USB camera remotely: three ways that work.

Fix 2: unbind and rebind the host controller

When the camera sits on a root port you cannot switch, reset the controller instead. The kernel's driver unbind/rebind interface detaches the xHCI driver from the controller and reattaches it, which resets the controller and re-enumerates everything below it. Publicly reported wedged-controller cases on Linux describe unbind and rebind recovering the controller every time it was tried.

lspci | grep -i xhci                          # find the controller, e.g. 0000:04:00.0 (illustrative)
echo 0000:04:00.0 | sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind
sleep 5
echo 0000:04:00.0 | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind
lsusb                                         # camera re-enumerates within seconds

The PCI address above is illustrative — substitute the one lspci printed for your card. xhci_hcd is the kernel's standard xHCI driver name.

Scope of the fix: unbind/rebind clears host-side controller state. Port power (VBUS) generally stays up through it, so a camera holding a stale session can still refuse the open. If the timeout survives a controller reset, the state is in the camera — go to fix 1 or fix 3. On Windows, the same reset is disabling and re-enabling the controller in Device Manager.

Fix 3: cut the host's mains with a managed outlet

A network-controlled outlet on the host's supply — a switched PDU or a smart plug — is the software-free fallback, and the only fix that works when the host crashed so hard it accepts no SSH connection at all. Cut mains for 10-30 s, long enough for the power supply and boards to discharge, and let the host cold-boot. VBUS falls with the mains, so the camera resets with everything else.

The cost is a full host boot: tens of seconds to a few minutes depending on the OS and its start-up services, plus a restart of the acquisition software. That still beats a six-hour drive. Where the cell already has a managed outlet for other reasons, try this before touching controllers.

When firmware is the missing piece

If one camera wedges this way repeatedly while its neighbors shrug it off, take it up with the vendor. Makers track this failure: one vendor credited a newer firmware release with improving recovery from exactly this state, and in an earlier case an older firmware was the workaround. In both cases the image came from the vendor's own support pages — firmware is matched to camera serials, and a wrong image can finish the camera off. Keep the loaded version and its release notes in the commissioning file.

One distinction worth keeping: if the camera opens after recovery but the stream stalls mid-run with response timeouts, that is a runtime transfer problem, not stale session state — see the USB3 Vision response-timeout fix.

Worked example: recovery budget for a cell 6 h from the nearest hands

Inputs. Three cameras in one cell: two on a four-port USB controller card, one on a motherboard port — the layout of the reported case. The nearest technician is a 6 h drive away. Hands-on time for an unplug-and-replug visit is about 5 min once someone is on site. A controller unbind/rebind over SSH, including the reopen test, is about 2 min of command time. A port power cut adds a 5 s dwell.

Rule. Per-event downtime is travel plus hands-on time for any physical fix, and command time for any remote fix. A reset's blast radius is the set of devices hanging on the controller you touch.

Arithmetic. Physical replug: 6 h × 60 min/h + 5 min = 365 min per event. Remote reset: about 2 min. Saving per event: 365 − 2 = 363 min ≈ 6.05 h, and the remote path is 365 / 2 ≈ 183× faster. Blast radius: resetting the card drops 2 of the 3 cameras for about 5 s of re-enumeration — roughly two-thirds of the vision stream, briefly — while resetting the motherboard controller takes the third camera plus the console keyboard. Reset the card, never the board controller.

Decision. A warm reboot had zero successes in the reported case, so it is not a recovery step at all. Unbind/rebind cleared the wedged-controller case every time in the reports; if the open timeout survives it, the state sits in the camera and the cure is a VBUS cut (fix 1) or a mains bounce (fix 3). The threshold that drives the build: any recovery you cannot run over the network costs 365 min in this cell, so port switching or a dedicated camera controller goes in on day one.

Build the cell so the next crash costs two minutes

Recovery capability is a wiring decision, not a heroic one. Three changes, in rising order of effort:

A powered hub with per-port switching. Prove on the bench that each camera port really cuts power, then mount the hub where the cables reach. Fix 1 works from then on, for every camera behind it.

A controller card the cameras keep to themselves. Camera-side controller cards live under frame grabbers in the shop. Give the cameras their own PCIe controller — for example the MV-GU2204 quad USB3.0 adaptor — and a wedged camera controller becomes one card you reset over SSH while the console controller keeps your session alive.

Frame grabbersHikrobot MV-GU2204 MV-GU2200 Series Quad USB3.0 AdaptorMV-GU2204
Interface
USB3
Ports
4 ports
$469.00View partBuild a system with it

Cabling that does not wander. Link drops and speed fallbacks track long, stiff, unshielded leads. On a moving axis run a short high-flex lead such as the 3 m USB3 camera cable LS-CBL-0219, keep passive extensions out of the run, and pick spares from the camera data cables range.

Cables3 m USB3.0 camera cable, high-flex (drag chain) (LS-CBL-0219)LS-CBL-0219$62.00View partBuild a system with it

For rarely attended sites, PoE GigE. A PoE camera power-cycles when you bounce its switch port, whatever its internal state — recovery that works even when USB will not. The MV-GE2002P dual-port PoE NIC feeds two GigE cameras data and power over one cable each, and a 2.5 MP GigE camera such as the MV-CU020-90GC then resets from the switch room, not the host. The wiring side is covered in the PoE checks for a camera with link but no power.

Frame grabbersHikrobot MV-GE2002P Dual-port PoE NIC, full height V2.0MV-GE2002P
Interface
GigE
Ports
2 ports
$249.00View part
Area scan camerasHikrobot MV-CU020-90GC 2.5 MP Area Scan Camera, GigE, GMAX4002, ColorMV-CU020-90GC
Sensor format
1/1.7"
Lens mount
C-mount
$309.00View part

For the host itself, mount a compact machine next to the cameras and put it on a managed outlet — the industrial mini PCs class of hosts suits cabinet cells, and the outlet does the recovery no software can refuse. When you specify the chain, the camera finder filters by interface and resolution, area scan cameras is the category to browse, and configure a camera system walks the whole build. If a recovery still defeats you, contact us with the exact error text and your controller layout.

Recovery runbook

Leave this with the cell:

  1. lsusb — camera present? Absent: use the not-detected checks, not this runbook.
  2. lsusb -t — 5000M link? 480M: fix the speed fallback first.
  3. Try the open and record the exact error text.
  4. Unbind/rebind the camera's controller (the card, never the console controller), wait 5 s, reopen.
  5. Still timing out: cut the camera's hub port power for 5 s with uhubctl, reopen.
  6. No switchable port: managed outlet, mains off 10-30 s, cold boot, reopen.
  7. Still failing after a full power cut: stop resetting, pull the firmware version and release notes, and raise it with the vendor before the next visit.

Steps 4 and 5 are seconds long. The other five exist only for cells built without them — the systems topic page collects the rest of the link-level fixes.

Questions

Why doesn't rebooting reset the camera?

The 5 V bus power (VBUS) feeding the camera stays on across a warm restart on most boards and controller cards, so the camera never loses power and keeps its configured session from the dead host. Watch lsusb during a reboot: if the camera never disappears, VBUS stayed up and the stale state survives into the fresh OS. Only a VBUS drop or a controller reset clears it.

How do I know whether a hub supports per-port power switching?

Hubs declare their switching mode — individual, ganged or none — in the hub descriptor, and tools such as uhubctl read that descriptor and list what each port supports. The test that matters is on the bench: switch the camera's port off for 5 s and watch lsusb. If the camera disappears and comes back, that port gives you a true remote power cycle.

Is unbinding the xHCI driver safe to do remotely?

Safe when nothing you depend on shares that controller. Every device on it re-enumerates within a few seconds (typically under 10 s) of the rebind. Check lsusb -t first: reset the expansion card the cameras hang on, never the controller that carries your SSH link, console keyboard or a USB serial console. If your own session rides the same controller, you lock yourself out.

How long should the power stay off?

Five seconds off is enough for a hub port: the supply capacitors discharge and the camera firmware reboots. For a managed outlet cutting the host's mains, use 10-30 s so the power supply and boards fully discharge and the restart is a true cold boot. Then give the OS 60-180 s to come back before reopening the camera.

When is moving to GigE with PoE the better fix?

When nobody is nearby and USB recovery cannot be guaranteed. A PoE GigE camera power-cycles from the switch port, which works whatever the camera's internal state is, and Ethernet crosses a plant on switches where passive USB 3 stays around 3 m. The trade is a GigE camera plus a PoE switch instead of reusing the USB hardware you already own.