paul- wrote: 
> pigpiod is a forking daemon, not sure how long it takes to initialize
> internally.  Rather than a a set sleep timer, it would probably be best
> to query the daemon to make sure it's started.

Will this be robust?

Code:
--------------------
    #!/bin/sh
  
  # start pigpiod deamon
  pigpiod -t 0
  
  # wait for pigpiod to initialise - indicated by 'pigs t' returning a numeric 
value.  Returns 'socket connect failed' otherwise
  while ! [ $(pigs t) > '0' ] 
  do
        echo "Waiting for pigpiod to initialise"
        sleep 1
  done
  echo "pigpiod is running"
  
  # load uinput module - required to be able to send keystrokes
  .
  .
  .
--------------------


In testing this I noticed that I will often get that 'initMboxBlock:
init mbox zaps failed' error if I kill pigpiod with just 'sudo kill -9
<pid>'.  It seems to leave something behind.  But if I instead use 'sudo
killall pigpiod', even though there seems to be only one process
associated with pigpiod, it seems to terminate more reliably, so that it
can be loaded again.

I've never seen this error after a fresh reboot, which should normally
be the only time pigpiod needs to be loaded.


------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=111502

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to