Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Assign echo 0 /1 >> /sys/class/rfkill/rfkill0/state to key
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
BenderBendingRodriguez
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2010
Posts: 101

PostPosted: Mon May 17, 2010 8:03 pm    Post subject: Assign echo 0 /1 >> /sys/class/rfkill/rfkill0/state to Reply with quote

Hello everybody

Today i am coming with a rather hard thing (at least for me). I am using a Samsung N130 netbook right now and i wanted to assign a combination of keys (Fn + F9) to toggle wifi state which exists currently at /sys/class/rfkill/rfkill0/state

I can successfully toggle the state from konsole but i'd love to have it assigned to the aforementioned keys...

I've read some wiki's about that but i haven't even got slightest idea how to do it...


echo 0 > /sys/class/rfkill/rfkill0/state shuts down wifi while

echo 1 > /sys/class/rfkill/rfkill0/state turns it on

How can i accomplish this please
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon May 17, 2010 10:54 pm    Post subject: Reply with quote

I've got an Asus where most of the Fn-* keys generate ACPI events, here's the relevant bits from my /etc/acpi/ stuff if it's any use:
Code:
# /etc/acpi/default.sh

# ...

case "$group" in
    button)
        case "$action" in
            zoom)
                /etc/acpi/actions/bluetooth_toggle.sh
                ;;
        esac
        ;;
esac

Code:
# /etc/acpi/actions/bluetooth_toggle.sh

hw_rfkill="/sys/class/rfkill/rfkill1"

[ -d $hw_rfkill ] || {
    logger "acpi: rfkill1 not found for bluetooth"
    exit 1
}

if [ $(< $hw_rfkill/state) -eq "0" ]; then
    echo 1 > $hw_rfkill/state

    # This has some weird double rfkill setup for the bluetooth, you probably don't need these lines:
    sleep 2
    for i in /sys/class/bluetooth/hci0/rfkill*; do
        echo 1 > $i/state
    done
else
    echo 0 > $hw_rfkill/state
fi
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 535

PostPosted: Wed May 19, 2010 8:40 am    Post subject: Reply with quote

Does xbindkeys support ACPI events?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum