hpqlb(4): driver for HP Quick Launch buttons - found on HP Pavilion Notebooks
This commit is contained in:
parent
82a9123f59
commit
d9b775927c
@ -1,4 +1,4 @@
|
||||
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1050 $>
|
||||
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1051 $>
|
||||
|
||||
|
||||
[Note: This file does not mention every change made to the NetBSD source tree.
|
||||
@ -519,3 +519,4 @@ Changes from NetBSD 4.0 to NetBSD 5.0:
|
||||
tests: Convert the tests in the tests/ hierarchy that were written in
|
||||
C++ to C, making use of the libatf-c library that comes with
|
||||
the ATF 0.5 just imported. [jmmv 20080501]
|
||||
hpqlb(4): Hotkey driver for HP notebooks. [cegger 20080501]
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.463 2008/04/22 22:37:13 cegger Exp $
|
||||
# $NetBSD: Makefile,v 1.464 2008/05/01 20:18:19 cegger Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/18/93
|
||||
|
||||
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 adbbt.4 adbkbd.4 adbms.4 \
|
||||
@ -21,7 +21,7 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 adbbt.4 adbkbd.4 adbms.4 \
|
||||
esa.4 esiop.4 esl.4 esm.4 eso.4 etherip.4 exphy.4 fast_ipsec.4 fd.4 \
|
||||
finsio.4 fpa.4 fms.4 fss.4 fxp.4 gem.4 genfb.4 gentbi.4 \
|
||||
glxtphy.4 gpib.4 gpio.4 gre.4 gphyter.4 gsip.4 hifn.4 hme.4 \
|
||||
hptide.4 ichlpcib.4 ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \
|
||||
hpqlb.4 hptide.4 ichlpcib.4 ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \
|
||||
ifmedia.4 igsfb.4 iha.4 inet.4 ikphy.4 inphy.4 intersil7170.4 \
|
||||
ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipmi.4 ipw.4 \
|
||||
iso.4 isp.4 isv.4 itesio.4 iteide.4 iwi.4 ixpide.4 jmide.4 joy.4 kloader.4 kse.4 \
|
||||
|
77
share/man/man4/hpqlb.4
Normal file
77
share/man/man4/hpqlb.4
Normal file
@ -0,0 +1,77 @@
|
||||
.\" $NetBSD: hpqlb.4,v 1.1 2008/05/01 20:18:19 cegger Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2008 Christoph Egger <cegger@netbsd.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd May 01, 2008
|
||||
.Dt HPQLB 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm hpqlb
|
||||
.Nd HP Quick Launch Buttons
|
||||
.Sh SYNOPSIS
|
||||
.Cd "hpqlb* at acpi?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Tn HP
|
||||
Pavilion notebook computers come with hotkeys supported by this driver.
|
||||
These hotkeys generate keycodes apart some of them.
|
||||
The
|
||||
.Nm
|
||||
driver provides support all hotkeys generating keycodes including the
|
||||
those on the HP Remote control device.
|
||||
.Pp
|
||||
The following hotkeys which do not generate keycodes are:
|
||||
.Pp
|
||||
.Bl -bullet -compact -offset indent
|
||||
.It
|
||||
Display Switch
|
||||
.It
|
||||
Brightness Up
|
||||
.It
|
||||
Brightness Down
|
||||
.El
|
||||
.Pp
|
||||
Additionally on the remote control do not generate keycodes are:
|
||||
.Pp
|
||||
.Bl -bullet -compact -offset indent
|
||||
.It
|
||||
HP Quick button
|
||||
.It
|
||||
HP DVD button
|
||||
.It
|
||||
Windows button
|
||||
.El
|
||||
.Pp
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr acpi 4
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver
|
||||
appeared in
|
||||
.Nx 5.0 .
|
||||
.Sh AUTHORS
|
||||
This driver was written for NetBSD by Christoph Egger.
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.207 2008/04/30 22:08:18 ad Exp $
|
||||
# $NetBSD: GENERIC,v 1.208 2008/05/01 20:18:18 cegger Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.207 $"
|
||||
#ident "GENERIC-$Revision: 1.208 $"
|
||||
|
||||
maxusers 64 # estimated number of users
|
||||
|
||||
@ -279,6 +279,7 @@ asus* at acpi? # ASUS hotkeys
|
||||
attimer* at acpi? # AT Timer
|
||||
#com* at acpi? # Serial communications interface
|
||||
#fdc* at acpi? # Floppy disk controller
|
||||
hpqlb* at acpi? # HP Quick Launch Buttons
|
||||
hpet* at acpi? # High Precision Event Timer
|
||||
joy* at acpi? # Joystick/Game port
|
||||
#lpt* at acpi? # Parallel port
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: XEN3_DOM0,v 1.15 2008/04/21 20:20:12 cegger Exp $
|
||||
# $NetBSD: XEN3_DOM0,v 1.16 2008/05/01 20:18:18 cegger Exp $
|
||||
|
||||
include "arch/amd64/conf/std.xen"
|
||||
|
||||
@ -216,6 +216,7 @@ acpibut* at acpi? # ACPI Button
|
||||
acpiec* at acpi? # ACPI Embedded Controller
|
||||
acpilid* at acpi? # ACPI Lid Switch
|
||||
acpitz* at acpi? # ACPI Thermal Zone
|
||||
hpqlb* at acpi? # HP Quick Launch Buttons
|
||||
|
||||
# PCI bus support
|
||||
pci* at hypervisor? bus ?
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: ALL,v 1.169 2008/04/30 15:29:11 ad Exp $
|
||||
# $NetBSD: ALL,v 1.170 2008/05/01 20:18:18 cegger Exp $
|
||||
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
|
||||
#
|
||||
# ALL machine description file
|
||||
@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "ALL-$Revision: 1.169 $"
|
||||
#ident "ALL-$Revision: 1.170 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -357,6 +357,7 @@ asus* at acpi? # ASUS hotkeys
|
||||
attimer* at acpi? # AT Timer
|
||||
com* at acpi? # Serial communications interface
|
||||
fdc* at acpi? # Floppy disk controller
|
||||
hpqlb* at acpi? # HP Quick Launch Buttons
|
||||
hpet* at acpi? # High Precision Event Timer
|
||||
joy* at acpi? # Joystick/Game port
|
||||
lpt* at acpi? # Parallel port
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.891 2008/04/30 15:29:11 ad Exp $
|
||||
# $NetBSD: GENERIC,v 1.892 2008/05/01 20:18:18 cegger Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.891 $"
|
||||
#ident "GENERIC-$Revision: 1.892 $"
|
||||
|
||||
maxusers 64 # estimated number of users
|
||||
|
||||
@ -360,6 +360,7 @@ asus* at acpi? # ASUS hotkeys
|
||||
attimer* at acpi? # AT Timer
|
||||
#com* at acpi? # Serial communications interface
|
||||
#fdc* at acpi? # Floppy disk controller
|
||||
hpqlb* at acpi? # HP Quick Launch Buttons
|
||||
hpet* at acpi? # High Precision Event Timer
|
||||
joy* at acpi? # Joystick/Game port
|
||||
#lpt* at acpi? # Parallel port
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: XEN3_DOM0,v 1.8 2008/01/07 08:39:07 martti Exp $
|
||||
# $NetBSD: XEN3_DOM0,v 1.9 2008/05/01 20:18:18 cegger Exp $
|
||||
#
|
||||
# XEN3_0: Xen 3.0 domain0 kernel
|
||||
|
||||
@ -35,6 +35,7 @@ acpibut* at acpi? # ACPI Button
|
||||
acpiec* at acpi? # ACPI Embedded Controller (late binding)
|
||||
acpiecdt* at acpi? # ACPI Embedded Controller (early binding)
|
||||
acpilid* at acpi? # ACPI Lid Switch
|
||||
|
||||
hpqlb* at acpi? # HP Quick Launch Buttons
|
||||
|
||||
pseudo-device xvif
|
||||
pseudo-device xbdback
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.acpi,v 1.50 2008/03/31 15:17:21 jmcneill Exp $
|
||||
# $NetBSD: files.acpi,v 1.51 2008/05/01 20:18:19 cegger Exp $
|
||||
|
||||
include "dev/acpi/acpica/files.acpica"
|
||||
|
||||
@ -122,6 +122,11 @@ file dev/acpi/asus_acpi.c asus
|
||||
attach ug at acpinodebus with ug_acpi
|
||||
file dev/acpi/ug_acpi.c ug_acpi
|
||||
|
||||
# HP Quick Launch Buttons
|
||||
device hpqlb: sysmon_power
|
||||
attach hpqlb at acpinodebus
|
||||
file dev/acpi/hpqlb_acpi.c hpqlb
|
||||
|
||||
# Sony Notebook Controller (brightness, hotkeys, etc.)
|
||||
device sony: displaydev
|
||||
attach sony at acpinodebus with sony_acpi
|
||||
|
288
sys/dev/acpi/hpqlb_acpi.c
Normal file
288
sys/dev/acpi/hpqlb_acpi.c
Normal file
@ -0,0 +1,288 @@
|
||||
/* $NetBSD: hpqlb_acpi.c,v 1.1 2008/05/01 20:18:19 cegger Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 Christoph Egger <cegger@netbsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hpqlb_acpi.c,v 1.1 2008/05/01 20:18:19 cegger Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/pmf.h>
|
||||
|
||||
#include <dev/acpi/acpivar.h>
|
||||
|
||||
#include <machine/pio.h>
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
#include <dev/wscons/wskbdvar.h>
|
||||
#include <dev/isa/isareg.h>
|
||||
|
||||
#ifdef HPQLB_DEBUG
|
||||
#define DPRINTF(x) do { printf x; } while (/* CONSTCOND */0)
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#endif
|
||||
|
||||
struct hpqlb_softc {
|
||||
device_t sc_dev;
|
||||
struct acpi_devnode *sc_node;
|
||||
|
||||
device_t sc_wskbddev;
|
||||
|
||||
#define HP_PSW_DISPLAY_CYCLE 0
|
||||
#define HP_PSW_BRIGHTNESS_UP 1
|
||||
#define HP_PSW_BRIGHTNESS_DOWN 2
|
||||
#define HP_PSW_SLEEP 3
|
||||
#define HP_PSW_LAST 4
|
||||
struct sysmon_pswitch sc_smpsw[HP_PSW_LAST];
|
||||
bool sc_smpsw_displaycycle_valid;
|
||||
bool sc_smpsw_sleep_valid;
|
||||
};
|
||||
|
||||
#define HP_QLB_Quick 0x88
|
||||
#define HP_QLB_DVD 0x8e
|
||||
#define HP_QLB_FullBackward 0x90
|
||||
#define HP_QLB_Play 0xa2
|
||||
#define HP_QLB_FullForward 0x99
|
||||
#define HP_QLB_Stop 0xa4
|
||||
#define HP_QLB_VolumeMute 0xa0
|
||||
#define HP_QLB_VolumeDown 0xae
|
||||
#define HP_QLB_VolumeUp 0xb0
|
||||
|
||||
#define HP_QLB_Help 0xb1
|
||||
#define HP_QLB_WWW 0xb2
|
||||
#define HP_QLB_DisplayCycle /* ??? */
|
||||
#define HP_QLB_Sleep 0xdf
|
||||
#define HP_QLB_Lock 0x8a
|
||||
#define HP_QLB_BrightnessDown /* ??? */
|
||||
#define HP_QLB_BrightnessUp /* ??? */
|
||||
#define HP_QLB_ChasisOpen 0xe3
|
||||
|
||||
static int hpqlb_match(device_t, cfdata_t, void *);
|
||||
static void hpqlb_attach(device_t, device_t, void *);
|
||||
|
||||
static int hpqlb_finalize(device_t);
|
||||
static int hpqlb_hotkey_handler(struct wskbd_softc *, void *, u_int, int);
|
||||
|
||||
static void hpqlb_init(device_t);
|
||||
static bool hpqlb_resume(device_t PMF_FN_PROTO);
|
||||
|
||||
CFATTACH_DECL_NEW(hpqlb, sizeof(struct hpqlb_softc),
|
||||
hpqlb_match, hpqlb_attach, NULL, NULL);
|
||||
|
||||
static const char * const hpqlb_ids[] = {
|
||||
"HPQ0006",
|
||||
"HPQ0007",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int
|
||||
hpqlb_match(device_t parent, cfdata_t match, void *opaque)
|
||||
{
|
||||
struct acpi_attach_args *aa = opaque;
|
||||
|
||||
if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
|
||||
return 0;
|
||||
|
||||
return acpi_match_hid(aa->aa_node->ad_devinfo, hpqlb_ids);
|
||||
}
|
||||
|
||||
static void
|
||||
hpqlb_attach(device_t parent, device_t self, void *opaque)
|
||||
{
|
||||
struct hpqlb_softc *sc = device_private(self);
|
||||
struct acpi_attach_args *aa = opaque;
|
||||
|
||||
sc->sc_node = aa->aa_node;
|
||||
sc->sc_dev = self;
|
||||
|
||||
aprint_naive("\n");
|
||||
aprint_normal(": HP Quick Launch Buttons\n");
|
||||
|
||||
hpqlb_init(self);
|
||||
|
||||
if (config_finalize_register(self, hpqlb_finalize) != 0)
|
||||
aprint_error_dev(self,
|
||||
"WARNING: unable to register hpqlb finalizer\n");
|
||||
|
||||
sc->sc_smpsw_displaycycle_valid = true;
|
||||
sc->sc_smpsw[HP_PSW_DISPLAY_CYCLE].smpsw_name =
|
||||
PSWITCH_HK_DISPLAY_CYCLE;
|
||||
sc->sc_smpsw[HP_PSW_DISPLAY_CYCLE].smpsw_type =
|
||||
PSWITCH_TYPE_HOTKEY;
|
||||
if (sysmon_pswitch_register(&sc->sc_smpsw[HP_PSW_DISPLAY_CYCLE])) {
|
||||
aprint_error_dev(self, "couldn't register with sysmon\n");
|
||||
sc->sc_smpsw_displaycycle_valid = false;
|
||||
}
|
||||
|
||||
sc->sc_smpsw_sleep_valid = true;
|
||||
sc->sc_smpsw[HP_PSW_SLEEP].smpsw_name = device_xname(self);
|
||||
sc->sc_smpsw[HP_PSW_SLEEP].smpsw_type = PSWITCH_TYPE_SLEEP;
|
||||
if (sysmon_pswitch_register(&sc->sc_smpsw[HP_PSW_SLEEP])) {
|
||||
aprint_error_dev(self, "couldn't register sleep with sysmon\n");
|
||||
sc->sc_smpsw_sleep_valid = false;
|
||||
}
|
||||
|
||||
if (!pmf_device_register(self, NULL, hpqlb_resume))
|
||||
aprint_error_dev(self, "couldn't establish power handler\n");
|
||||
}
|
||||
|
||||
static int
|
||||
hpqlb_hotkey_handler(struct wskbd_softc *wskbd_sc, void *cookie,
|
||||
u_int type, int value)
|
||||
{
|
||||
struct hpqlb_softc *sc = cookie;
|
||||
int ret = 1;
|
||||
|
||||
switch (value) {
|
||||
case HP_QLB_VolumeMute:
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
pmf_event_inject(NULL, PMFE_AUDIO_VOLUME_TOGGLE);
|
||||
break;
|
||||
case HP_QLB_VolumeDown:
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
pmf_event_inject(NULL, PMFE_AUDIO_VOLUME_DOWN);
|
||||
break;
|
||||
case HP_QLB_VolumeUp:
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
pmf_event_inject(NULL, PMFE_AUDIO_VOLUME_UP);
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case HP_QLB_DisplayCycle: /* ??? */
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
if (sc->sc_smpsw_displaycycle_valid == false)
|
||||
break;
|
||||
sysmon_pswitch_event(&sc->sc_smpsw[HP_PSW_DISPLAY_CYCLE],
|
||||
PSWITCH_EVENT_PRESSED);
|
||||
break;
|
||||
#endif
|
||||
case HP_QLB_Sleep:
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
if (sc->sc_smpsw_sleep_valid == false) {
|
||||
DPRINTF(("%s: Sleep hotkey\n", device_xname(sc->sc_dev)));
|
||||
break;
|
||||
}
|
||||
sysmon_pswitch_event(&sc->sc_smpsw[HP_PSW_SLEEP],
|
||||
PSWITCH_EVENT_PRESSED);
|
||||
break;
|
||||
#if 0
|
||||
case HP_QLB_BrightnessDown: /* ??? */
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
pmf_event_inject(NULL, PMFE_DISPLAY_BRIGHTNESS_DOWN);
|
||||
break;
|
||||
case HP_QLB_BrightnessUp: /* ??? */
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
pmf_event_inject(NULL, PMFE_DISPLAY_BRIGHTNESS_UP);
|
||||
break;
|
||||
#endif
|
||||
case HP_QLB_ChasisOpen:
|
||||
if (type != WSCONS_EVENT_KEY_DOWN)
|
||||
break;
|
||||
pmf_event_inject(NULL, PMFE_CHASSIS_LID_OPEN);
|
||||
break;
|
||||
default:
|
||||
DPRINTF(("%s: unknown hotkey 0x%02x\n",
|
||||
device_xname(sc->sc_dev), value));
|
||||
ret = 0; /* Assume, this is no hotkey */
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
hpqlb_init(device_t self)
|
||||
{
|
||||
/* HPQ0006: HP Quick Launch Buttons */
|
||||
/* HPQ0007: HP Remote Device */
|
||||
/* val 0, 1 or 7 == HPQ0006 */
|
||||
/* val not 0, 1 or 7 == HPQ0007 */
|
||||
|
||||
/* Turn on Quick Launch Buttons */
|
||||
outb(IO_RTC+2, 0xaf);
|
||||
outb(IO_RTC+3, 7 /* val */);
|
||||
}
|
||||
|
||||
static int
|
||||
hpqlb_finalize(device_t self)
|
||||
{
|
||||
device_t dv;
|
||||
struct hpqlb_softc *sc = device_private(self);
|
||||
static int done_once = 0;
|
||||
|
||||
/* Since we only handle real hardware, we only need to be
|
||||
* called once.
|
||||
*/
|
||||
if (done_once)
|
||||
return 0;
|
||||
done_once = 1;
|
||||
|
||||
TAILQ_FOREACH(dv, &alldevs, dv_list) {
|
||||
if (!device_is_a(dv, "wskbd"))
|
||||
continue;
|
||||
|
||||
/* Make sure, we don't get a wskbd from a USB keyboard.
|
||||
* QLB only works on the wskbd attached on pckbd. */
|
||||
if (!device_is_a(device_parent(dv), "pckbd"))
|
||||
continue;
|
||||
|
||||
aprint_normal_dev(self, "registering on %s\n",
|
||||
device_xname(dv));
|
||||
break;
|
||||
}
|
||||
|
||||
if (dv == NULL) {
|
||||
aprint_error_dev(self, "WARNING: no matching wskbd found\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
sc->sc_wskbddev = dv;
|
||||
|
||||
wskbd_hotkey_register(sc->sc_wskbddev, sc, hpqlb_hotkey_handler);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
hpqlb_resume(device_t self PMF_FN_ARGS)
|
||||
{
|
||||
hpqlb_init(self);
|
||||
|
||||
return true;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wskbd.c,v 1.117 2008/04/27 05:15:45 cegger Exp $ */
|
||||
/* $NetBSD: wskbd.c,v 1.118 2008/05/01 20:18:19 cegger Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
||||
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.117 2008/04/27 05:15:45 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.118 2008/05/01 20:18:19 cegger Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
@ -178,6 +178,9 @@ struct wskbd_softc {
|
||||
|
||||
int sc_refcnt;
|
||||
u_char sc_dying; /* device is being detached */
|
||||
|
||||
wskbd_hotkey_plugin *sc_hotkey;
|
||||
void *sc_hotkeycookie;
|
||||
};
|
||||
|
||||
#define MOD_SHIFT_L (1 << 0)
|
||||
@ -387,6 +390,8 @@ wskbd_attach(device_t parent, device_t self, void *aux)
|
||||
|
||||
sc->sc_base.me_dv = self;
|
||||
sc->sc_isconsole = ap->console;
|
||||
sc->sc_hotkey = NULL;
|
||||
sc->sc_hotkeycookie = NULL;
|
||||
|
||||
#if NWSMUX > 0 || NWSDISPLAY > 0
|
||||
sc->sc_base.me_ops = &wskbd_srcops;
|
||||
@ -1613,6 +1618,16 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym,
|
||||
return (0);
|
||||
}
|
||||
|
||||
device_t
|
||||
wskbd_hotkey_register(device_t self, void *cookie, wskbd_hotkey_plugin *hotkey)
|
||||
{
|
||||
struct wskbd_softc *sc = device_private(self);
|
||||
|
||||
sc->sc_hotkey = hotkey;
|
||||
sc->sc_hotkeycookie = cookie;
|
||||
return sc->sc_base.me_dv;
|
||||
}
|
||||
|
||||
static int
|
||||
wskbd_translate(struct wskbd_internal *id, u_int type, int value)
|
||||
{
|
||||
@ -1620,6 +1635,7 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
|
||||
keysym_t ksym, res, *group;
|
||||
struct wscons_keymap kpbuf, *kp;
|
||||
int iscommand = 0;
|
||||
int ishotkey = 0;
|
||||
|
||||
if (type == WSCONS_EVENT_ALL_KEYS_UP) {
|
||||
id->t_modifiers &= ~(MOD_SHIFT_L | MOD_SHIFT_R
|
||||
@ -1632,10 +1648,16 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
|
||||
}
|
||||
|
||||
if (sc != NULL) {
|
||||
if (sc->sc_hotkey != NULL)
|
||||
ishotkey = sc->sc_hotkey(sc, sc->sc_hotkeycookie,
|
||||
type, value);
|
||||
if (ishotkey)
|
||||
return 0;
|
||||
|
||||
if (value < 0 || value >= sc->sc_maplen) {
|
||||
#ifdef DEBUG
|
||||
printf("wskbd_translate: keycode %d out of range\n",
|
||||
value);
|
||||
printf("%s: keycode %d out of range\n",
|
||||
__func__, value);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wskbdvar.h,v 1.15 2008/03/25 00:49:20 cube Exp $ */
|
||||
/* $NetBSD: wskbdvar.h,v 1.16 2008/05/01 20:18:19 cegger Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
||||
@ -92,6 +92,15 @@ void wskbd_input(device_t, u_int, int);
|
||||
/* for WSDISPLAY_COMPAT_RAWKBD */
|
||||
void wskbd_rawinput(device_t, u_char *, int);
|
||||
|
||||
/*
|
||||
* Callbacks for (ACPI) hotkey drivers which generate
|
||||
* keycodes.
|
||||
*/
|
||||
struct wskbd_softc;
|
||||
typedef int (wskbd_hotkey_plugin)(struct wskbd_softc *, void *, u_int, int);
|
||||
|
||||
device_t wskbd_hotkey_register(device_t, void *, wskbd_hotkey_plugin *);
|
||||
|
||||
/*
|
||||
* Console interface.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user