Re: Laptop lid response time and search domain questions



Hey,

Depending on what you have configured for handling your lid close,
this might or might not work. When I close my lid my laptop is
configured to goto sleep. So this event triggers the lid CLOSE event,
but opening the lid requires me to press the power button to bring the
computer back from sleep state, which then does NOT trigger the lid
OPEN event. If you don't goto sleep, then this should work for you.
Though I figure you goto sleep if you're wireless stops working.

Either way, with further investigation you might be able to get this working.

I created this script "/etc/acpi/local/lid.sh.pre":
#!/bin/bash

exec >>/tmp/lid.log 2>&1

if grep -q closed /proc/acpi/button/lid/*/state
then
  echo "Lid Closed: "`date`
else
  echo "Lid Opened: "`date`
  iwlist wlan0 scan
fi

It basically checks for lid open/close events, and runs iwlist wlan0
scan. It's for an Ubuntu installation. With further investigation you
could possible run it on a "return from sleep" event or something.

Shout if you need further assistance.

Quintin Beukes



On Fri, Jan 15, 2010 at 9:20 PM, Quintin Beukes <quintin last za net> wrote:
> Hey,
>
> Are you talking about wireless network detection? As far as I know,
> only root can initiate a scan, and lower users have to wait for the
> system. I know NetworkManager daemon runs as root, so I mentioned this
> for another reason. I can't say of a way to configure network manager
> to do the scan with the opening of a laptop lid, though if you can
> register a command to run when this happens, you could try and run
> "iwlist wlan0 scan" as root, and thus force network manager to
> immediately pick up the network.
>
> I have found the same problem when using adhoc networks, and I usually
> just force a discovery+connect by running this command on the 2nd host
> after I have setup the adhoc connection on the first host.
>
> I don't know if NetworkManager has any events triggered from ACPI. If
> DBUS supports these events, it could be a good idea to add a listener
> for them, and trigger a probe/scan when you open the lid, or come back
> from sleep, just like it does when you first power up.
>
> Beyond this, you can register a lid close/open event handler with
> ACPI. Have a look at /etc/acpi scripts. Mine is under
> /etc/acpi/events/lidbtn. You can try and do a scan command, or even
> restart NetworkManager (might work).
>
> On your second question. When "editing" the connection, on the IPv4/6
> tab, there is a "search domains" field. You can add a comma OR space
> separated list of search domains here, and when the configured
> connection is established, your resolv.conf will be updated
> appropriately. I don't think you can configure them 'globally', so all
> connections use the same search domains, so if you want them for all
> connections you need to explicitly add them to each connection.
>
> Hope this helps.
>
> Quintin Beukes
>
>
>
> On Fri, Jan 15, 2010 at 9:01 PM, Dylan Martin <dmartin sccd ctc edu> wrote:
>> Hi all, I've been trying to figure this out for a while, Googled,
>> scanned the mailing list archive etc... If these questions have been
>> answered elsewhere, I apologise deeply.  Pointers to pages answering
>> these questions would be great.
>>
>>  1) Laptop lid response time
>>
>> When I open my laptop's lid, the nm-applet waits a seemingly random
>> amount of time before it starts doing it's little dance and connecting
>> to my network.  Is there any way to configure NM to connect
>> immediately when the lid open event happens?  Is there a command I can
>> issue that will make NM start scanning immediately, as in something I
>> could call from a power management event script?
>>
>> 2) DNS Search domains
>>
>> Is there any way to add your own search domains to the resolv.conf
>> when NM makes a connection?  I have servers I like to SSH into at work
>> and I'd like to be able to type the short form of the names, so I'd
>> like to stick my work domain into the search domains list no matter
>> where I'm connected.  Is there a way to configure that?
>>
>> Thanks All!
>> -Dylan
>> _______________________________________________
>> NetworkManager-list mailing list
>> NetworkManager-list gnome org
>> http://mail.gnome.org/mailman/listinfo/networkmanager-list
>>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]