Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jun 2009 11:27:22 +0100
From:      Rui Paulo <rpaulo@freebsd.org>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson <thompsa@freebsd.org>
Subject:   Re: svn commit: r192925 - in head/sys/dev/usb: . input
Message-ID:  <5C52056B-8E4A-4C15-8451-2A5576A8FC9F@freebsd.org>
In-Reply-To: <200906010749.37072.hselasky@c2i.net>
References:  <200905271927.n4RJRUH8009289@svn.freebsd.org> <F9AEE3D3-B3D6-4606-9540-10C4517FA984@freebsd.org> <D080A753-D702-404B-9BFF-C7F44A185F2C@freebsd.org> <200906010749.37072.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--Apple-Mail-5--743129881
Content-Type: multipart/mixed; boundary=Apple-Mail-4--743129911


--Apple-Mail-4--743129911
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit

Hi,

On 1 Jun 2009, at 06:49, Hans Petter Selasky wrote:

> On Monday 01 June 2009, Rui Paulo wrote:
>> http://wiki.freebsd.org/AppleMacbook#head-7eab3730c3bf3d04bdfb0d1d3649eaddf
>> 2fed595
>
> Hi Rui Paulo,
>
> Regarding the eject button, can you have a look at:
>
> /sys/dev/usb/input/ukbd.c
>
> And provide a patch that masks this key the way you want?

I'm not sure what you mean. I'm proposing to remove the key handling  
code from the kernel. See the attached patch.

Thanks,
--
Rui Paulo

--Apple-Mail-4--743129911
Content-Disposition: attachment;
	filename=rem-eject.diff
Content-Type: application/octet-stream; x-unix-mode=0644; name="rem-eject.diff"
Content-Transfer-Encoding: 7bit

Index: input/ukbd.c
===================================================================
--- input/ukbd.c	(revision 193216)
+++ input/ukbd.c	(working copy)
@@ -127,7 +127,6 @@
 	keymap_t sc_keymap;
 	accentmap_t sc_accmap;
 	fkeytab_t sc_fkeymap[UKBD_NFKEY];
-	struct hid_location sc_loc_apple_eject;
 	struct hid_location sc_loc_apple_fn;
 	struct usb_callout sc_callout;
 	struct ukbd_data sc_ndata;
@@ -151,9 +150,8 @@
 #define	UKBD_FLAG_SET_LEDS	0x0004
 #define	UKBD_FLAG_ATTACHED	0x0010
 #define	UKBD_FLAG_GONE		0x0020
-#define	UKBD_FLAG_APPLE_EJECT	0x0040
-#define	UKBD_FLAG_APPLE_FN	0x0080
-#define	UKBD_FLAG_APPLE_SWAP	0x0100
+#define	UKBD_FLAG_APPLE_FN	0x0040
+#define	UKBD_FLAG_APPLE_SWAP	0x0080
 
 	int32_t	sc_mode;		/* input mode (K_XLATE,K_RAW,K_CODE) */
 	int32_t	sc_state;		/* shift/lock key state */
@@ -488,7 +486,6 @@
 	uint8_t offset;
 	uint8_t id;
 	uint8_t apple_fn;
-	uint8_t apple_eject;
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
@@ -521,13 +518,6 @@
 			usb2_copy_out(xfer->frbuffers, offset, 
 			    &sc->sc_ndata, len);
 
-			if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) &&
-			    hid_get_data((uint8_t *)&sc->sc_ndata,
-				len, &sc->sc_loc_apple_eject))
-				apple_eject = 1;
-			else
-				apple_eject = 0;
-
 			if ((sc->sc_flags & UKBD_FLAG_APPLE_FN) &&
 			    hid_get_data((uint8_t *)&sc->sc_ndata,
 				len, &sc->sc_loc_apple_fn))
@@ -535,8 +525,7 @@
 			else
 				apple_fn = 0;
 #if USB_DEBUG
-			DPRINTF("apple_eject=%u apple_fn=%u\n",
-			    apple_eject, apple_fn);
+			DPRINTF("apple_fn=%u\n", apple_fn);
 
 			if (sc->sc_ndata.modifiers) {
 				DPRINTF("mod: 0x%04x\n", sc->sc_ndata.modifiers);
@@ -747,22 +736,14 @@
 
 		/* investigate if this is an Apple Keyboard */
 		if (hid_locate(hid_ptr, hid_len,
-		    HID_USAGE2(HUP_CONSUMER, HUG_APPLE_EJECT),
-		    hid_input, 0, &sc->sc_loc_apple_eject, &flags,
-		    &sc->sc_kbd_id)) {
+		    HID_USAGE2(0xFFFF, 0x0003),
+		    hid_input, 0, &sc->sc_loc_apple_fn, &flags,
+		    &temp_id)) {
 			if (flags & HIO_VARIABLE)
-				sc->sc_flags |= UKBD_FLAG_APPLE_EJECT | 
+				sc->sc_flags |= UKBD_FLAG_APPLE_FN |
 				    UKBD_FLAG_APPLE_SWAP;
-			if (hid_locate(hid_ptr, hid_len,
-			    HID_USAGE2(0xFFFF, 0x0003),
-			    hid_input, 0, &sc->sc_loc_apple_fn, &flags,
-			    &temp_id)) {
-				if (flags & HIO_VARIABLE)
-					sc->sc_flags |= UKBD_FLAG_APPLE_FN |
-					    UKBD_FLAG_APPLE_SWAP;
-				if (temp_id != sc->sc_kbd_id) {
-					DPRINTF("HID IDs mismatch\n");
-				}
+			if (temp_id != sc->sc_kbd_id) {
+				DPRINTF("HID IDs mismatch\n");
 			}
 		} else {
 			/* 

--Apple-Mail-4--743129911--

--Apple-Mail-5--743129881
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkojrQoACgkQfD8M/ASTygIA+QCfZREngzfyflYG9dduU9JyhDC6
fVIAn1+LDaY/tV6n+LC3Q7uG9KkBRn3n
=LMIa
-----END PGP SIGNATURE-----

--Apple-Mail-5--743129881--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5C52056B-8E4A-4C15-8451-2A5576A8FC9F>