summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2017-06-07 14:00:39 -0700
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2017-06-09 17:06:15 +0200
commit75f40c695f400f22e3de4aa8497251d44852b1fe (patch)
tree2df09a74dfd65ec6f43d3f57106c4f35fa9b99cc
parentb9d3432e0fa30ae24c2ffd1eb2e769aabac9f91f (diff)
libusbgx: fix usb product id calculation
The Toradex product ID from the config block is decimal coded ASCII with leading zeros. In C and bash, leading zeros means octal number... This leads to wrong calculation of the USB product ID and to errors if the product ID contains the number 8 or 9 (since those are not valid under the octal numeric system). Fix both issues by explicitly force decimal system for the Toradex product ID. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--recipes-support/libusbgx/files/usbg.service2
1 files changed, 1 insertions, 1 deletions
diff --git a/recipes-support/libusbgx/files/usbg.service b/recipes-support/libusbgx/files/usbg.service
index a4e6f80..3955e38 100644
--- a/recipes-support/libusbgx/files/usbg.service
+++ b/recipes-support/libusbgx/files/usbg.service
@@ -6,7 +6,7 @@ Before=systemd-networkd.service
[Service]
Type=oneshot
ExecStart=/usr/bin/gadget-import g1 /etc/usbg/g1.schema
-ExecStartPost=/bin/sh -c '/bin/echo $((0x4000+$(cat /proc/device-tree/toradex,product-id))) > \
+ExecStartPost=/bin/sh -c '/bin/echo $((0x4000+10#$(cat /proc/device-tree/toradex,product-id))) > \
/sys/kernel/config/usb_gadget/g1/idProduct'
ExecStartPost=/bin/sh -c '/bin/cat /proc/device-tree/serial-number > \
/sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber'