Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 57

Thread: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

  1. #41
    Join Date
    Sep 2008
    Location
    United Kingdom, Kent
    Beans
    129
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    running this
    Code:
    dbus-monitor --system
    doesn't detect the lid event

    I went through your tutorial and it doesn't work for me. When running the script manually I get this.
    With the listen option
    Code:
    DBUS Laptop Lid Event Listener : Open Script Found
    DBUS Laptop Lid Event Listener : Close Script Found
    DBUS Laptop Lid Event Listener : Laptop Lid Hal Address << found laptop switch : /org/freedesktop/Hal/devices/computer_logicaldev_input_3 >>
    DBUS Laptop Lid Event Listener : Listening << waiting for laptop lid events... >>
    and the test option
    Code:
    DBUS Laptop Lid Event Listener : Laptop Lid Hal Address << found laptop switch : /org/freedesktop/Hal/devices/computer_logicaldev_input_3 >>
    /org/freedesktop/Hal/devices/computer_logicaldev_input_3
    Customize bash commands/Unknown Process/I love LoL/'Keep Aligned' Stuck
    Red/cyan* means top priority
    *only if you have compiz negative turned on

  2. #42
    Join Date
    Oct 2005
    Location
    Adelaide, South Australia
    Beans
    746
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    I had another idea, that you could use :
    Code:
    inotifywait /proc/acpi/button/lid/LID/state --monitor
    while running that open/close the lid, see if that gives you a response (i think it will based on your previous encounter with this file)

    if that works, i'll modify my script above to optionally work with inotify.
    Fear is the mindkiller....
    The little death that obliterates...

  3. #43
    Join Date
    Sep 2008
    Location
    United Kingdom, Kent
    Beans
    129
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    inotifywait didn't detect the event either. However, it did give a response if I try to otherwise use the state file like with cat or grep
    Customize bash commands/Unknown Process/I love LoL/'Keep Aligned' Stuck
    Red/cyan* means top priority
    *only if you have compiz negative turned on

  4. #44
    Join Date
    Oct 2005
    Location
    Adelaide, South Australia
    Beans
    746
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    I seem to have same problem with inotify, initially on my first try it was printing out state changes in that file...

    further attempts print nothing...

    I'l Look at this more tomorrow.
    Fear is the mindkiller....
    The little death that obliterates...

  5. #45
    Join Date
    Oct 2005
    Location
    Adelaide, South Australia
    Beans
    746
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    I'd like to continue with this project (even though i feel it's something that should be addressed by the existing window in gnome-power-manager), however I have assignments to deal with before I can give this serious attention.

    There are a few things that need to be addressed based on lucids lack of hal :

    1. detect that a laptop lid is present without hal.
    2. work out how to listen for a laptop lid dbus signal that does not rely on hal.
    3. create a gui which has an accompanying notification-tray icon to activate a list of scripts for both closing and opening events.
    Last edited by airtonix; March 15th, 2010 at 10:22 PM.
    Fear is the mindkiller....
    The little death that obliterates...

  6. #46
    Join Date
    Dec 2007
    Location
    Galway, Ireland
    Beans
    316
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    Quote Originally Posted by airtonix View Post
    even though i feel it's something that should be addressed by the existing window in gnome-power-manager
    I agree. Unfortunately current gnome-power-manager lacks a lot of functionality. The way you can only choose pre-defined times is a big usability problem for example. Try to choose 'put computer to sleep' after 3 hours... you can't. You will have to go into gconf-editor and set the time manually.

    Thanks for taking the time to look into this, I wish I was more skilled in Linux to give you a hand. If there's anything I can help with let me know.

  7. #47
    Join Date
    Oct 2005
    Location
    Adelaide, South Australia
    Beans
    746
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    I've picked this up again and moved the idea in a direction that encompasses more than laptop lid open and close events(although by default this will be one of the default profiles provided).



    So far I plan on having it work like this :


    1. user creates an 'object', which describes a DBUS interface, path and signal(s) to monitor.
    2. user then creates action(s) to be used by the object when it's signals fire
    3. actions can be grouped so you can have multiple actions running from each signal event. each action is executed in turn.

    I think it would be good to have a dbus object interface explorer included, but then we are approaching what d-feet already does...

    I also understand the author of d-feet plans to include the ability to associate scripts with signals being fired
    Attached Images Attached Images
    Fear is the mindkiller....
    The little death that obliterates...

  8. #48
    Join Date
    Dec 2007
    Location
    Galway, Ireland
    Beans
    316
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    I just installed Ubuntu 9.10 on a Thinkpad W500 and applied these scripts. The lid still works as per the first post. The dock event needs a few changes.

    Sorry I don't have time to properly edit the first post so I'll just add it here.

    Basically follow the step on the first post, but then apply the changes mentioned in post 20 and then make sure that the /etc/thinkpad/dock.sh script is executable. I wasn't able to make it executable with chmod not even when logged in as root. What worked for me was launching nautilus from a root terminal and navigating to the dock.sh script, right-click -> properties and make it executable there.

    Hope this helps. If not post here.

  9. #49
    Join Date
    Sep 2008
    Location
    Switzerland
    Beans
    9
    Distro
    Ubuntu

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    The above described doch/undock events are not generated on my Lenovo W510 under Ubuntu 11.04. The content of /sys/devices/platform/dock.0/docked is also fixed to 0.
    Is this a bug of udev, Ubuntu, the w510 or should that not work when I press the undock button of the docking station? The docking station is a "Lenovo ThinkPad Mini Dock Series 3 - Mini-Dock".

  10. #50
    Join Date
    Dec 2007
    Location
    Galway, Ireland
    Beans
    316
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [HOWTO] Run scripts for laptop lid open/close and dock/undock events

    Quote Originally Posted by pete78 View Post
    The above described doch/undock events are not generated on my Lenovo W510 under Ubuntu 11.04. The content of /sys/devices/platform/dock.0/docked is also fixed to 0.
    Is this a bug of udev, Ubuntu, the w510 or should that not work when I press the undock button of the docking station? The docking station is a "Lenovo ThinkPad Mini Dock Series 3 - Mini-Dock".
    I haven't tried this with 11.04 and I don't think I ever will because I just don't like it and find it very buggy.

    To debug this run the bellow command and undock to see what you get:
    Code:
    udevadm monitor --environment
    And see if the event you get when pressing the undock button matches your rule.

    In my case when I press the undock button I get:
    Code:
    KERNEL[1307629733.862912] change   /devices/platform/dock.0 (platform)
    UDEV_LOG=3
    ACTION=change
    DEVPATH=/devices/platform/dock.0
    SUBSYSTEM=platform
    EVENT=undock
    MODALIAS=platform:dock
    SEQNUM=2711
    And you can see how this matches the rule:
    Code:
    KERNEL=="dock.0", ACTION=="change", RUN+="/etc/thinkpad/dock.sh"
    Bear in mind I'm doing this on 10.04 and a Thinkpad W500.

    I hope this helps.

Page 5 of 6 FirstFirst ... 3456 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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