Skip to content

Commit

Permalink
lime-hwd-usbradio: added documentation for hotplug-hook.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
frank95 committed Jun 24, 2014
1 parent 489bef2 commit 1dd2c3a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/lime-hwd-usbradio/src/hotplug-hook.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/bin/sh


burstStopFile="/tmp/lime-hotplug-usbradio-burst-check"

#[Doc] Check if burstStopFile exists to avoid multiple execution due to hotplug call burst
#[Doc] In the case burstStopFile exists the following code will be not executed
[ -e "${burstStopFile}" ] ||
{
#[Doc] Prepare Lua table with the hotplug parameters
lua_hotplug_args="hotplug_hook_args = { action='${ACTION}', devicename='${DEVICENAME}', devname='${DEVNAME}', devpath='${DEVPATH}', product='${PRODUCT}', type='${TYPE}', interface='${INTERFACE}' }"

#[Doc] Create burstStopFile; Write the date just for debugging
date > "${burstStopFile}"

#[Doc] Wait for the radio to be ready
#[Doc] Configure the device calling lime-config but first execute lua_hotplug_args to pass hotplug parameters
#[Doc] Finally remove burstStopFile
((sleep 2s ; lua -e"${lua_hotplug_args}" /usr/bin/lime-config ; rm -rf "${burstStopFile}")&)
}

0 comments on commit 1dd2c3a

Please sign in to comment.