Results 1 to 10 of 10

Thread: Use copy-button to spin down hdd?

  1. #1

    Use copy-button to spin down hdd?

    Hi,

    I think I just got a great idea Since I don't need the copy-button at all (does anybody?), it would be great to give it a better function e.g. to spin down the internal hdd. I don't even know if this is possible, but here are many clever people so if somebody reads this and manages to do so, let me know

  2. #2
    It's 100% possible. I've tinkered with the gpio configuration on the box and was able to read the state of the copy button as well as blink the power light.

    To blink the power LED:

    1. First get it's i/o state and value so it can be put back. I stored them in variables to put them back later:

    DIRECTION=`cat /proc/miscio/gpio_1_config | grep direction`
    VALUE=`cat /proc/miscio/gpio_1`

    2. Set the direction to "out"

    echo "direction=out" > /proc/miscio/gpio_1_config

    3. Set to 0/1 to turn on/off respectively

    echo "0" > /proc/miscio/gpio_1
    echo "1" > /proc/miscio/gpio_1

    4. Reset the gpio settings to the values from step 1

    echo ${VALUE} > /proc/miscio/gpio_1
    echo ${DIRECTION} > /proc/miscio/gpio_1_config

    To find the copy button, cycle through the various /proc/miscio/gpio_X (similar to step #1) while you press the button. You'll find it quickly.

    I had the copy, ez-setup, and power pins mapped out, but unfortunately I lost my notes... ;-(

    - K.C.
    Last edited by kfurge; 24-01-2007 at 02:36.

  3. #3
    Quote Originally Posted by kfurge View Post
    It's 100% possible. I've tinkered with the gpio configuration on the box and was able to read the state of the copy button as well as blink the power light.

    To blink the power LED:

    1. First get it's i/o state and value so it can be put back. I stored them in variables to put them back later:

    DIRECTION=`cat /proc/miscio/gpio_1_config | grep direction`
    VALUE=`cat /proc/miscio/gpio_1`

    2. Set the direction to "out"

    echo "direction=out" > /proc/miscio/gpio_1_config

    3. Set to 0/1 to turn on/off respectively

    echo "0" > /proc/miscio/gpio_1
    echo "1" > /proc/miscio/gpio_1

    4. Reset the gpio settings to the values from step 1

    echo ${VALUE} > /proc/miscio/gpio_1
    echo ${DIRECTION} > /proc/miscio/gpio_1_config

    To find the copy button, cycle through the various /proc/miscio/gpio_X (similar to step #1) while you press the button. You'll find it quickly.

    I had the copy, ez-setup, and power pins mapped out, but unfortunately I lost my notes... ;-(

    - K.C.
    This is exactly what I’m trying to do with the wl500gP, unfortunately the paths you have specified don’t exist on the WL500gP? I’m running Olegs firmware.

    Has anyone been able to do this with the WL500gP?

    SM

  4. #4
    That is a pretty good idea but i don´t know how to change that?!...is there a manual for dummies?

  5. #5
    Quote Originally Posted by kfurge View Post
    It's 100% possible. I've tinkered with the gpio configuration on the box and was able to read the state of the copy button as well as blink the power light.

    To blink the power LED:

    1. First get it's i/o state and value so it can be put back. I stored them in variables to put them back later:

    DIRECTION=`cat /proc/miscio/gpio_1_config | grep direction`
    VALUE=`cat /proc/miscio/gpio_1`

    2. Set the direction to "out"

    echo "direction=out" > /proc/miscio/gpio_1_config

    3. Set to 0/1 to turn on/off respectively

    echo "0" > /proc/miscio/gpio_1
    echo "1" > /proc/miscio/gpio_1

    4. Reset the gpio settings to the values from step 1

    echo ${VALUE} > /proc/miscio/gpio_1
    echo ${DIRECTION} > /proc/miscio/gpio_1_config

    To find the copy button, cycle through the various /proc/miscio/gpio_X (similar to step #1) while you press the button. You'll find it quickly.

    I had the copy, ez-setup, and power pins mapped out, but unfortunately I lost my notes... ;-(

    - K.C.
    Dear K.C.,

    Is it possible to use it to control the WiFi? I want to turn it off when no one @ home...


    :-) IWAT

  6. #6
    Quote Originally Posted by iwat View Post
    Dear K.C.,

    Is it possible to use it to control the WiFi? I want to turn it off when no one @ home...


    :-) IWAT
    I'm not aware of a command line utility available in the Asus firmware (or my derived image) that is capable of turning wireless on and off.

    I think I remember someone mentioning an OpenWRT binary that does this.

    - K.C.

  7. #7
    I wrote this script for the purpose. Note that:

    0) Just a quick hack but works quite well
    1) You have to keep the button pressed for at least 1s
    2) The Ready LED keeps blinking when wlan is on
    3) If you don't have the bash, !#/bin/sh works as well

    Code:
    #!/opt/bin/bash
    
    on=1
    
    if wl radio | grep 1 &> /dev/null
    then
            radio=off
    else
            radio=on
    fi
    
    while true
    do
            if [ $radio = "on" ]
            then
                    echo "direction=out" > /proc/miscio/gpio_1_config
                    echo $on > /proc/miscio/gpio_1
                    if [ $on = 1 ]
                    then
                            on=0
                    else
                            on=1
                    fi
            fi
    
            if grep 1 /proc/miscio/gpio_6 &> /dev/null
            then
                    if wl radio | grep 1 &> /dev/null
                    then
                            wl radio on
                            radio=on
                    else
                            wl radio off
                            echo "direction=out" > /proc/miscio/gpio_1_config
                            echo "0" > /proc/miscio/gpio_1
                            radio=off
                    fi
            fi
    
            sleep 1
    done

    --milky

  8. #8
    Great script. The wl binary was the one I was thinking of.

    - K.C.

  9. #9
    K.C
    Any luck getting the mapping for the E-setup, Copy Buttons?

    What script does the system run when the copy button is pressed normally?

    Could this script be modified to read the contents of a CD on a USB cd player and upload contents that way as well?

    Or would you use the one of the two back USB and get it executed through a PHP page? anythoughts?

  10. #10
    Quote Originally Posted by Gizmo1007 View Post
    K.C
    Any luck getting the mapping for the E-setup, Copy Buttons?
    Yes, I found my notes again. Here's what I mapped:

    GPIO0 BTN_SHUTDOWN
    GPIO1 BTN_RESET
    GPIO4 BTN_SETUP
    GPIO6 BTN_USBCOPY

    What script does the system run when the copy button is pressed normally?
    /sbin/miscio_input_change

    It's a symlink to one of the Asus binaries.

    Could this script be modified to read the contents of a CD on a USB cd player and upload contents that way as well?
    It can be modified, but it's tricky. You first have clone /sbin to somewhere on the HDD. In my case, I cloned it to /opt/asus/sbin. You can then mount /opt/asus/sbin over sbin with:

    mount -o bind /opt/asus/sbin /sbin

    After this, you can replace the Asus binary with whatever you want. A serial console is helpful in debugging replacement scripts.

    I needed to hook into the power button to properly unmount my filesystems. To do this, I had to perform the following scriptland backflips:

    -------------------------------
    /sbin/miscio_input_change
    #!/bin/sh

    /bin/cp /shares/MYVOLUME1/shutdown.sh /tmp
    /bin/cp /bin/busybox /tmp/sh

    sync
    sync
    sync

    /tmp/shutdown.sh &
    --------------------------
    /shares/MYVOLUME1/shutdown.sh
    #!/tmp/sh

    /opt/bin/umount -l /sbin
    /opt/bin/umount -l /bin
    /opt/bin/umount -l /opt

    /bin/mkdir -p /tmp/miscio
    /bin/ln -s /sbin/rc /tmp/miscio/miscio_input_change

    sync
    sync
    sync

    /tmp/miscio/miscio_input_change &

    exit 0
    ------------------
    I use the following in rc.local to use the copy button to skip the execution of rc.local:

    # If the copy button is pressed, bypass rc.local
    bypass=`/bin/cat /proc/miscio/gpio_6`
    if test $bypass -eq "1"; then
    exit -1
    fi
    --------------------

    I'm sure all of this could be put together to have GPIO6 perform something other than what Asus intended.

    Please let us know if you get it working.

    Or would you use the one of the two back USB and get it executed through a PHP page? anythoughts?
    Sure, this would work also.

    - K.C.

Similar Threads

  1. Who is pressing the camera button ?
    By max2950 in forum WL-500g Q&A
    Replies: 0
    Last Post: 19-11-2006, 07:59
  2. 250GB LaCie HDD
    By BugBoy in forum WL-500g Q&A
    Replies: 7
    Last Post: 31-03-2006, 21:19
  3. WL-HDD copy data TO a USB Card Reader?
    By cominss in forum WL-HDD Q&A
    Replies: 2
    Last Post: 29-04-2005, 18:07
  4. Flashing Oleg's Firmware in WL HDD
    By hugo in forum WL-HDD Custom Development
    Replies: 29
    Last Post: 21-10-2004, 14:55
  5. USB HDD connects as Webcam
    By Oldchatterman in forum WL-500g Q&A
    Replies: 12
    Last Post: 19-10-2004, 17:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •