9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] Improved Apple laptop support and miscellaneous typo fixes
@ 2021-04-07  7:39 Romano
  2021-04-08 19:36 ` Romano
  0 siblings, 1 reply; 2+ messages in thread
From: Romano @ 2021-04-07  7:39 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

See attached.

These changes provide better support for early-2011 Apple Macbook Pro
laptops: native resolution by specifying the vid & did in /lib/vgadb,
as well as providing an 'appletouch' mouse option, which stops i8042
calls for the internal trackpad.  See
https://blog.fallglow.com/misc/mbpro/cs8390.kmesg for an example of
what is generated when the vgadb entry is lacking and the i8042 calls
occur.

I hope to implement rudimentary multi-touch for the internal trackpad
so that an external 3-button mouse is not required.

There is still an error thrown when initializing the keyboard early on
('i8042: kbd init failed'), but I haven't tracked down what is calling
the i8042 reset whence the error message is generated.  Additionally,,
there is an issue with amlmapio.

[-- Attachment #2: apple-laptop.patch --]
[-- Type: text/plain, Size: 4754 bytes --]

diff -r 18e1e1c3aaf1 lib/vgadb
--- a/lib/vgadb	Tue Apr 06 14:43:38 2021 +0200
+++ b/lib/vgadb	Wed Apr 07 00:21:47 2021 -0700
@@ -433,6 +433,7 @@
 	vid=0x8086 did=0x0046	# Intel Ironlake Arrandale
 	vid=0x8086 did=0x0102	# Intel 2nd Gen Core (HD 2000)
 	vid=0x8086 did=0x0126	# Intel 2nd Gen Core (HD 3000)
+	vid=0x8086 did=0x1c3a	# Intel 2nd Gen Core (HD 3000) Apple MBP
 	vid=0x8086 did=0x0166	# Intel 3rd Gen Core
 	vid=0x8086 did=0x2a42	# Intel 4 Series Mobile
 	vid=0x8086 did=0x0a16	# Intel 4th Gen Core (HD 4400)
diff -r 18e1e1c3aaf1 rc/bin/screenrc
--- a/rc/bin/screenrc	Tue Apr 06 14:43:38 2021 +0200
+++ b/rc/bin/screenrc	Wed Apr 07 00:21:47 2021 -0700
@@ -42,9 +42,9 @@
 	bind -a '#m' /dev
 
 if(test -f /dev/mousectl && test -f /dev/winname){
-	ask mouseport ' is (ps2, ps2intellimouse, 0, 1, 2)' ps2
+	ask mouseport ' is (ps2, ps2intellimouse, appletouch, 0, 1, 2)' ps2
 	switch($mouseport){
-	case ps2 ps2intellimouse 0 1 2
+	case ps2 ps2intellimouse appletouch 0 1 2
 		aux/mouse $mouseport
 		if(~ $accupoint 1)
 			pipefile -dr /bin/aux/accupoint /dev/mouse
diff -r 18e1e1c3aaf1 sys/man/2/auth
--- a/sys/man/2/auth	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/man/2/auth	Wed Apr 07 00:21:47 2021 -0700
@@ -269,7 +269,7 @@
 .IR getkey ,
 to invoke should
 .I factotum
-not posess a key for the authentication.  If
+not possess a key for the authentication.  If
 .I getkey
 is nil, the authentication fails.
 .I Getkey
diff -r 18e1e1c3aaf1 sys/man/3/arch
--- a/sys/man/3/arch	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/man/3/arch	Wed Apr 07 00:21:47 2021 -0700
@@ -144,7 +144,7 @@
 .I acpitbls
 return a concatenation of system ACPI tables. Each table
 is prefixed with a fixed size header that gives the name
-sigature and size of the table (see section
+signature and size of the table (see section
 .IR "5.2.6 System Description Table Header"
 in the ACPI specification).
 .SH EXAMPLE
diff -r 18e1e1c3aaf1 sys/man/3/mouse
--- a/sys/man/3/mouse	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/man/3/mouse	Wed Apr 07 00:21:47 2021 -0700
@@ -100,6 +100,9 @@
 followed by a write of
 .BR intellimouse .
 .TP
+.B appletouch
+uses the trackpad on Apple laptops.
+.TP
 .B "accelerated\fI [n]\fP"
 turns on mouse acceleration.
 .I N
diff -r 18e1e1c3aaf1 sys/man/8/mouse
--- a/sys/man/8/mouse	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/man/8/mouse	Wed Apr 07 00:21:47 2021 -0700
@@ -17,7 +17,7 @@
 .B aux/accupoint
 .SH DESCRIPTION
 .B Mouse
-queries a mouse on a serial or PS2 port for
+queries a mouse on a serial, PS2 port, or USB endpoint for
 its type and then configures the port and the
 mouse to be used to control the cursor.
 .PP
@@ -27,9 +27,10 @@
 or
 .BR 1 )
 or the string
-.B ps2
+.BR ps2 ,
+.BR ps2intellimouse ,
 or
-.BR ps2intellimouse .
+.BR appletouch .
 The initialization can be automated by setting
 .BR mouseport
 in
diff -r 18e1e1c3aaf1 sys/man/8/plan9.ini
--- a/sys/man/8/plan9.ini	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/man/8/plan9.ini	Wed Apr 07 00:21:47 2021 -0700
@@ -595,6 +595,9 @@
 .B ps2intellimouse
 an Intellimouse on the PS2 port.
 .TP
+.B appletouch
+the built-in apple touch trackpad (multi-touch not yet supported) on Apple laptops.
+.TP
 .B 0
 for COM1
 .TP
diff -r 18e1e1c3aaf1 sys/src/9/pc/mouse.c
--- a/sys/src/9/pc/mouse.c	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/src/9/pc/mouse.c	Wed Apr 07 00:21:47 2021 -0700
@@ -20,6 +20,7 @@
 	Mouseother=	0,
 	Mouseserial=	1,
 	MousePS2=	2,
+	AppleTouch=	3,
 };
 
 static QLock mousectlqlock;
@@ -42,6 +43,7 @@
 	CMres,
 	CMreset,
 	CMserial,
+	CMappletouch
 };
 
 static Cmdtab mousectlmsg[] =
@@ -55,6 +57,7 @@
 	CMres,			"res",			0,
 	CMreset,		"reset",		1,
 	CMserial,		"serial",		0,
+	CMappletouch,		"appletouch",		0,
 };
 
 /*
@@ -155,6 +158,22 @@
 }
 
 /*
+ *  set up an internal trackpad (non-ps2) for mac. This is not complete
+ *  but better than being spammed by failed i8042 commands, since Apple
+ *  products do not have i8042.
+ */
+static void
+appletouch(void)
+{
+	if(mousetype == AppleTouch)
+		return;
+
+	mousetype = AppleTouch;
+	packetsize = 3;
+	mousehwaccel = 0;
+}
+
+/*
  *  set up a ps2 mouse
  */
 static void
@@ -314,6 +333,10 @@
 		setintellimouse();
 		setstream(1);
 		break;
+	case CMappletouch:
+		intellimouse = 0;
+		appletouch();
+		break;
 	case CMres:
 		setstream(0);
 		if(cb->nf >= 2)
diff -r 18e1e1c3aaf1 sys/src/cmd/aux/mouse.c
--- a/sys/src/cmd/aux/mouse.c	Tue Apr 06 14:43:38 2021 +0200
+++ b/sys/src/cmd/aux/mouse.c	Wed Apr 07 00:21:47 2021 -0700
@@ -321,7 +321,7 @@
 			exits("open /dev/mousectl");
 	}
 
-	if(strncmp(p, "ps2", 3) == 0){
+	if(strncmp(p, "ps2", 3) == 0 || strncmp(p, "appletouch", 10)){
 		if(write(conf, p, strlen(p)) < 0){
 			fprint(2, "%s: error setting mouse type - %r\n", argv0);
 			exits("write conf");

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-08 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  7:39 [9front] [patch] Improved Apple laptop support and miscellaneous typo fixes Romano
2021-04-08 19:36 ` Romano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).