<< to CrossControl homepage

Support & Service Center

Change name of autostart script (cc-auto.sh)

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

To be able to autostart scripts from an inserted USB-stick, we currently use the script name ‘cc-auto.sh’. If there is a script with this name on the root-folder of the USB, it will start executing its contents when the USB stick is inserted in a display unit..


iMX5 units (VC/VA/XS/XA)

Why we use this particular name for the auto script, depends on the content of the file ‘/sbin/hotplug’.

In Linux there is a kernel parameter, /proc/sys/kernel/hotplug which normally contains the pathname ‘/sbin/hotplug’. That parameter gives the name of a program which the kernel may invoke at various times.

The USB subsystem currently invokes /sbin/hotplug when USB devices are added or removed from system. This invocation is currently done by the kernel in our Linux units.

If you want to rename the script that will be autostarted, when present on an USB-stick, you need to edit (with ‘nano’ or ‘vi’) the following file:

/sbin/hotplug

To edit the hotplug file, first unlock the OS with:

# mount -o remount,rw /

Exchange the name ‘cc-auto.sh’ to the name of your choice.

mount_usb()
{
   DEV=$1
   SLOT=$2
   mount -t auto $DEV $SLOT –osync
   if ( test $? -eq 0 ) ; then
      debug_mesg mounted $DEV to $SLOT
      if [ -f $SLOT/cc-auto.sh ] ; then
         debug_mesg executing autorun-script
         /bin/sh $SLOT/cc-auto.sh
      fi
   fi
}

There could also be a need to extinguish the possibility to autorun scripts from an inserted USB and in that case you need to remove (or comment out) the line:

#    /bin/sh $SLOT/cc-auto.sh 
as shown in the script example above.

Link to more Linux USB information


iMX6 units (VS/VI2)

The implementation of the auto script is different on iMX6 units compared to iMX5. There is a file that contain the default name of the auto-script name:
/etc/default/runusb
This file contains the line:

AUTORUN_FILE=cc-auto.sh

The value of the variable AUTORUN_FILE is used by the command ‘runusb’ that will be used when inserting USB sticks in the iMX6 displays.
To edit the runusb file, first unlock the OS with:

$ sudo mount –o remount,rw /

Change the name of the auto-script with the nano editor:

$ nano /etc/default/runusb

Exchange the name ‘cc-auto.sh’ to the name of your choice.
Remember to remount the file system back to Read-Only!

$ sudo mount –o remount,ro /

Environment and Versions: 
CCP VA/VC
Category: