meta-netmodule-bsp/recipes-bsp/v2x-ieee802.11p/files/v2x-fw-load

37 lines
812 B
Bash

#!/bin/sh
HUB_RST=/sys/class/leds/hub_rst/brightness
V2X_RST=/sys/class/leds/v2x_rst/brightness
if [ ! -f $HUB_RST ]; then
echo Reset lines not available
return 1
fi
echo 0 > $HUB_RST
echo 0 > $V2X_RST
timeout 30 bash -c -- 'while true; do lsusb | grep "0483:df11"; if [ $? == 0 ]; then break; fi; done'
if [ $? == 124 ]; then
echo "v2x module is not available on usb bus"
exit 0
fi
output=$(dfu-util -d 0483:df11 -s 0x10000000 -D /lib/firmware/v2x/SECTON.packed_bin.rom 2>&1)
err=$?
if [ $err != 0 ]; then
echo "Something went wrong while uploading firmware"
if echo "$output" | grep -i "Error during abort get_status"; then
echo "get_status error: ignoring"
exit 0
else
echo "Unexpected error"
echo "$output"
exit 1
fi
fi
exit 0