====== USB Watchdog ====== Tags: ''Adapter Auto Restarter USB WatchDog do koparki BTC'' {{:hw:usb_watchdog_restarter_top.jpg?direct&200|}} {{:hw:usb_watchdog_restarter_bottom.jpg?direct&200|}} ===== Communication protocol ===== [238947.892900] usb 1-3.4: Product: USB2.0-Serial [238947.899333] ch341 1-3.4:1.0: ch341-uart converter detected [238947.906552] usb 1-3.4: ch341-uart converter now attached to ttyUSB0 Serial port parameters: 9600 8N1 stty -F /dev/ttyUSB0 raw speed 9600 Each command is 1 byte value. It set watchdog threshold in deciseconds. Example commands: Commands sent to watchdog (1 byte): * ''1'' - next expected kick in 10 seconds. echo -ne "\x01" > /dev/ttyUSB0 * ''36'' - next expected kick in 360 seconds. echo -ne "\x01" > /dev/ttyUSB0 * ''128'' - status query. It responds with ''0x81'' echo -ne "\x80" > /dev/ttyUSB0 * ''255'' - forced reset. echo -ne "\xFF" > /dev/ttyUSB0 REMARK: Avoid low threshold. It is stored internally in watchdog, so after reset it is still low. In this case it is not possible to boot OS. Default (after powerup) watchdog window is 170 sec (measured). ===== Daemon ===== [[https://github.com/niziak/usb-watchdog]]