Linux: Recovering camera after suspend on Lenovo U310

(First post on 4 years!)

I’ve been always very happy about my laptop and the Linux compatibility, but some time ago after an upgrade, camera stopped working after suspend. Googling a little I’ve found this solution that worked for me. I have to reset the USB driver every time I resume my laptop. So I created the file /etc/pm/sleep.d/99-resetcam  with the following content:

#!/bin/bash

cd /sys/bus/pci/drivers/xhci_hcd

case $1 in
resume|thaw)
echo 0000\:00\:14.0 > unbind
echo 0000\:00\:14.0 > bind
;;
esac

and that’s all, my camera works again after suspend.

Post to Twitter