Skip to contentSkip to conversation

*NEW* ACPI driver to support App Hot Startup AKA PNP0C32

DISCUSSION Ângelo Miguel Arrifano 3 participants 9 messages Nov 10, 2007 – Jun 22, 2009 3 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everyone,

I made a driver to allow booting into specific apps by pressing hot buttons. This functionality is provided by PNP0C32 which all Vista capable laptops should have.

If the laptop is turned off and a hot button is pressed, the computer turns on and boots. This module gets a notification from ACPI which button was pressed. Then the driver writes to the proc fs which button was pressed allowing userspace apps to read that files and behave accordingly. Proc files are also writable.

Eg:
ls /proc/acpi/hotstart/
DBTN LVBN MUBN PIBN QBTN VOBN WEBN

DBTN is DVD Button
WEBN is WWW Button

I've uploaded everything to my personal server (very bandwidth limited).
http://miknix.homelinux.com/hotstart/

It's also attached here, just in case my ISP might do the usual...

I did only test on my own laptop.
I hope you like it.
- --
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
[email protected]
http://miknix.homelinux.com
PGP Pubkey online

- - -
Abstainer, n.:
A weak person who yields to the temptation of denying himself a pleasure.
-- Ambrose Bierce, "The Devil's Dictionary"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHNQ0NNahyoD2SuwsRAlvPAJ0XEB+iOVsHhZ6HsVQ+a2Jjqe9qfwCgnuO8 JOigajLDRR20vF8sNDeY2FY=
=Gwau
-----END PGP SIGNATURE-----

#1 lore raw

Ângelo,

Quoted 5 lines · On Saturday 10 November 2007 01:44:48 Ângelo Miguel Arrifano wrote:

If the laptop is turned off and a hot button is pressed, the computer turns on and boots. This module gets a notification from ACPI which button was pressed. Then the driver writes to the proc fs which button was pressed allowing userspace apps to read that files and behave accordingly. Proc files are also writable.

Please use sysfs, not proc (even if you aren't considering submitting this upstream) - /proc/acpi is deprecated and going away (slowly but surely).

-Carlos

Signature · 7 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 9 lines · On Sat, 10 Nov 2007 03:21:21 +0000 Carlos Corbacho…

Angelo,

Quoted 5 lines · On Saturday 10 November 2007 01:44:48 Angelo Miguel Arrifano wrote:

If the laptop is turned off and a hot button is pressed, the computer turns on and boots. This module gets a notification from ACPI which button was pressed. Then the driver writes to the proc fs which button was pressed allowing userspace apps to read that files and behave accordingly. Proc files are also writable.

Quoted 8 lines

Please use sysfs, not proc (even if you aren't considering submitting this upstream) - /proc/acpi is deprecated and going away (slowly but surely).

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D

Thanks! The driver is now using sysfs.
What should I do to submit the driver properly to upstream?

Best regards,
- --
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal Gentoo Linux AMD64 Arch Tester [email protected]
http://miknix.homelinux.com
PGP Pubkey online

- - -
Boys, you have ALL been selected to LEAVE th' PLANET in 15 minutes!! -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHN5jONahyoD2SuwsRAnz4AKDlpmU8geaaR27s/gXX1KaE3/CFMACg4i9B 842nLwYkmvcH9FlmydSngjU=
=UtSO
-----END PGP SIGNATURE-----

#3 lore raw

Angelo,

Quoted 2 lines · On Monday 12 November 2007 00:05:34 Ângelo Miguel Arrifano wrote:

Thanks! The driver is now using sysfs.
What should I do to submit the driver properly to upstream?

See http://www.lesswatts.org/projects/acpi/submitting-patches.php

and

http://www.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/README.ACPI

-Carlos

Signature · 7 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

Hello all,

I opened a SF.net project to support devices found under PNP0C32.
These devices are known as Direct App Launch Buttons and are used on Vista Hotstart(TM) technology. I believe most of Vista "ready" laptops have this.

The project aims to provide similar functionality to Vista Hotstart(TM) in linux. You can read more at http://quickstart.sourceforge.net/

Greetings,

Signature · 11 lines
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
[email protected]
http://miknix.homelinux.com
PGP Pubkey online

- -

Q: How many Chuck Norris' does it take to change a light bulb?
A: None, Chuck Norris prefers to kill in the dark. 
#5 lore raw

Re: *NEW* ACPI driver to support App Hot Startup AKA PNP0C32 - please apply

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 22 lines · On Fri, 23 Nov 2007 15:24:46 +0000 Ângelo Miguel Arrifano <[email protected]>…

Hello all,

I opened a SF.net project to support devices found under PNP0C32.
These devices are known as Direct App Launch Buttons and are used on Vista Hotstart(TM) technology. I believe most of Vista "ready" laptops have this.

The project aims to provide similar functionality to Vista Hotstart(TM) in linux. You can read more at http://quickstart.sourceforge.net/

Greetings,

Signature · 11 lines
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
[email protected]
http://miknix.homelinux.com
PGP Pubkey online

- -

Q: How many Chuck Norris' does it take to change a light bulb?
A: None, Chuck Norris prefers to kill in the dark. 

The project is running for some time now. During this time there were no reports of people getting it trouble with it.

Attached is the patch.

Thanks,
- --
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
Linwizard Developer
[email protected]
http://miknix.homelinux.com
PGP Pubkey 0x3D92BB0B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHkhUBNahyoD2SuwsRAn8gAJ4yj/kQl3RyAbBw3s9/2R04rEjFbQCfc1fC /HlHqqB8B9my/vP67QMWrBM=
=nVRr
-----END PGP SIGNATURE-----

drivers/acpi/Kconfig +8 -0
index 95588c2..4b80085 100644
@@ -195,6 +195,14 @@ config ACPI_THERMAL
 	  recommended that this option be enabled, as your processor(s)
 	  may be damaged without it.
 
+config ACPI_QUICKSTART
+	tristate "Quickstart"
+	default y
+	help
+	  This driver add support for ACPI Direct Application Launch
+	  also known as Hotstart(TM). Say yes here to have a entry in
+	  sysfs telling which button was used to turn on the system.
+
 config ACPI_NUMA
 	bool "NUMA support"
 	depends on NUMA
drivers/acpi/Makefile +1 -0
index 456446f..719506a 100644
@@ -61,3 +61,4 @@ obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)	+= acpi_memhotplug.o
 obj-$(CONFIG_ACPI_PROCFS_POWER)	+= cm_sbs.o
 obj-$(CONFIG_ACPI_SBS)		+= sbs.o
 obj-$(CONFIG_ACPI_SBS)		+= sbshc.o
+obj-$(CONFIG_ACPI_QUICKSTART)	+= quickstart.o
drivers/acpi/quickstart.c new file +418 -0

418 lines not on this page · raw message

#6 lore raw

RE: *NEW* ACPI driver to support App Hot Startup AKA PNP0C32 - please apply

Hi, Angelo,

For a typical ACPI device driver, it usually works like this:
1. Register the ACPI device driver is the module_init
2. Enable the device, create the sys I/F in the drivers .add method.
3. Remove the device I/F in .remove method.
4. unregister the ACPI device driver in module_exit.

With your patch applied, the sys I/F will be created even if no PNP0C32 device exists in the ACPI namespace. IMO, moving this piece of code to the .add method will be much better.

BTW: please don't send a patch as an attachment, it's difficult for review. :)

Thanks,
rui

Quoted 57 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of ?ngelo Miguel Arrifano
Sent: Saturday, January 19, 2008 11:19 PM
To: [email protected]
Cc: [email protected]
Subject: Re: *NEW* ACPI driver to support App Hot Startup AKA PNP0C32 - please apply

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · On Fri, 23 Nov 2007 15:24:46 +0000 Ângelo Miguel Arrifano <[email protected]>…

Hello all,

I opened a SF.net project to support devices found under PNP0C32. These devices are known as Direct App Launch Buttons and are used on Vista

Hotstart(TM) technology.

Quoted 3 lines

I believe most of Vista "ready" laptops have this.

The project aims to provide similar functionality to Vista Hotstart(TM) in

linux.

Quoted 11 lines

You can read more at http://quickstart.sourceforge.net/

Greetings,
--
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
[email protected]
http://miknix.homelinux.com
PGP Pubkey online

Quoted 4 lines

- -

Q: How many Chuck Norris' does it take to change a light bulb?
A: None, Chuck Norris prefers to kill in the dark.

The project is running for some time now. During this time there were no reports of people getting it trouble with it.

Attached is the patch.

Thanks,
- --
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
Linwizard Developer
[email protected]
http://miknix.homelinux.com
PGP Pubkey 0x3D92BB0B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

Quoted 4 lines

iD8DBQFHkhUBNahyoD2SuwsRAn8gAJ4yj/kQl3RyAbBw3s9/2R04rEjFbQCfc1fC /HlHqqB8B9my/vP67QMWrBM=
=nVRr
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: *NEW* ACPI driver to support App Hot Startup AKA PNP0C32 - please apply

As there is nothing private, add linux-acpi in the discussion. :)

Quoted 15 lines · Ângelo Miguel Arrifano
Quoted 9 lines · Rui

Hi, Angelo,

For a typical ACPI device driver, it usually works like this:
1. Register the ACPI device driver is the module_init
2. Enable the device, create the sys I/F in the drivers .add method.
3. Remove the device I/F in .remove method.
4. unregister the ACPI device driver in module_exit.

With your patch applied, the sys I/F will be created even if no

PNP0C32 device exists in the ACPI namespace. IMO, moving this piece of code to the .add method will be much better.

Quoted 7 lines

That's right, but the sys I/F being created are not in a per-device basis. I mean:

Suppose PNP0C32 has three devices:
ABTN
BBTN
CBTN

You mean three devces with _HID(PNP0C32), or three devices enumerated under a PNP0C32 device? could you please attach the acpidump output?

Quoted 6 lines

The sys files are created for PNP0C32 and not for every [ABC]BTN device.
So, moving the
sys I/F code into .add, AFAIK, will get the sys files created several times which is not
the purpose.

.add method is called for each PNP0C32 device,not for each button. so in this case, I think it will only create two sys files...

Quoted 16 lines

The sys files created are "buttons" and "pressed_button". "buttons" displays all devices (buttons) under PNP0C32 for, IMHO, easier enumeration by
userspace; instead of having a file for each device. "pressed_buttons" displays the button used to turn on/resume the computer.

But you are still right, the driver loads successfully (although displaying "none" on "buttons" sys file) when no PNP0C32 is present as we can see on this user post which doesn't have PNP0C32 at all:
http://sourceforge.net/forum/forum.php?thread_id=1959640&forum_id=754264

On the code below, shouldn't (status < 0) be true when no PNP0C32 is present?

Quoted 6 lines
        /* ACPI driver register */
        status = acpi_bus_register_driver(&quickstart_acpi_driver);
        if (status < 0)
                return -ENODEV;

This was supposed to exit with -ENODEV before creating sys I/F.

No, acpi_bus_register_driver returns 0 if no matched device is found, in order to support device hotplug.

thanks,
rui

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 823A93EED437D048963A3697DB0E35DE012DE3C1@pdsmsx414.ccr.corp.intel.com

#11 lore raw

Re: *NEW* ACPI driver to support App Hot Startup AKA PNP0C32 - please apply

Quoted 178 lines · Rui

Hah, I nearly missed this email.

Angelo,
Can you please re-send the refreshed patch so that I can add the comments in-line? Better kick off a new thread with the title like "[PATCH] ACPI: ..."

BTW: please don't send it as an attachment. :)

Thanks
rui

Quoted 167 lines

-----Original Message-----
From: Ângelo Miguel Arrifano [mailto:[email protected]]
Sent: Monday, March 10, 2008 8:36 PM
To: Zhang, Rui
Cc: linux-acpi
Subject: Re: *NEW* ACPI driver to support App Hot Startup AKA PNP0C32 - please apply

Quoted 1 line · Rui

As there is nothing private, add linux-acpi in the discussion. :)

Ah, sorry. I was distracted.

Quoted 19 lines · Ângelo Miguel Arrifano
Quoted 18 lines
Quoted 9 lines · Rui

Hi, Angelo,

For a typical ACPI device driver, it usually works like this:
1. Register the ACPI device driver is the module_init
2. Enable the device, create the sys I/F in the drivers .add method.
3. Remove the device I/F in .remove method.
4. unregister the ACPI device driver in module_exit.

With your patch applied, the sys I/F will be created even if no

PNP0C32 device exists in the ACPI namespace. IMO, moving this piece of code to the .add method will be much better.

That's right, but the sys I/F being created are not in a per-device basis. I mean:

Quoted 6 lines
Quoted 4 lines

Suppose PNP0C32 has three devices:
ABTN
BBTN
CBTN

You mean three devices with _HID(PNP0C32), or three devices enumerated under a PNP0C32 device? could you please attach the acpidump output?

(...)

Device (QBTN)

{
   Name (_HID, EisaId ("PNP0C32"))
   Name (_UID, 0x01)
   Method (_STA, 0, NotSerialized)
   {
	If (LEqual (OSYS, 0x07D6))
	{
	    Return (0x0F)
	}
	Else
	{
	    Return (0x00)
	}
   }

   Method (GHID, 0, NotSerialized)
   {
	If (LEqual (HOTB, 0x04))
	{
	    Notify (QBTN, 0x02)
	    Store (0x00, HOTB)
	}

	Return (Buffer (0x01)
	{
	    /* 0000 */    0x01
	})
   }
}

Device (DBTN)

{
   Name (_HID, EisaId ("PNP0C32"))
   Name (_UID, 0x02)
   Method (_STA, 0, NotSerialized)
   {
	If (LEqual (OSYS, 0x07D6))
	{
	    Return (0x0F)
	}
	Else
	{
	    Return (0x00)
	}
   }

   Method (GHID, 0, NotSerialized)
   {
	If (LEqual (HOTB, 0x05))
	{
	    Notify (DBTN, 0x02)
	    Store (0x00, HOTB)
	}

	Return (Buffer (0x01)
	{
	    /* 0000 */    0x02
	})
   }
}

(...)

So the devices above are those whose I was referring as buttons. The first one is the QuickPlay button the second DVD Button, etc..

Quoted 8 lines
Quoted 6 lines

The sys files are created for PNP0C32 and not for every [ABC]BTN device.
So, moving the
sys I/F code into .add, AFAIK, will get the sys files created several times which is not
the purpose.

.add method is called for each PNP0C32 device,not for each button. so in this case, I think it will only create two sys files...

Yeah, but PNP0C32 devices are the buttons.

Quoted 15 lines
Quoted 15 lines

The sys files created are "buttons" and "pressed_button". "buttons" displays all devices (buttons) under PNP0C32 for, IMHO, easier enumeration by
userspace; instead of having a file for each device. "pressed_buttons" displays the button used to turn on/resume the computer.

But you are still right, the driver loads successfully (although displaying "none" on "buttons" sys file) when no PNP0C32 is present as we can see on this user post which doesn't have PNP0C32 at all:
http://sourceforge.net/forum/forum.php?thread_id=1959640&forum_id=754264

On the code below, shouldn't (status < 0) be true when no PNP0C32 is present?

Quoted 8 lines
Quoted 6 lines
        /* ACPI driver register */
        status = acpi_bus_register_driver(&quickstart_acpi_driver);
        if (status < 0)
                return -ENODEV;

This was supposed to exit with -ENODEV before creating sys I/F.

No, acpi_bus_register_driver returns 0 if no matched device is found, in order to support device hotplug.

Hum.. Then this patch should prevent the module to load if no devices are present.

quickstart.c 2008-03-10 12:27:15.223132836 +0000 renamed from quickstart.c 2008-03-06 00:23:20.000000000 +0000 +1 -1
@@ -362,7 +362,7 @@ static int __init quickstart_init(void)
 
       /* ACPI driver register */
       status = acpi_bus_register_driver(&quickstart_acpi_driver);
-       if (status < 0)
+       if (!quickstart_data.btn_lst || status < 0)
               return -ENODEV;
 
       /* Platform driver register */
Quoted 4 lines

thanks,
rui

Best regards,
--
Angelo Arrifano AKA MiKNiX
CSE Student at UBI, Portugal
Gentoo Linux AMD64 Arch Tester
Linwizard Developer
http://miknix.homelinux.com
PGP Pubkey 0x3D92BB0B

Hello all,

I've been maintaining this driver, the latest tested tag is 2.6.28. However, I lost track of what is happening in the Linux ACPI tree. It seems it is moving towards ACPICA?

Is there any interest on including this small piece of code in the tree?

Best regards,

- Angelo Arrifano
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html