Skip to content

Commit

Permalink
Use hashed machine-id instead of CPU serial
Browse files Browse the repository at this point in the history
Not all devices list a serial number in /proc/cpuinfo, so use a
hash of the machine id instead.
  • Loading branch information
marcone committed Nov 24, 2024
1 parent 7282541 commit 2493d20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion run/enable_gadget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ echo 0x0100 > "$gadget_root/bcdDevice" # v1.0.0
echo 0x0200 > "$gadget_root/bcdUSB" # USB 2.0
mkdir -p "$gadget_root/strings/$lang"
mkdir -p "$gadget_root/configs/$cfg.1/strings/$lang"
echo "TeslaUSB-$(grep Serial /proc/cpuinfo | awk '{print $3}')" > "$gadget_root/strings/$lang/serialnumber"
echo "TeslaUSB-$(sha256sum < /etc/machine-id | awk '{print $1}')" > "$gadget_root/strings/$lang/serialnumber"
echo TeslaUSB > "$gadget_root/strings/$lang/manufacturer"
echo "TeslaUSB Composite Gadget" > "$gadget_root/strings/$lang/product"
echo "TeslaUSB Config" > "$gadget_root/configs/$cfg.1/strings/$lang/configuration"
Expand Down

0 comments on commit 2493d20

Please sign in to comment.