T430 Ultrabay hotswap EJECT_REQUEST event

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

T430 Ultrabay hotswap EJECT_REQUEST event

Kevin Locke
Hi All,

I am trying to configure a ThinkPad T430 for hotswapping Ultrabay
devices based on the instructions on ThinkWiki.[1]  Everything is
working smoothly except that the udev rule for running the Ultrabay
eject script is not being fired when I unlock the bay lock latch.[2]
I'm wondering if this is expected behavior (because the latch is
purely physical) or if it's a software/firmware issue.  Has anyone had
any luck getting this to work on recent ThinkPads?

Troubleshooting Information:
- The T430 has a Serial Ultrabay Enhanced bay.
- I'm running an unpatched Linus 4.3 kernel under Debian testing.
- Nothing is printed by acpi_listen when unlocking the bay lock latch.
- Nothing is printed by evtest on the "ThinkPad Extra Buttons" input
  device (with hotkey_mask set to hotkey_all_mask) when unlocking the
  bay lock latch.
- The DSDT contains references to the following Eject Request events:
    Notify (\_SB.PCI0.LPC.EC.BAT1, 0x03) // Eject Request
    Notify (\_SB.PCI0.SAT1.PRT1, 0x03) // Eject Request
    Notify (\_SB.PCI0.SAT1.SCND.MSTR, 0x03) // Eject Request

Recommendations?
Is there an event that I can listen for, or should I just run the
ultrabay_eject script manually?  Is there a way to trigger Ultrabay
eject from desktop environments?  (It looks like udisks support for
Ultrabay device removal has been stalled for years[3] so perhaps not?)

Any thoughts/recommendations are appreciated!

Thanks,
Kevin

1.  http://www.thinkwiki.org/wiki/How_to_hotswap_Ultrabay_devices
2.  https://support.lenovo.com/us/en/docs/um014930
    (in the section Replacing the Ultrabay device)
3.  https://bugs.freedesktop.org/show_bug.cgi?id=23110

--
Kevin Locke  |  [hidden email]    | XMPP: [hidden email]
             |  https://kevinlocke.name  | IRC:   kevinoid on freenode
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
Reply | Threaded
Open this post in threaded view
|

Re: T430 Ultrabay hotswap EJECT_REQUEST event

Paul Seelig-3
On 12/16/2015 08:17 AM, Kevin Locke wrote:
> 1.  http://www.thinkwiki.org/wiki/How_to_hotswap_Ultrabay_devices
> 2.  https://support.lenovo.com/us/en/docs/um014930
>     (in the section Replacing the Ultrabay device)
> 3.  https://bugs.freedesktop.org/show_bug.cgi?id=23110
>

I once created the Debian based 'ultrabay-scripts' (which in turn took
their inspiration and part of the code from the mentioned sites) for
device swapping, albeit never used them on a T430 but only on T60 and
T61. Maybe they can provide some insight?

Please have a look here:

https://github.com/wmlive/ultrabay-scripts

Ready made packages for Debian can be fetched from here:

http://wmlive.rumbero.org/repo/

I would like to hear back from Ubuntu users if these packages also work
for them.

Regards,
Paul
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
Reply | Threaded
Open this post in threaded view
|

Re: T430 Ultrabay hotswap EJECT_REQUEST event

Kevin Locke
On Wed, 2015-12-16 at 08:56 +0100, Paul Seelig wrote:

> I once created the Debian based 'ultrabay-scripts' (which in turn took
> their inspiration and part of the code from the mentioned sites) for
> device swapping, albeit never used them on a T430 but only on T60 and
> T61. Maybe they can provide some insight?
>
> Please have a look here:
>
> https://github.com/wmlive/ultrabay-scripts
>
> Ready made packages for Debian can be fetched from here:
>
> http://wmlive.rumbero.org/repo/

This is great!  Thanks for taking the time to maintain and package
these scripts.  Have you considered/attempted to get the package into
the official repositories?  It would be great to see it more widely
available.

If I may make one suggestion:  I'd prefer tp-smapi-dkms as a
Recommends rather than Depends, since it's not useful on the T430 and
so that I don't have to install dkms and kernel headers which I'm not
using.  But otherwise the packaging and repository worked very well.

After playing with the scripts a bit, I'm still not having any luck
getting an automatic undock and I'm a bit confused about how the
scripts are supposed to work.  It looks like the udev rules listen
for

    ENV{EVENT}=="undock", KERNEL=="dock.1", ACTION=="change",
        SUBSYSTEM=="platform", ATTR{type}=="ata_bay"

rather than

    ENV{BAY_EVENT}=="3", ACTION=="change", SUBSYSTEM=="scsi"

My understanding was that BAY_EVENT 0x3 is EJECT_REQUEST (user
request, via switch/button) while the undock event is fired once the
device has been removed from the dock, at which point it is too late
to unmount filesystems and prepare for undocking.  In testing it just
now, it appears that the undock event is fired in response to

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

at which point the drive is disconnected.  So it appears to be
necessary to call ultrabay_eject to initiate the undocking, but then
why would it be called again as a RUN script?  Perhaps I'm confused?

However, I did find this rule to be instructive:

    SUBSYSTEMS=="block", DEVPATH=="/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0",
        ENV{UDISKS_SYSTEM_INTERNAL}="0"

Unfortunately, it looks like support for the UDISKS_SYSTEM_INTERNAL
property was removed in udisks 1.90 and later.[1]  I can't find any
discussion about the reason, and the original bug[2] was not reopened,
so I'm not sure how to interpret it.

Thanks again for your efforts on making this less painful, they are
appreciated!

Kevin

1.  http://cgit.freedesktop.org/udisks/commit/?id=5de2f4381b5d2b1d76a9ea31b28b86e7ead43599
2.  https://bugs.freedesktop.org/show_bug.cgi?id=22879


--
Kevin Locke  |  [hidden email]    | XMPP: [hidden email]
             |  https://kevinlocke.name  | IRC:   kevinoid on freenode
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
Reply | Threaded
Open this post in threaded view
|

Re: T430 Ultrabay hotswap EJECT_REQUEST event

Paul Seelig-3
On 12/16/2015 10:16 AM, Kevin Locke wrote:
> these scripts.  Have you considered/attempted to get the package into
> the official repositories?  It would be great to see it more widely
> available.
>
I only recently set up the github repository in the hope to have someone
else take a look and possibly help making that stuff better than i am
able to.

While I used to be an official Debian package maintainer in a former
life, it would need someone else to contribute an official package.

I maintain my own Debian spin named 'Window Maker Live' and, as time
permits, i am currently trying to separate out all the scripts i once
wrote for it as separate projects and packages. See wmlive.sf.net for
more details.

> If I may make one suggestion:  I'd prefer tp-smapi-dkms as a
> Recommends rather than Depends,
>
Done.

Now let me analyse the remainder of your message. Stay tuned!

Regards,
Paul
--
The linux-thinkpad mailing list home page is at:
http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad