LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-01-2008, 12:43 AM   #1
orbit
Member
 
Registered: Sep 2006
Location: Australia
Distribution: Slackware
Posts: 176

Rep: Reputation: 30
Link Network Script with Acer Hotkeys?


Hi All,

Using slackware12 on my Acer laptop I have setup acerhk (a program that uses xmodmap to define all of the special keys; e.g. wireless, bluetooth, web, mail etc..), and I have also created a basic network script that brings my eth1 (wireless) up and configures it.

What I currently have working is that when I press the wireless hotkey button; the wireless card enables and the wireless L.E.D. shows activity. Then I have to manually run the script to configure the interface and bring it 'up'

What I am now wondering is how I might go about linking the the script and acerhk together?

So that, if I press the wireless button, the card enables, the led activates, the script gets run [wifi up] which then configures and activates the interface, and I am connected. Also when I am finished, it would be preferable to be able to just press the button again and have the network go down [wifi down] and the card disable.

My network script is as follows:
Quote:
#!/bin/sh
## This script has been created to enable quick Wireless config on an ACER Travelmate.
##
## To enable running as user, add sudo support to /etc/sudoers (see example file).
##
## Usage: wifi up|down

if [ "$1" == "up" ]; then
# /sbin/modprobe ndiswrapper
# sudo /sbin/dhcpcd eth1 -h slack12.0 &
sudo /sbin/ifconfig eth1 192.168.1.64 broadcast 192.168.0.1 netmask 255.255.255.0 up &
sudo /sbin/route add default gw 192.168.1.1 &
# sudo /sbin/iwconfig eth1 nick Weasel &
sudo /sbin/iwconfig eth1 essid Weasel &
# /sbin/iwconfig eth1 key sassword [2]
fi

if [ "$1" == "down" ]; then
sudo /sbin/ifconfig eth1 down
# sudo /sbin/dhcpcd -k
# /sbin/modprobe -r ndiswrapper
fi

Also I have setup /etc/sudoers to be able to run the script commands fully as a normal user, so permissions on controlling the network interface is not a problem.

But how I go about linking the two entities together has got me stumped ... any ideas anyone?

Cheers

Orbit

Last edited by orbit; 05-01-2008 at 12:47 AM.
 
Old 05-01-2008, 06:54 PM   #2
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
If pressing the key defined by acerhk simply runs a script, then you could create a wrapper script that runs the acerhk script followed by your script (and add some nifty if...else stuff as well if you want to use the same button to turn off the connection etc. if it's already up). I'm not exactly sure how the acerhk app functions, so I don't know if this will work -- it's just something to look into.
 
Old 05-02-2008, 12:01 AM   #3
orbit
Member
 
Registered: Sep 2006
Location: Australia
Distribution: Slackware
Posts: 176

Original Poster
Rep: Reputation: 30
Hi T3slider,

Hmmm, wrapper script? ... don't know anything about that concept (yet) ... but it sounds interesting.

I'll do some reading and see what I can do.

Thanks very much for the idea

Cheers

Orbit
 
Old 05-02-2008, 05:28 PM   #4
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
If you can figure out which app is called upon pressing the desired key, you can remap that key (either using xbindkeys or a desktop environment-specific method -- KDE has pretty extensive keymapping options if you use that, and XFCE has some keymapping options as well. See here for more info: http://dev-loki.blogspot.com/2006/04...h-xmodmap.html) to run your own script that will first launch the acerhk app, and then run your script. Something like the following would do (but keep in mind that, since you want to turn off the network etc. upon pressing the button, you'd have to check to see if the network is up first by running `/sbin/ifconfig` or some such thing and checking for an active connection, and then run either the startup or shutdown script):
Code:
#!/bin/sh

# Start the acerhk app, whatever it may be (change this to the correct location)
/usr/bin/acerhk-start-connection

# Run your script
/path/to/script/wifi up
You should first test if that works before adding a check to see if you're turning the network on or off. It will only work IF the button press calls an app using xmodmap or something similar, and only if you can identify that app/script.

Good luck -- if you need help just say the word.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora Core 6 on an Acer Aspire, Network + Driver problems. SKG Linux - Laptop and Netbook 7 06-18-2007 05:40 PM
link up script balajee Linux - Software 2 08-12-2005 01:25 AM
Acer 1520 network problem ( newbie) martin_s_b Linux - Networking 1 05-29-2005 09:10 PM
Problems with acer 802.11 b/g wireless (link) Oholiab Linux - Hardware 1 04-01-2005 10:11 AM
Network help. Acer ALN-201 PCI trouble AcX Slackware 1 08-11-2004 10:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration