Welcome, Guest

Author Topic: issue with usb_serial.sh in official image  (Read 1344 times)

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
issue with usb_serial.sh in official image
« on: January 18, 2017, 11:42:28 PM »
Following the instructions for building the image, you're writing out `usb_serial.sh` using a heredoc, however the contents containing shell vars are being interpreted in the host shell instead of being written out to the script.  Thus the resulting script looks like this:

Code: [Select]
# Set strings
mkdir strings/0x409
echo  > strings/0x409/serialnumber
echo  > strings/0x409/manufacturer
echo  > strings/0x409/product

# Create configuration
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "120" > configs/c.1/MaxPower
echo  > configs/c.1/strings/0x409/configuration

# Creating functions
mkdir functions/acm.usb0

# Associate function with comfiguration
ln -s functions/acm.usb0 configs/c.1

# Enable UDC
echo  > UDC


Note all the `echo` lines that should be echoing a value from a variable are just echoing an empty string.  Should want to fix this in the next release of the official image. 
« Last Edit: April 18, 2017, 08:45:03 PM by thom_nic »

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: issue with usb_serial.sh in official image
« Reply #1 on: February 03, 2017, 10:58:01 PM »
I realized the issue is the first line:

Code: [Select]
cat << __EOF__ > /usr/bin/usb_serial.sh

The heredoc delimiter must be quoted to disable immediate evaluation of the contents, like so:

Code: [Select]
cat <<"__EOF__" > /usr/bin/usb_serial.sh
« Last Edit: April 18, 2017, 08:44:18 PM by thom_nic »

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: issue with usb_serial.sh in official image
« Reply #2 on: February 03, 2017, 11:38:43 PM »
Also the very first line reads

Code: [Select]
#/bin/sh
instead of

Code: [Select]
#!/bin/sh
« Last Edit: April 18, 2017, 08:44:11 PM by thom_nic »