Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1574479
 поиск   регистрация   авторизация 
 
Группа :: Терминалы
Пакет: kbd

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: kbd-1.08-sparc.patch


Don't try unimplemented ioctls on SPARC, even if they
are defined in headers -- that way lies madness.
--- kbd-1.08/man/man8/kbdrate.8	2002-10-11 07:08:58.000000000 -0400
+++ kbd-1.08/man/man8/kbdrate.8	2002-11-22 17:28:15.000000000 -0500
@@ -22,7 +22,7 @@
 without any options will reset the repeat rate to 10.9 characters per second (cps)
 and the delay to 250 milliseconds (ms) for Intel- and M68K-based systems.
 These are the IBM defaults. On SPARC-based systems it will reset the repeat rate
-to 5 cps and the delay to 200 ms.
+to 20 cps and the delay to 200 ms.
 
 .SH OPTIONS
 .TP
@@ -69,3 +69,5 @@
 .I /etc/rc.local
 .br
 .I /dev/port
+.br
+.I /dev/kbd
--- kbd-1.08/src/kbdrate.c	2002-10-11 07:09:01.000000000 -0400
+++ kbd-1.08/src/kbdrate.c	2002-11-22 17:34:48.000000000 -0500
@@ -104,8 +104,11 @@
 
 static int
 KDKBDREP_ioctl_ok(double rate, int delay, int silent) {
+#if defined(KDKBDREP) && !defined(__sparc__)
 	/* This ioctl is defined in <linux/kd.h> but is not
-	   implemented anywhere - must be in some m68k patches. */
+	   implemented anywhere - must be in some m68k patches.
+	   We cannot blindly try unimplemented ioctls on sparc64 -
+	   the 32<->64bit transition layer does not like it. */
 	struct kbd_repeat kbdrep_s;
 
 	/* don't change, just test */
@@ -150,6 +153,9 @@
 			rate, kbdrep_s.delay );
 
 	return 1;			/* success! */
+#else /* no KDKBDREP or __sparc__ */
+	return 0;
+#endif /* KDKBDREP */
 }
 
 static int
@@ -188,7 +194,7 @@
 int
 main( int argc, char **argv ) {
 #ifdef __sparc__
-	double      rate = 5.0;      /* Default rate */
+	double      rate = 20.0;      /* Default rate */
 	int         delay = 200;     /* Default delay */
 #else
 	double      rate = 10.9;     /* Default rate */
@@ -238,8 +244,9 @@
 		return 0;
 
 
-	/* The ioport way */
+	/* The ioport way - will crash on sparc */
 
+#ifndef __sparc__
 	for (i = 0; i < RATE_COUNT; i++)
 		if (rate * 10 >= valid_rates[i]) {
 			value &= 0x60;
@@ -285,5 +292,7 @@
 			valid_rates[value & 0x1f] / 10.0,
 			valid_delays[ (value & 0x60) >> 5 ] );
 
+#endif
+
 	return 0;
 }
 
design & coding: Vladimir Lettiev aka crux © 2004-2005