From: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>
To: "linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: [PATCH] Eject button handling in quickstart driver
Date: Wed, 07 Mar 2012 15:02:47 +0100 [thread overview]
Message-ID: <4F576A87.1080401@ts.fujitsu.com> (raw)
Background: Fujitsu is releasing currently small desktop systems like the
ESPRIMO Q510 that have no direct accessible eject button for the optical drive.
http://www.fujitsu.com/fts/products/computing/pc/desktops/all-round/esprimo-q510/index.html
Instead of an eject button on the drive the system has a button on the
mainboard that will send a notify event to the assigned device using the
following ACPI code:
Scope(\_GPE)
{
Method(_L15, 0) // ODD Eject GPIO handler
{
Notify(\_SB.ODDE, 0x80) // Notify a ODD Eject Button event
to the OS
}
} //Scope(\_GPE)
Scope(\_SB)
{
//
// Direct Application Launch Button definition used for Windows Vista, Windows 7, Linux ...
//
Device(ODDE) // Eject Button Device
{
Name(_HID, EISAID("PNP0C32")) // HID ACPI button device
Name(_UID, 1) // Unique instance # of that device
Name(_STA, 0x0F) // Device is working properly
Method(GHID, 0) // Button "role" method
{
Return(Buffer(){1}) // Application Launch Button role
}
}
Matthew Garrett advised me that there is a quickstart driver in staging that
was designed to handle the PNP0C32 devices. I had a look at it and it needed
patching for my purpose because
- the driver only reports the pressed button on wakeup events, but in
my case it should report the pressure of the "Optical Disc Drive Eject"
button during runtime.
- The driver was generating character input events when I pressed the button
during runtime, resulting in the funny question of the bash open if I want
to see all possible completions.
So I made a minor change to this driver to handle my "ODDE" button event as I want
it and to be minimal intrusive to the remaining functionality.
Of course this needs a small "daemon like skript" that polls the pressed_button file
frequently and initiates the eject command if the button is pressed. This one
(modified from the Sourceforge quickstart download) works:
#!/bin/bash
#
# Sample application launcher.
# Angelo Arrifano <miknix@gmail.com>
# http://quickstart.sourceforge.net
#
# Put this script on ~/.config/autostart.
#
# Add your button actions here
LAUNCH["ODDE"]="eject /dev/sr0"
# The sysfs file telling which button was pressed
PRESSEDFILE="/sys/devices/platform/quickstart/pressed_button"
if [[ ! -e "$PRESSEDFILE" ]]; then
exit 1
fi
while (true) do
PRESSEDBUTTON="$(cat "$PRESSEDFILE")"
if [[ "$PRESSEDBUTTON" != "none" ]]; then
${LAUNCH[$PRESSEDBUTTON]};
echo -n "none" > "$PRESSEDFILE"
fi
sleep 1;
done
# End of script
Signed-off-by: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>
---
--- upstream/drivers/staging/quickstart/quickstart.c 2012-03-07 14:32:37.000000000 +0100
+++ new/drivers/staging/quickstart/quickstart.c 2012-03-07 14:50:36.000000000 +0100
@@ -223,10 +223,16 @@
if (event == QUICKSTART_EVENT_WAKE)
quickstart_data.pressed = quickstart->btn;
else if (event == QUICKSTART_EVENT_RUNTIME) {
- input_report_key(quickstart_input, quickstart->btn->id, 1);
- input_sync(quickstart_input);
- input_report_key(quickstart_input, quickstart->btn->id, 0);
- input_sync(quickstart_input);
+ if (strncasecmp(quickstart->btn->name, "ODDE", 4) == 0) {
+ /* ODDE is Optical Disc Drive Eject */
+ quickstart_data.pressed = quickstart->btn;
+ }
+ else {
+ input_report_key(quickstart_input, quickstart->btn->id, 1);
+ input_sync(quickstart_input);
+ input_report_key(quickstart_input, quickstart->btn->id, 0);
+ input_sync(quickstart_input);
+ }
}
return;
}
--
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE
Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany
Telephone: +49-821-804-3321
Telefax: +49-821-804-2131
Mail: mailto:Rainer.Koenig@ts.fujitsu.com
Internet ts.fujtsu.com
Company Details ts.fujitsu.com/imprint.html
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2012-03-07 14:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-07 14:02 Rainer Koenig [this message]
2012-03-07 14:31 ` [PATCH] Eject button handling in quickstart driver Corentin Chary
2012-03-07 15:21 ` Matthew Garrett
2012-03-08 13:16 ` Rainer Koenig
2012-03-08 13:56 ` Matthew Garrett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F576A87.1080401@ts.fujitsu.com \
--to=rainer.koenig@ts.fujitsu.com \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.