docking/undocking support isn't included

Bug #18864 reported by David Tansey
46
This bug affects 2 people
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

I have an ibm x40 with a dock. docking/undocking doesn't work out of the box --
i had to download /etc/acpi/ and /etc/acpi/events files from the web and tweak
them. it seems like it would be fairly simple feature to add, especially now
that ibm-acpi.ko is included with the kernel.

here are my /etc/acpi/(un/)dock.sh files

dock.sh:
#!/bin/bash

status=`/usr/bin/awk '/^status:/ {print $2}' /proc/acpi/ibm/dock`

echo dock > /proc/acpi/ibm/dock

# if idel (cdrom) is already there exit
if [ -L /proc/ide/hdc ]; then
   exit 1
fi

#else register it
sleep 1
/bin/sync
hotswap -c 1 rescan-ide

#note -- howswap is used instead of idectl because idectl has had problems on
debian-based systems.

undock.sh:

#!/bin/bash

status=`/usr/bin/awk '/^status:/ {print $2}' /proc/acpi/ibm/dock`

if [ "$status" == "docked" ]; then
    /bin/sync

#make sure the bay's cdrom is unmounted

su my_user_name -c "killall -HUP nautilus"
#this is a hack to make sure nautilus isn't locking the device. there must be
better ways...

umount -l /cdrom

#idectl isn't workign well on debian based systems
#/usr/share/doc/hdparm/contrib/idectl 1 off
#so use howswap instead:

#unregister ide1
howswap -c 1 unregister-ide

if [ -L /proc/ide/hdc ]; then

   exit 1
fi

echo undock > /proc/acpi/ibm/dock

#end of status check if statement
fi

events/dock:

event=(ibm/dock GDCK 00000000 00000003|ibm/hotkey HKEY 00000080 00001008)
action=/etc/acpi/dock.sh

events/undock:

event=(ibm/dock GDCK 00000003 00000001|ibm/hotkey HKEY 00000080 00001009)
action=/etc/acpi/undock.sh

so i hope there will be some way to write up these kinds of files and put them
into /etc/acpi -- it'd be great if my system could dock out of the box and
without my hacks. and maybe even have a gnome-panel applet or some other way to
inform me that the dock is successful, or, if it isn't, what the problem is
(like: cdrom in use. close whatever applications may be using it and eject it.)

Revision history for this message
Matthew Garrett (mjg59) wrote :

I'll work on integrating this into acpi-support

Revision history for this message
Len Brown (len-brown) wrote :

note that there are patches on the lists to start adding
generic docking station support upstream. when they're in,
the ibm specific feature will be deleted.

Revision history for this message
Angelo Lisco (angystardust-gmail) wrote :

Len, can you please tell me where I can find this thread?
Thanks

Revision history for this message
Len Brown (len-brown) wrote :
Revision history for this message
David Tansey (djtansey) wrote :

Still have no docking/undocking support in Dapper Beta. Pressing the undock button does nothing. Even after loading ibm_acpi.

Am I missing something?

Revision history for this message
David Tansey (djtansey) wrote :

I just reinstalled from the rc liveCD. I assume that the inclusion of docking support was postponed? Because it doesn't seem to be in the default install.

any suggestions as to how to add it myself?

Revision history for this message
David Tansey (djtansey) wrote :

Any update on docking/undocking? I notice that there is a module /lib/modules/2.6.20-13-386/kernel/drivers/acpi/dock.ko in fiesty's latest kernel. When will that module be used in the acpi scripts?

Revision history for this message
Paul Sladen (sladen) wrote :

We don't get have support in the 'acpi-support' scripts. If I get access to a dock at some point, I'll try and make this work for ThinkPads.

Revision history for this message
David Tansey (djtansey) wrote : Re: [Bug 18864] Re: docking/undocking support isn't included

I have a dock and would be happy to work on such scripts. Can you give me
some tips?

On 3/30/07, Paul Sladen <email address hidden> wrote:
>
> We don't get have support in the 'acpi-support' scripts. If I get
> access to a dock at some point, I'll try and make this work for
> ThinkPads.
>
> --
> docking/undocking support isn't included
> https://launchpad.net/bugs/18864
>

Revision history for this message
David Tansey (djtansey) wrote :

I am still willing to test docking scripts/ help create them for the next release of Ubuntu. I see that docking doesn't work out of the box with Feisty...

Let me know.

Revision history for this message
Magnus Hedemark (viridari) wrote :

Another wish for this. I have an IBM Thinkpad T40.

Here is my lspci:

00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon R250 [Mobility FireGL 9000] (rev 02)
02:00.0 CardBus bridge: Texas Instruments PCI1520 PC card Cardbus Controller (rev 01)
02:00.1 CardBus bridge: Texas Instruments PCI1520 PC card Cardbus Controller (rev 01)
02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)
02:02.0 Network controller: Intel Corporation PRO/Wireless LAN 2100 3B Mini PCI Adapter (rev 04)

Almost everything on this laptop works great but switching between docked/undocked configuration doesn't work with xorg. When I undock the internal display remains blank. The automatic display switching between docked/undocked/external projector is probably the one big thing keeping Ubuntu from being great on this laptop.

Revision history for this message
Justin Sheckler (self-jaykayess) wrote :

On my Dell Latitude D630, running Gutsy, it would be great to run this command automatically on dock/undock:

xrandr --output VGA --auto

Tailing /var/log/messages, I see ACPI dock/undock events, so the only thing missing seems to be the dock/undock script suppport.

Revision history for this message
Adrovane Marques Kade (adrovane) wrote :

Hi. I have a Thinkpad T43 with a Thinkpad Dock II. I'm running on Feisty, and there is no such file /proc/acpi/ibm/dock. I tried Gutsy LiveCD, and the problem persists (besides that, in the latter case, not even /proc/acpi/ibm/bay exists - but this is another thread :-)). I'm sending the dmesg output (on Feisty) attached.

Revision history for this message
Jon Dowland (jond) wrote :

Here's a preliminary script for acpi-support to support hot docking/undocking.

For the thinkpad "undock please" button to work, you need to unmask it in /proc/acpi/ibm/event; I'm not sure if acpi-support or hotkey-support do this already.

You'll need thinkpad-acpi loaded for that /proc bit to be present, and dock loaded for the stuff in /sys which this script pokes.

Note that this doesn't work with a bay present in the dock yet: so you get dockable power, usb, video/ps2 passthrough etc., but not IDE/ATA devices.

Revision history for this message
Jon Dowland (jond) wrote :

that was for /etc/acpi/events; here's the shellscript

Revision history for this message
Jon Dowland (jond) wrote :

Oh, if the button isn't generating events, the unmask to do is
echo enable,0xffff > /proc/acpi/ibm/hotkey

Revision history for this message
imachine (m-jedrasik) wrote :

How's it working so far?

I have an X40 and 8.10 on it, and docking/undocking still doesn't work.

libata module links to bay module, so I guess there is already some cooperation in between those two in the kernel, but whenever I press the undock button and the notebook was booted up inside the dock, my system freezes.

When I reseat it into the dock, it defreezes and works ok. Also, whatever input has been made during the time it was frozen, acts up whenever it's reseated into the dock, so it's not like a normal error-like freeze I guess.

Whenever I place the laptop inside the dock, if it was booted up outside of it, the cd-rom doesn't get picked up.

Could someone fix this? I bet Ubuntu has the grounds for it, and ThinkPads aren't crappy machines after all - I'd believe they deserve decent support!

Cheers,

Revision history for this message
Jon Dowland (jond) wrote :

Hi, sorry for the delay, I rarely check launchpad... afaik this still is not implemented and I will be persuing it again soon.

Jeffrey Baker (jwbaker)
tags: added: karmic patch thinkpad
Revision history for this message
Jeffrey Baker (jwbaker) wrote :

This report (and its duplicate) has a working patch. It might be a nice-to-have for Karmic. It could turn out to be the very first Ubuntu release where all the ThinkPad hotkeys work :-)

Steve Langasek (vorlon)
Changed in acpi-support (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Thomas Hood (jdthood) wrote :

In Intrepid my ThinkPad X61 would freeze when I tried to remove it from the UltraBase X6 without deleting the Ultrabay Slim drive device first (using "echo 1 > /sys/class/scsi_device/1:0:0:0/device/delete"). The prepare-for-undock button on the UltraBase had no useful effect.

In Karmic:
* The X61 never freezes, even if removed from the UltraBase without any preparation.
* The prepare-for-undock button on the UltraBase X6 causes UltraBase devices, including the Ultrabay Slim drive, to be deleted.
* If the prepare-for-undock button is not pressed before the X61 is removed from the UltraBase then USB devices connected to the UltraBase do not work after redock.

Re: #404655 which asks for Fn-F9 to cause preparation for undock just like the prepare-for-undock button: In Karmic, pressing Fn-F9 has no effect on my ThinkPad X61. How might one map the Fn-F9 keypress event to a prepare-for-undock-button event?

Revision history for this message
Steve Langasek (vorlon) wrote :

Thomas,

I'm sure it's possible to make the Fn+F9 key behave the same, if we can first see how the prepare-for-undock button is handled. Does this show up as an acpi event, as an input event, or as something else? Please see https://wiki.ubuntu.com/Hotkeys/Troubleshooting for information on how to analyze where this event is being handled.

Revision history for this message
Thomas Hood (jdthood) wrote :

I used various utilities to monitor what happens when the "prepare to undock" key (labelled "▸") is pressed on the UltraBase X6 while the X61 is docked in it. The X61 is runing freshly installed Karmic.

acpi_listen: video VID 00000080 00000000
showkey -s: 0xe0 0x56 0xe0 0xd6
showkey -k: 227
input-events 6: KEY_SWITCHVIDEOMODE (0xe3)
xev: 235

Note that all but the first of these events are the same as those generated by Fn-F7, the "change display" hot key. (The latter generates ACPI event "ibm/hotkey HKEY 00000080 00001007", according to acpi_listen.)

What other information should I obtain?

Revision history for this message
Thomas Hood (jdthood) wrote :

More info. The "prepare to undock" key generates the following according to "lshal -m":

   platform_dock_0 property info.docked = false
   computer_logicaldev_input_0 condition ButtonPressed = switch-videomode

Contrast with Fn-F7 which generates:

   computer_logicaldev_input_3 condition ButtonPressed = switch-videomode

I have accumulated information about the X61 special keys here: http://www.thinkwiki.org/wiki/Installing_Ubuntu_9.10_%28Karmic_Koala%29_on_a_ThinkPad_X61#Table_of_keycodes_for_special_keys_and_key_combinations_in_Karmic

Revision history for this message
Steve Langasek (vorlon) wrote :

> More info. The "prepare to undock" key generates the following
> according to "lshal -m":

> platform_dock_0 property info.docked = false

Hmm, so where does this event come from? What does 'sudo lsinput' show on this system when the dock is connected?

Revision history for this message
Steve Langasek (vorlon) wrote :

As near as I can tell, hal gets this information by periodically polling the contents of /sys/devices/platform. So unfortunately, unless there's some other kernel event notification that hal isn't using, we'll be out of luck.

Revision history for this message
Jeffrey Baker (jwbaker) wrote :

I am somewhat bemused that I posted a fix for this in the first post of the bug that was duped to this one, but that fix is lost inside Launchpad's tiny brain.

Revision history for this message
Steve Langasek (vorlon) wrote :

Hi Jeffrey,

# acpi_listen
ibm/hotkey HKEY 00000080 00001009

That event is not mapped to anything in /etc/acpi. The dedicated key on the dock itself does work as expected.

I believe the fix is as simple as these three lines:

# cat events/lenovo-undock
event=ibm/hotkey HKEY 00000080 00001009
action=/etc/acpi/undock.sh

# cat undock.sh
#!/bin/sh

echo 1 > /sys/devices/platform/dock.0/undock

Sure, we can do that; but is that what's done when the Prepare-for-undock key is pressed?

Revision history for this message
Jeffrey Baker (jwbaker) wrote :

All I know is that script makes the Fn combination behave exactly the same way as the button on the dock itself with my X61 Tablet.

Revision history for this message
Steve Langasek (vorlon) wrote :

Ok, i'm committing a script to do this, then.

I would still like to know where it is that the event is handled for the Prepare-for-undock key - partly because acpi-support is intended to go away and it would therefore be good to put this functionality somewhere else, and partly because hal is /also/ deprecated, so if it's hal that's handling this, the handling is likely to break in Lucid.

Revision history for this message
Thomas Hood (jdthood) wrote :
Download full text (3.1 KiB)

Steven Langasek wrote:
> What does 'sudo lsinput' show on this system when the dock is connected?

I append the output.

My X61 is docked in an UltraBase X6 whose Ultrabay Slim contains a DVD burner. Connected to the UltraBase's USB ports are a Microsoft curve keyboard and a Logitech trackball.

jdthood@triffid:~$ sudo lsinput
[sudo] password for jdthood:
/dev/input/event0
   bustype : BUS_HOST
   vendor : 0x0
   product : 0x1
   version : 0
   name : "Power Button"
   phys : "LNXPWRBN/button/input0"
   bits ev : EV_SYN EV_KEY

/dev/input/event1
   bustype : BUS_HOST
   vendor : 0x0
   product : 0x5
   version : 0
   name : "Lid Switch"
   phys : "PNP0C0D/button/input0"
   bits ev : EV_SYN EV_SW

/dev/input/event2
   bustype : BUS_HOST
   vendor : 0x0
   product : 0x3
   version : 0
   name : "Sleep Button"
   phys : "PNP0C0E/button/input0"
   bits ev : EV_SYN EV_KEY

/dev/input/event3
   bustype : BUS_ADB
   vendor : 0x1
   product : 0x1
   version : 256
   name : "Macintosh mouse button emulation"
   bits ev : EV_SYN EV_KEY EV_REL

/dev/input/event4
   bustype : BUS_I8042
   vendor : 0x1
   product : 0x1
   version : 43860
   name : "AT Translated Set 2 keyboard"
   phys : "isa0060/serio0/input0"
   bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP

/dev/input/event5
   bustype : BUS_USB
   vendor : 0x45e
   product : 0xdd
   version : 273
   name : "Microsoft Comfort Curve Keyboard"
   phys : "usb-0000:00:1a.7-4.1/input0"
   uniq : ""
   bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP

/dev/input/event6
   bustype : BUS_HOST
   vendor : 0x0
   product : 0x6
   version : 0
   name : "Video Bus"
   phys : "/video/input0"
   bits ev : EV_SYN EV_KEY

/dev/input/event7
   bustype : BUS_USB
   vendor : 0x45e
   product : 0xdd
   version : 273
   name : "Microsoft Comfort Curve Keyboard"
   phys : "usb-0000:00:1a.7-4.1/input1"
   uniq : ""
   bits ev : EV_SYN EV_KEY EV_REL EV_ABS EV_MSC EV_REP

/dev/input/event8
   bustype : BUS_USB
   vendor : 0x46d
   product : 0xc402
   version : 272
   name : "Logitech Trackball"
   phys : "usb-0000:00:1a.7-4.2/input0"
   uniq : ""
   bits ev : EV_SYN EV_KEY EV_REL EV_MSC

/dev/input/event9
   bustype : BUS_HOST
   vendor : 0x1014
   product : 0x5054
   version : 26625
   name : "ThinkPad HDAPS joystick emulatio"
   phys : "hdaps/input0"
   bits ev : EV_SYN EV_ABS

/dev/input/event10
   bustype : BUS_HOST
   vendor : 0x1014
   product : 0x5054
   version : 18433
   name : "ThinkPad HDAPS accelerometer dat"
   phys : "hdaps/input1"
   bits ev : EV_SYN EV_ABS

/dev/input/event11
   bustype : BUS_HOST
   vendor : 0x17aa
   product : 0x5054
   version : 16641
   name : "ThinkPad Extra Buttons"
   phys : "thinkpad_acpi/input0"
   bits ev : EV_SYN EV_KEY EV_MSC EV_SW

/dev/input/event12
   bustype : BUS_I8042
   vendor : 0x2
   product : 0xa
   version : 0
   name : "TPPS/2 IBM TrackPoint"
   phys : "isa0060/serio1/input0"
   bits ev : EV_SYN EV_KEY EV_REL

/dev/input/event13
   bustype : BUS_PCI
   vendor : 0x11d4
   product : 0x1984
   version : 1
   name : "HDA Digital PCBeep"
   phys : "card0/codec#0/beep0"
   bits...

Read more...

Revision history for this message
Thomas Hood (jdthood) wrote :

Steve Langasek wrote:
> I would still like to know where it is that the event is handled for the Prepare-for-undock key

Thecode in linux/drivers/acpi/dock.c seems to invoke ACPI routines "_DCK" and "_EJ0". I'm afraid I don't know much about the ACPI subsystem, though.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package acpi-support - 0.131

---------------
acpi-support (0.131) lucid; urgency=low

  * events/lenovo-undock, undock.sh: new scripts to handle the Fn+F9 "undock"
    button on ThinkPads, which unfortunately nothing else handles. Thanks
    to Jeffrey Baker for the first implementation. LP: #18864.
  * /etc/default/acpi-support: laptop-mode-tools is no longer installed by
    default, so don't override its setting from here. LP: #244838, #490186.
 -- Steve Langasek <email address hidden> Mon, 14 Dec 2009 11:04:22 -0800

Changed in acpi-support (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
thinkpad (fellowsgarden) wrote :

Hi,

I'm on Maverick Meerkat and seem to have the same problem. I filed a bug report before finding this one:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/691272

Yet, although the above one-year-old comment says "fix released" - I can't see any effect or sign of a fix on my (up to date) system... :-(

And as people have said on this page and elsewhere: it seems to be the last bastion of Ubuntu (Linux?) deficiency. (I'd try it on Debian if my SSD where large enough...)

Please help!

tp.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.