Go Down

Topic: Reading Serial Data from USB host (Read 9418 times) previous topic - next topic


The little problem I see while doing mods of the Linux system is that you have to remember all the mods and reapply them when you install a new image.

I made a script to make the changes for me.
So each time I make a mod I try to do the mod by code. If I don't know how -like in the case of inittab- I add something like:
Code: [Select]
#remove the bridge starter
echo remove the line ttyATH0::askfirst:/bin/ash --login from /etc/inittab

I checked there before I answered your question on inittab.  :D
My whole script (including connection to my nas and copying files from there) is below for reference.
Best regards

PS in case you didn't know: You can copy the content of the script in the OS of your choice and paste it in your ssh (I use putty) connected to your factory reset and network configured yun. Make sure you press enter after the paste so the last command gets executed as well.

Code: [Select]
#to mount a cifs drive (linino)
opkg update
opkg install cifsmount
opkg install kmod-fs-cifs

#mount the nas using hard coded IP
mkdir /mnt/nas
mount.cifs /mnt/nas -o user=linksys,pass=DE4Fkhd6dtRz,sec=ntlm

#install bonjour service hack
#opkg install /mnt/nas/latest/packages/nss-mdns_0.10-1_ar71xx.ipk
#doesn't seem to work http://forum.arduino.cc/index.php?topic=202577.0

#for the usb port (linino)
opkg install kmod-usb-acm
opkg install minicom

#pkill tty ...
opkg install procps-pkill
opkg install coreutils-tty
opkg install coreutils-stty

#deactivate the bootloader and use the script to kill com port stuff
mv /usr/bin/merge-sketch-with-bootloader.lua /usr/bin/merge-sketch-with-bootloader.lua.org
echo "#!/bin/ash" >/usr/bin/merge-sketch-with-bootloader.lua.noBootLoader
#echo pkill ParseArduinoInput.sh >>/usr/bin/merge-sketch-with-bootloader.lua.noBootLoader
echo return 0 >>/usr/bin/merge-sketch-with-bootloader.lua.noBootLoader
chmod +x /usr/bin/merge-sketch-with-bootloader.lua.noBootLoader
cp /usr/bin/merge-sketch-with-bootloader.lua.noBootLoader /usr/bin/merge-sketch-with-bootloader.lua

#disable the directory listing via the web browser
uci set uhttpd.main.no_dirlists=1
/etc/init.d/uhttpd restart

#copy the latest version of the code to yun
mkdir -p /www/cgi-bin/jantje
mkdir -p /www/jantje
cp /mnt/nas/latest/dynamic/* /www/cgi-bin/jantje
cp /mnt/nas/latest/static/* /www/jantje

#add /www/cgi-bin/jantje to the path
echo 'export PATH=${PATH}:/www/cgi-bin/jantje' >>/etc/profile

#reset leonardo together with linux to avoid unwanted serial data to arrive
echo "#!/bin/ash" >/bin/reboot
echo reset-mcu>>/bin/reboot
echo /sbin/reboot  >>/bin/reboot
chmod +x /bin/reboot

#make the pkill command
echo 'if [ $1 -eq "" ]; then' >/bin/pkill
echo 'echo "Usage : pkill <process name>"' >>/bin/pkill
echo "else" >>/bin/pkill
echo 'PIDS=`pidof $1`' >>/bin/pkill
echo 'kill -9 $PIDS' >>/bin/pkill
echo "fi" >>/bin/pkill

#remove the bridge starter
echo remove the line ttyATH0::askfirst:/bin/ash --login from /etc/inittab
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Go Up