From: Alexey Gladkov Date: Sun, 4 Feb 2007 20:47:39 +0000 (+0300) Subject: [SYSTEM] Apply patch from Debian. X-Git-Tag: 2.0.2~267 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b04f40140cd2e8d4bdbb6467cdcf09e9a2403242;p=platform%2Fupstream%2Fkbd.git [SYSTEM] Apply patch from Debian. Apply kbdrate_sparc.diff patch from Debian distribution. On Sparc machines, the kbd_repeat struct has no 'period' member. Date: 2004-08-01 Signed-off-by: Alexey Gladkov --- diff --git a/src/kbdrate.c b/src/kbdrate.c index dd30bbc..9a612b2 100644 --- a/src/kbdrate.c +++ b/src/kbdrate.c @@ -85,8 +85,18 @@ beats rebuilding the kernel! * actually used values are returned */ struct kbd_repeat { int delay; /* in msec; <= 0: don't change */ +#ifdef __sparc__ + int rate; /* in msec; <= 0: don't change */ +#else int period; /* in msec; <= 0: don't change */ +#endif }; +#endif /* KDKBDREP */ + +#ifdef __sparc__ +#define KBD_PERIOD(var) var.rate +#else +#define KBD_PERIOD(var) var.period #endif #include @@ -113,7 +123,7 @@ KDKBDREP_ioctl_ok(double rate, int delay, int silent) { struct kbd_repeat kbdrep_s; /* don't change, just test */ - kbdrep_s.period = -1; + KBD_PERIOD(kbdrep_s) = -1; kbdrep_s.delay = -1; if (ioctl( 0, KDKBDREP, &kbdrep_s )) { if (errno == EINVAL || errno == ENOTTY) @@ -124,16 +134,16 @@ KDKBDREP_ioctl_ok(double rate, int delay, int silent) { #if 0 printf("old delay %d, period %d\n", - kbdrep_s.delay, kbdrep_s.period); + kbdrep_s.delay, KBD_PERIOD(kbdrep_s)); #endif /* do the change */ if (rate == 0) /* switch repeat off */ - kbdrep_s.period = 0; + KBD_PERIOD(kbdrep_s) = 0; else - kbdrep_s.period = 1000.0 / rate; /* convert cps to msec */ - if (kbdrep_s.period < 1) - kbdrep_s.period = 1; + KBD_PERIOD(kbdrep_s) = 1000.0 / rate; /* convert cps to msec */ + if (KBD_PERIOD(kbdrep_s) < 1) + KBD_PERIOD(kbdrep_s) = 1; kbdrep_s.delay = delay; if (kbdrep_s.delay < 1) kbdrep_s.delay = 1; @@ -144,10 +154,10 @@ KDKBDREP_ioctl_ok(double rate, int delay, int silent) { } /* report */ - if (kbdrep_s.period == 0) + if (KBD_PERIOD(kbdrep_s) == 0) rate = 0; else - rate = 1000.0 / (double) kbdrep_s.period; + rate = 1000.0 / (double) KBD_PERIOD(kbdrep_s); if (!silent) printf( _("Typematic Rate set to %.1f cps (delay = %d ms)\n"), @@ -171,10 +181,10 @@ KIOCSRATE_ioctl_ok(double rate, int delay, int silent) { exit( 1 ); } - kbdrate_s.period = (int) (rate + 0.5); /* round up */ + KBD_PERIOD(kbdrate_s) = (int) (rate + 0.5); /* round up */ kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ - if (kbdrate_s.period > 50) - kbdrate_s.period = 50; + if (KBD_PERIOD(kbdrate_s) > 50) + KBD_PERIOD(kbdrate_s) = 50; if (ioctl( fd, KIOCSRATE, &kbdrate_s )) { perror( "ioctl(KIOCSRATE)" ); @@ -184,7 +194,7 @@ KIOCSRATE_ioctl_ok(double rate, int delay, int silent) { if (!silent) printf( "Typematic Rate set to %d cps (delay = %d ms)\n", - kbdrate_s.period, kbdrate_s.delay * 1000 / HZ ); + KBD_PERIOD(kbdrate_s), kbdrate_s.delay * 1000 / HZ ); return 1; #else /* no KIOCSRATE */