diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2009-01-10 18:01:00 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2009-01-10 18:01:00 +0000 |
commit | 932ba32ffa8d09ad85b44c4b77fde39c16a5c679 (patch) | |
tree | 65a77324204e778fb2a468416f3360581e6a48ff /sys/arch/macppc/dev | |
parent | c2006b615cdfd70352e28e50f7a94af153dc5177 (diff) |
Add support for the volume buttons and for the eject button found
on apple laptops.
The eject button will only eject the disc when it's not used by
anything.
ok miod@
Diffstat (limited to 'sys/arch/macppc/dev')
-rw-r--r-- | sys/arch/macppc/dev/abtn.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/sys/arch/macppc/dev/abtn.c b/sys/arch/macppc/dev/abtn.c index 37e0c77dc70..6b021e0d5b6 100644 --- a/sys/arch/macppc/dev/abtn.c +++ b/sys/arch/macppc/dev/abtn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abtn.c,v 1.11 2006/01/18 23:21:17 miod Exp $ */ +/* $OpenBSD: abtn.c,v 1.12 2009/01/10 18:00:59 robert Exp $ */ /* $NetBSD: abtn.c,v 1.1 1999/07/12 17:48:26 tsubai Exp $ */ /*- @@ -31,6 +31,7 @@ #include <sys/param.h> #include <sys/device.h> #include <sys/systm.h> +#include <sys/workq.h> #include <machine/bus.h> @@ -39,6 +40,10 @@ #include <dev/adb/adb.h> +#include "audio.h" +#include "cd.h" +#include "wskbd.h" + #define ABTN_HANDLER_ID 31 struct abtn_softc { @@ -53,6 +58,13 @@ int abtn_match(struct device *, void *, void *); void abtn_attach(struct device *, struct device *, void *); void abtn_adbcomplete(caddr_t, caddr_t, int); +#if NWSKBD > 0 +extern int cd_eject(void); +#if NAUDIO > 0 +extern int wskbd_set_mixervolume(long dir); +#endif +#endif + struct cfattach abtn_ca = { sizeof(struct abtn_softc), abtn_match, abtn_attach }; @@ -112,32 +124,40 @@ abtn_adbcomplete(caddr_t buffer, caddr_t data, int adb_command) of_setbrightness(brightness); break; -#ifdef DEBUG +#if NAUDIO > 0 && NWSKBD > 0 case 0x08: /* mute */ case 0x01: /* mute, AV hardware */ + workq_add_task(NULL, 0, (workq_fn)wskbd_set_mixervolume, + (void *)(long)0, NULL); + break; case 0x07: /* decrease volume */ case 0x02: /* decrease volume, AV hardware */ + workq_add_task(NULL, 0, (workq_fn)wskbd_set_mixervolume, + (void *)(long)-1, NULL); + break; case 0x06: /* increase volume */ case 0x03: /* increase volume, AV hardware */ - /* Need callback to do something with these */ + workq_add_task(NULL, 0, (workq_fn)wskbd_set_mixervolume, + (void *)(long)1, NULL); break; - +#endif case 0x0c: /* mirror display key */ /* Need callback to do something with this */ break; - +#if NWSKBD > 0 && NCD > 0 case 0x0b: /* eject tray */ - /* Need callback to do something with this */ + workq_add_task(NULL, 0, (workq_fn)cd_eject, NULL, NULL); break; - +#endif case 0x7f: /* numlock */ /* Need callback to do something with this */ break; default: +#ifdef DEBUG if ((cmd & ~0x7f) == 0) printf("unknown ADB button 0x%x\n", cmd); - break; #endif + break; } } |