1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Playing files across the network.

Discussion in 'FOXSAT-HDR Customised Firmware' started by Ohlookasquirrel, Jul 26, 2012.

  1. Ohlookasquirrel

    Ohlookasquirrel New Member

    Hello, excuse a technical first post... - Hello all BTW :)

    I've got a Foxsat HDR running Raydon's 4.0.7, samba etc. I've followed a recipe for allowing network shares to be mounted on the HDR, allowing programmes saved on the network to be played. Setting it all up manually, it worked beautifully.

    Where I'm falling down is "how to auto-magically" manage the setting up of the networked share.
    Udev looked to be a solution - running a script when USB drive is inserted - but udev doesn't seem to be on the HDR.

    I don't want to always setup the share when starting the Humax. If my main system is suspended, I'd rather leave it be. Is there any existing function I can tap in to, to run a script when a USB stick is inserted? Short of running something constantly, polling the existence of "sdb1"?

  2. Ohlookasquirrel

    Ohlookasquirrel New Member

    Made a little more progress. Found ether-wake embedded in busy-box so I can wake up my server when I want. Also been playing with Linux scripting.
    Look's like any script will have to run constantly, waking up and testing /media/sdb1 every "n" seconds. Unless I can find a way of triggering a script on USB key insertion.
  3. af123

    af123 Administrator Staff Member

    mdev is what you want to look at rather than udev. The custom firmware uses mdev to detect insertion.
  4. David.mk

    David.mk New Member

    Hi OhLookASquirrel,

    I was in same situation as you, and followed recipe on avforums

    Initially I have done as you mentioned, with the periodic polling - see script below.
    Note: I execute this script off from the S90mount shell script as a background process (see thread link above for the S90mount).

    # background priocess to periodically mount NAS to /media/sda1.
    # After insertion of USB it will mount itself to /media/sda1 - override this with mount to NAS samba share
    # wait for system to start
    sleep 50
    while true
        # Check if we are already mounted to the samba share on /media/sda1
        if [ -d /media/sda1/TV ] ; then
        echo "already mounted"
        mount -t cifs // -o user=MYUSER,pass=MYPASSWORD,domain=WORKGROUP /media/sda1
        sleep 240
    This script means that you wait at most 240 seconds after USB stick inserted before NAS share is available within the UI. (note that /media/sda1/TV is a directory on the NAS under the samba share).

    However i have noticed that in /etc/mdev.conf there is a line :
    "sd[a-z][0-9]* 0:0 660 */etc/mdev/run-and-gun"

    This may be a clue. I will try and dig further, at some point, to see if there is a more elegant solution than inserting the USB stick.

    I suppose on the plus side, you only need to insert the USB when you want to view the NAS files, and this may be useful if the foxsat keeps "polling" the NAS and keeping it awake and the hard discs spinning and thus using up electricity.

    I'd be interested in your solution(s) to NAS+FOXSAT sharing.

    FOXSAT-HDR + 1 TB, Raydons v4.0.8 (v1.00.21)
    NAS = QNAP TS-210
  5. raydon

    raydon Well-Known Member

    /etc/mdev/run-and-gun is the script that's run by mdev when the insertion of a USB device triggers an event. This script is currently used to install opkg packages from usb. but I suppose it could be modified to also run a user script if it existed. However, the change would require an update to the custom firmware since this script is embedded in the read-only firmware. There is a better solution under development, see here for details.
    B.T.W. You haven't mention it here, but I assume that you have also 'insmod'ed the cifs.ko module at some other point in the boot process otherwise your cifs mount would fail.
  6. David.mk

    David.mk New Member

    Hi Raydon,
    Thanks for the info. I've had a chance to look at the run-and-gun script now, and I see your point. I was hoping it would contain a clue as to how the humax ui (possibly the settop process), gets notified of the USB insertion, and therefore I could mimic it, and get the cifs mount visible within the humax UI (without using a USB stick). Its not a big issue, though. In some ways its handy to be able to control when the NAS is being accessed.

    Yep I have used the instructions within AVForums that Partridge and yourself posted (i.e. cifs.ko + insmod + S90mount script). It works a treat and is most awesome! Just what I needed. By the way, I use wget in "mirror" mode from my NAS to automatically copy the files from Foxsat->NAS. Works really well.

    I'll keep an eye on the thead you mentioned for more details of the ongoing development.