Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | daniel-mar | 1 | #!/usr/bin/php |
2 | <?php |
||
3 | |||
4 | // Der folgende Code resetted das USB-Gerät, da sonst bei einem Neustart von Motion der Fehler "Cannot open video device" kommen kann |
||
5 | // https://gist.github.com/x2q/5124616 |
||
6 | // https://www.raspberrypi.org/forums/viewtopic.php?t=86265https://www.raspberrypi.org/forums/viewtopic.php?t=86265 |
||
7 | $out = array(); |
||
8 | exec("lsusb", $out, $ec); |
||
9 | $cont = implode("\n", $out); |
||
10 | if (preg_match("@Bus (.{3}) Device (.{3}): ID (.{4}):(.{4}) Logitech, Inc. Webcam C270@ismU", $cont, $m)) { |
||
11 | system(escapeshellcmd(__DIR__.'/usbreset').' '.escapeshellarg("/dev/bus/usb/".$m[1]."/".$m[2])); |
||
12 | } |
||
13 | |||
6 | daniel-mar | 14 | sleep(10); |
15 | |||
3 | daniel-mar | 16 | system("service motion start"); |
17 |