4 Replies Latest reply on Oct 22, 2015 9:24 AM by Intel_Peter

    Detect if USB cable is connected to ttyGS0?

    Christoph.P

      Hi!

      I'm intending to run an application on the edison which gets user input of a textfile which lies on the mass storage

      partition that shows up when e.g. a windows machine is connected. The intention is that everybody can edit this file

      easily and after plugging of the USB cable and rebooting the edison a c++ app mounts the partition, reads out the

      textfile and uses the infos out of it. The c++ app is started automatically when the edison boots and mounts the partition.

      The problem is that when the partition is mounted with

       

      losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update

      mount /dev/loop0 /update

       

      ... the USB port disconnects and thus the user on the windows machine can't edit anything anymore. How can

      I detect programmatically (or over any shell command) that the ttyGS0 port is used?

       

      the optimum would be to recognise the USB connection in a loop and wait for it's disconnection.

       

      Thanks!