You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(135) |
Nov
(123) |
Dec
(83) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(244) |
Feb
(72) |
Mar
(221) |
Apr
(91) |
May
(104) |
Jun
(93) |
Jul
(78) |
Aug
(1) |
Sep
(1) |
Oct
(29) |
Nov
(98) |
Dec
(20) |
| 2003 |
Jan
|
Feb
(21) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(18) |
Sep
(18) |
Oct
(23) |
Nov
(12) |
Dec
(6) |
| 2004 |
Jan
(2) |
Feb
(32) |
Mar
|
Apr
(12) |
May
(11) |
Jun
(11) |
Jul
|
Aug
(9) |
Sep
|
Oct
(15) |
Nov
|
Dec
|
| 2005 |
Jan
|
Feb
(2) |
Mar
(11) |
Apr
(6) |
May
(1) |
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2006 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
(2) |
Mar
|
Apr
(25) |
May
(2) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(13) |
Oct
|
Nov
(2) |
Dec
(2) |
| 2011 |
Jan
|
Feb
|
Mar
(10) |
Apr
(10) |
May
(1) |
Jun
(6) |
Jul
|
Aug
(2) |
Sep
(5) |
Oct
|
Nov
|
Dec
|
|
From: James S. <jsi...@us...> - 2002-01-24 18:49:02
|
Update of /cvsroot/linuxconsole/ruby/linux/include/asm-s390 In directory usw-pr-cvs1:/tmp/cvs-serv15926/include/asm-s390 Removed Files: page.h Log Message: Got ride of the do_BUG thing. Unfortunely the bust_spinlock code is not generic enough. --- page.h DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-24 18:49:02
|
Update of /cvsroot/linuxconsole/ruby/linux/include/asm-s390x In directory usw-pr-cvs1:/tmp/cvs-serv15926/include/asm-s390x Removed Files: page.h Log Message: Got ride of the do_BUG thing. Unfortunely the bust_spinlock code is not generic enough. --- page.h DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-24 18:49:01
|
Update of /cvsroot/linuxconsole/ruby/linux/include/asm-i386 In directory usw-pr-cvs1:/tmp/cvs-serv15926/include/asm-i386 Removed Files: page.h Log Message: Got ride of the do_BUG thing. Unfortunely the bust_spinlock code is not generic enough. --- page.h DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-24 18:49:01
|
Update of /cvsroot/linuxconsole/ruby/linux/include/asm-cris In directory usw-pr-cvs1:/tmp/cvs-serv15926/include/asm-cris Removed Files: page.h Log Message: Got ride of the do_BUG thing. Unfortunely the bust_spinlock code is not generic enough. --- page.h DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-24 18:49:01
|
Update of /cvsroot/linuxconsole/ruby/linux/include/asm-alpha In directory usw-pr-cvs1:/tmp/cvs-serv15926/include/asm-alpha Removed Files: page.h Log Message: Got ride of the do_BUG thing. Unfortunely the bust_spinlock code is not generic enough. --- page.h DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-24 18:49:00
|
Update of /cvsroot/linuxconsole/ruby/linux/arch/i386/mm
In directory usw-pr-cvs1:/tmp/cvs-serv15926/arch/i386/mm
Modified Files:
fault.c
Log Message:
Got ride of the do_BUG thing. Unfortunely the bust_spinlock code is not generic enough.
Index: fault.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/arch/i386/mm/fault.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- fault.c 2002/01/20 03:54:45 1.7
+++ fault.c 2002/01/24 18:48:57 1.8
@@ -18,6 +18,7 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/tty.h>
+#include <linux/vt_kern.h> /* For unblank_screen() */
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -26,6 +27,8 @@
extern void die(const char *,struct pt_regs *,long);
+extern int console_loglevel;
+
/*
* Ugly, ugly, but the goto's result in better assembly..
*/
@@ -89,6 +92,42 @@
goto survive;
}
goto bad_area;
+}
+
+extern spinlock_t timerlist_lock;
+
+/*
+ * Unlock any spinlocks which will prevent us from getting the
+ * message out (timerlist_lock is acquired through the
+ * console unblank code)
+ */
+void bust_spinlocks(int yes)
+{
+ spin_lock_init(&timerlist_lock);
+ if (yes) {
+ oops_in_progress = 1;
+#ifdef CONFIG_SMP
+ global_irq_lock = 0; /* Many serial drivers do __global_cli() */
+#endif
+ } else {
+ int loglevel_save = console_loglevel;
+
+ oops_in_progress = 0;
+ /*
+ * OK, the message is on the console. Now we call printk()
+ * without oops_in_progress set so that printk will give klogd
+ * a poke. Hold onto your hats...
+ */
+ console_loglevel = 15; /* NMI oopser may have shut the console up */
+ printk(" ");
+ console_loglevel = loglevel_save;
+ }
+}
+
+void do_BUG(const char *file, int line)
+{
+ bust_spinlocks(1);
+ printk("kernel BUG at %s:%d!\n", file, line);
}
asmlinkage void do_invalid_op(struct pt_regs *, unsigned long);
|
|
From: James S. <jsi...@us...> - 2002-01-24 15:21:22
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char
In directory usw-pr-cvs1:/tmp/cvs-serv21261
Modified Files:
keyboard.c
Log Message:
Minor cleanups to minimize diffs with 2.5.X
Index: keyboard.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/keyboard.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- keyboard.c 2002/01/24 00:02:42 1.68
+++ keyboard.c 2002/01/24 15:21:19 1.69
@@ -38,25 +38,26 @@
#include <linux/config.h>
#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/random.h>
-#include <linux/pm.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+
+#include <linux/kbd_diacr.h>
#include <linux/vt_kern.h>
#include <linux/consolemap.h>
-#include <linux/kbd_diacr.h>
#include <linux/sysrq.h>
+#include <linux/pm.h>
#include <linux/input.h>
static void kbd_disconnect(struct input_handle *handle);
extern void ctrl_alt_del(void);
-#define SIZE(x) (sizeof(x)/sizeof((x)[0]))
+#define SIZE(x) (sizeof(x)/sizeof((x)[0]))
/*
* Exported functions/variables
@@ -66,7 +67,7 @@
void compute_shiftstate(void);
/*
- * Handler tables.
+ * Handler Tables.
*/
#define K_HANDLERS\
@@ -126,16 +127,16 @@
int shift_state = 0;
/*
- * Internal data.
+ * Internal Data.
*/
static struct input_handler kbd_handler;
-static unsigned long key_down[256/BITS_PER_LONG];
+static unsigned long key_down[256/BITS_PER_LONG]; /* keyboard key bitmap */
static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */
static int dead_key_next;
-static int npadch = -1; /* -1 or number assembled on pad */
+static int npadch = -1; /* -1 or number assembled on pad */
static unsigned char diacr;
-static char rep; /* flag telling character repeat */
+static char rep; /* flag telling character repeat */
pm_callback pm_kbd_request_override = NULL;
typedef void (pm_kbd_func) (void);
static struct pm_dev *pm_kbd;
@@ -150,7 +151,7 @@
} ledptrs[3];
/*
- * Helper functions
+ * Helper Functions.
*/
static void put_queue(struct vc_data *vc, int ch)
{
@@ -230,7 +231,7 @@
put_queue(vc, c);
else if (c < 0x800) {
/* 110***** 10****** */
- put_queue(vc, 0xc0 | (c >> 6));
+ put_queue(vc, 0xc0 | (c >> 6));
put_queue(vc, 0x80 | (c & 0x3f));
} else {
/* 1110**** 10****** 10****** */
@@ -242,26 +243,25 @@
void put_unicode(struct vc_data *vc, u16 uc)
{
- if (vc->kbd_table.kbdmode == VC_UNICODE)
- to_utf8(vc, uc);
- else if ((uc & ~0x9f) == 0 || uc == 127)
- /* Don't translate control chars */
- put_queue(vc, uc);
- else {
- unsigned char c;
-
- c = inverse_translate(vc->vc_translate, uc);
- if (c) put_queue(vc, c);
- }
+ if (vc->kbd_table.kbdmode == VC_UNICODE)
+ to_utf8(vc, uc);
+ else if ((uc & ~0x9f) == 0 || uc == 127)
+ /* Don't translate control chars */
+ put_queue(vc, uc);
+ else {
+ unsigned char c;
+ c = inverse_translate(vc->display_fg->fg_console->vc_translate, uc);
+ if (c) put_queue(vc, c);
+ }
}
static void put_8bit(struct vc_data *vc, u8 c)
{
- /* Don't translate control chars */
- if (vc->kbd_table.kbdmode != VC_UNICODE || c < 32 || c == 127)
- put_queue(vc, c);
- else
- to_utf8(vc, get_acm(vc->vc_translate)[c]);
+ if (vc->kbd_table.kbdmode != VC_UNICODE ||
+ c < 32 || c == 127) /* Don't translate control chars */
+ put_queue(vc, c);
+ else
+ to_utf8(vc, get_acm(vc->display_fg->fg_console->vc_translate)[c]);
}
/*
@@ -275,7 +275,7 @@
shift_state = 0;
memset(shift_down, 0, sizeof(shift_down));
-
+
for (i = 0; i < SIZE(key_down); i++) {
if (!key_down[i])
@@ -291,7 +291,7 @@
sym = U(key_maps[0][k]);
if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK)
continue;
-
+
val = KVAL(sym);
if (val == KVAL(K_CAPSSHIFT))
val = KVAL(K_SHIFT);
@@ -463,28 +463,6 @@
}
}
-static void fn_compose(struct vc_data *vc)
-{
- /* ???? */
- dead_key_next = 1;
-}
-
-static void fn_spawn_con(struct vc_data *vc)
-{
- if (spawnpid)
- if (kill_proc(spawnpid, spawnsig, 1))
- spawnpid = 0;
-}
-
-static void fn_SAK(struct vc_data *vc)
-{
- struct tty_struct *tty = vc->vc_tty;
-
- if (tty)
- do_SAK(tty);
- reset_vc(vc);
-}
-
static void fn_show_mem(struct vc_data *vc)
{
show_mem();
@@ -509,6 +487,28 @@
}
}
+static void fn_compose(struct vc_data *vc)
+{
+ /* ???? */
+ dead_key_next = 1;
+}
+
+static void fn_spawn_con(struct vc_data *vc)
+{
+ if (spawnpid)
+ if (kill_proc(spawnpid, spawnsig, 1))
+ spawnpid = 0;
+}
+
+static void fn_SAK(struct vc_data *vc)
+{
+ struct tty_struct *tty = vc->vc_tty;
+
+ if (tty)
+ do_SAK(tty);
+ reset_vc(vc);
+}
+
static void fn_null(struct vc_data *vc)
{
compute_shiftstate();
@@ -653,7 +653,7 @@
k_fn(vc, KVAL(K_PGUP), 0);
return;
case KVAL(K_P5):
- applkey(vc, 'G', vc_kbd_mode(&vc->kbd_table,
+ applkey(vc,'G', vc_kbd_mode(&vc->kbd_table,
VC_APPLIC));
return;
}
@@ -673,6 +673,7 @@
* Mimic typewriter:
* a CapsShift key acts like Shift but undoes CapsLock
*/
+
if (value == KVAL(K_CAPSSHIFT)) {
value = KVAL(K_SHIFT);
if (!up_flag)
@@ -708,7 +709,6 @@
{
if (up_flag)
return;
-
if (vc_kbd_mode(&vc->kbd_table, VC_META)) {
put_queue(vc, '\033');
put_queue(vc, value);
@@ -740,34 +740,29 @@
static void k_lock(struct vc_data *vc, unsigned char value, char up_flag)
{
- struct kbd_struct* kbd = &vc->kbd_table;
-
if (up_flag || rep)
return;
-
if (value >= NR_LOCK) {
/* Change the lock state and
set the CapsLock LED to the new state */
unsigned char mask;
mask = 1 << (value -= NR_LOCK);
- if ((kbd->lockstate ^= mask) & mask)
- set_vc_kbd_led(kbd, VC_CAPSLOCK);
+ if ((vc->kbd_table.lockstate ^= mask) & mask)
+ set_vc_kbd_led(&vc->kbd_table, VC_CAPSLOCK);
else
- clr_vc_kbd_led(kbd, VC_CAPSLOCK);
+ clr_vc_kbd_led(&vc->kbd_table, VC_CAPSLOCK);
} else {
/* Just change the lock state */
- chg_vc_kbd_lock(kbd, value);
+ chg_vc_kbd_lock(&vc->kbd_table, value);
}
}
static void k_slock(struct vc_data *vc, unsigned char value, char up_flag)
{
k_shift(vc, value, up_flag);
-
if (up_flag || rep)
return;
-
chg_vc_kbd_slock(&vc->kbd_table, value);
/* try to make Alt, oops, AltGr and such work */
if (!key_maps[vc->kbd_table.lockstate ^ vc->kbd_table.slockstate]) {
|
|
From: johann d. <jd...@us...> - 2002-01-24 00:02:45
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char
In directory usw-pr-cvs1:/tmp/cvs-serv9154
Modified Files:
keyboard.c
Log Message:
kbd was not defined in k_lock.
Index: keyboard.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/keyboard.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- keyboard.c 2002/01/23 23:22:34 1.67
+++ keyboard.c 2002/01/24 00:02:42 1.68
@@ -740,6 +740,8 @@
static void k_lock(struct vc_data *vc, unsigned char value, char up_flag)
{
+ struct kbd_struct* kbd = &vc->kbd_table;
+
if (up_flag || rep)
return;
|
|
From: James S. <jsi...@us...> - 2002-01-23 23:56:44
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv7844 Modified Files: vc_screen.c Log Message: Need CON_BUF_SIZE defined. Index: vc_screen.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/vc_screen.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- vc_screen.c 2002/01/23 23:55:26 1.20 +++ vc_screen.c 2002/01/23 23:56:41 1.21 @@ -43,6 +43,7 @@ #undef org #undef addr #define HEADER_SIZE 4 +#define CON_BUF_SIZE PAGE_SIZE /* note the word offset */ unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed) |
|
From: James S. <jsi...@us...> - 2002-01-23 23:55:29
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv7574 Modified Files: vc_screen.c Log Message: Needed console.h. Index: vc_screen.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/vc_screen.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- vc_screen.c 2002/01/20 03:54:46 1.19 +++ vc_screen.c 2002/01/23 23:55:26 1.20 @@ -31,6 +31,7 @@ #include <linux/interrupt.h> #include <linux/mm.h> #include <linux/init.h> +#include <linux/console.h> #include <linux/vt_kern.h> #include <linux/selection.h> #include <linux/kbd_kern.h> |
|
From: johann d. <jd...@us...> - 2002-01-23 23:35:34
|
Update of /cvsroot/linuxconsole/ruby/linux/kernel
In directory usw-pr-cvs1:/tmp/cvs-serv3397
Modified Files:
printk.c
Log Message:
kdev_t objects must be compared using kdev_same().
Index: printk.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/kernel/printk.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- printk.c 2001/12/26 20:29:23 1.24
+++ printk.c 2002/01/23 23:35:31 1.25
@@ -475,7 +475,7 @@
spin_lock(&console_lock);
/* Look for new messages */
for (con = console_drivers; con; con = con->next) {
- if (con->device(con) == device)
+ if (kdev_same(con->device(con),device))
break;
}
spin_unlock(&console_lock);
@@ -518,7 +518,7 @@
else {
spin_lock(&console_lock);
for (con = console_drivers; con; con = con->next) {
- if (con->device(con) == device)
+ if (kdev_same(con->device(con), device))
break;
}
spin_unlock(&console_lock);
|
|
From: James S. <jsi...@us...> - 2002-01-23 23:22:37
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char
In directory usw-pr-cvs1:/tmp/cvs-serv1333
Modified Files:
keyboard.c
Log Message:
wait_key_press is gone now.
Index: keyboard.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/keyboard.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- keyboard.c 2002/01/23 00:17:08 1.66
+++ keyboard.c 2002/01/23 23:22:34 1.67
@@ -133,9 +133,9 @@
static unsigned long key_down[256/BITS_PER_LONG];
static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */
static int dead_key_next;
-static int npadch = -1; /* -1 or number assembled on pad */
+static int npadch = -1; /* -1 or number assembled on pad */
static unsigned char diacr;
-static char rep; /* flag telling character repeat */
+static char rep; /* flag telling character repeat */
pm_callback pm_kbd_request_override = NULL;
typedef void (pm_kbd_func) (void);
static struct pm_dev *pm_kbd;
@@ -156,7 +156,6 @@
{
struct tty_struct *tty = vc->vc_tty;
- wake_up(&keypress_wait);
if (tty) {
tty_insert_flip_char(tty, ch, 0);
tty_schedule_flip(tty);
@@ -167,11 +166,13 @@
{
struct tty_struct *tty = vc->vc_tty;
- wake_up(&keypress_wait);
if (!tty)
return;
- while (*cp)
- tty_insert_flip_char(tty, *cp++, 0);
+
+ while (*cp) {
+ tty_insert_flip_char(tty, *cp, 0);
+ cp++;
+ }
tty_schedule_flip(tty);
}
@@ -225,6 +226,7 @@
void to_utf8(struct vc_data *vc, ushort c)
{
if (c < 0x80)
+ /* 0******* */
put_queue(vc, c);
else if (c < 0x800) {
/* 110***** 10****** */
@@ -240,25 +242,26 @@
void put_unicode(struct vc_data *vc, u16 uc)
{
- if (vc->kbd_table.kbdmode == VC_UNICODE)
- to_utf8(vc, uc);
- else if ((uc & ~0x9f) == 0 || uc == 127)
- /* Don't translate control chars */
- put_queue(vc, uc);
- else {
- unsigned char c;
- c = inverse_translate(vc->display_fg->fg_console->vc_translate, uc);
- if (c) put_queue(vc, c);
- }
+ if (vc->kbd_table.kbdmode == VC_UNICODE)
+ to_utf8(vc, uc);
+ else if ((uc & ~0x9f) == 0 || uc == 127)
+ /* Don't translate control chars */
+ put_queue(vc, uc);
+ else {
+ unsigned char c;
+
+ c = inverse_translate(vc->vc_translate, uc);
+ if (c) put_queue(vc, c);
+ }
}
static void put_8bit(struct vc_data *vc, u8 c)
{
- if (vc->kbd_table.kbdmode != VC_UNICODE ||
- c < 32 || c == 127) /* Don't translate control chars */
- put_queue(vc, c);
- else
- to_utf8(vc, get_acm(vc->display_fg->fg_console->vc_translate)[c]);
+ /* Don't translate control chars */
+ if (vc->kbd_table.kbdmode != VC_UNICODE || c < 32 || c == 127)
+ put_queue(vc, c);
+ else
+ to_utf8(vc, get_acm(vc->vc_translate)[c]);
}
/*
@@ -273,14 +276,14 @@
shift_state = 0;
memset(shift_down, 0, sizeof(shift_down));
- for(i = 0; i < SIZE(key_down); i++) {
+ for (i = 0; i < SIZE(key_down); i++) {
if (!key_down[i])
continue;
k = i*BITS_PER_LONG;
- for(j = 0; j < BITS_PER_LONG; j++, k++) {
+ for (j = 0; j < BITS_PER_LONG; j++, k++) {
if (!test_bit(k, key_down))
continue;
@@ -370,7 +373,6 @@
* these routines are also activated by ^S/^Q.
* (And SCROLLOCK can also be set by the ioctl KDSKBLED.)
*/
-
if (tty->stopped)
start_tty(tty);
else
@@ -386,9 +388,11 @@
}
/*
- * NumLock code version unaffected by application keypad mode
+ * Bind this to Shift-NumLock if you work in application keypad mode
+ * but want to be able to change the NumLock flag.
+ * Bind this to NumLock if you prefer that the NumLock key always
+ * changes the NumLock flag.
*/
-
static void fn_bare_num(struct vc_data *vc)
{
if (!rep)
@@ -529,8 +533,7 @@
fn_handler[value](vc);
}
-static void k_lowercase(struct vc_data *vc, unsigned char value,
- char up_flag)
+static void k_lowercase(struct vc_data *vc, unsigned char value, char up_flag)
{
printk(KERN_ERR "keyboard.c: k_lowercase was called - impossible\n");
}
@@ -650,7 +653,7 @@
k_fn(vc, KVAL(K_PGUP), 0);
return;
case KVAL(K_P5):
- applkey(vc,'G', vc_kbd_mode(&vc->kbd_table,
+ applkey(vc, 'G', vc_kbd_mode(&vc->kbd_table,
VC_APPLIC));
return;
}
@@ -670,7 +673,6 @@
* Mimic typewriter:
* a CapsShift key acts like Shift but undoes CapsLock
*/
-
if (value == KVAL(K_CAPSSHIFT)) {
value = KVAL(K_SHIFT);
if (!up_flag)
@@ -706,6 +708,7 @@
{
if (up_flag)
return;
+
if (vc_kbd_mode(&vc->kbd_table, VC_META)) {
put_queue(vc, '\033');
put_queue(vc, value);
@@ -739,27 +742,30 @@
{
if (up_flag || rep)
return;
+
if (value >= NR_LOCK) {
/* Change the lock state and
set the CapsLock LED to the new state */
unsigned char mask;
mask = 1 << (value -= NR_LOCK);
- if ((vc->kbd_table.lockstate ^= mask) & mask)
- set_vc_kbd_led(&vc->kbd_table, VC_CAPSLOCK);
+ if ((kbd->lockstate ^= mask) & mask)
+ set_vc_kbd_led(kbd, VC_CAPSLOCK);
else
- clr_vc_kbd_led(&vc->kbd_table, VC_CAPSLOCK);
+ clr_vc_kbd_led(kbd, VC_CAPSLOCK);
} else {
/* Just change the lock state */
- chg_vc_kbd_lock(&vc->kbd_table, value);
+ chg_vc_kbd_lock(kbd, value);
}
}
static void k_slock(struct vc_data *vc, unsigned char value, char up_flag)
{
k_shift(vc, value, up_flag);
+
if (up_flag || rep)
return;
+
chg_vc_kbd_slock(&vc->kbd_table, value);
/* try to make Alt, oops, AltGr and such work */
if (!key_maps[vc->kbd_table.lockstate ^ vc->kbd_table.slockstate]) {
|
|
From: James S. <jsi...@us...> - 2002-01-23 23:21:34
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/char
In directory usw-pr-cvs1:/tmp/cvs-serv1165
Modified Files:
vt.c
Log Message:
Typo for mk_kdev.
Index: vt.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/vt.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- vt.c 2002/01/20 03:54:46 1.117
+++ vt.c 2002/01/23 23:21:30 1.118
@@ -1423,7 +1423,7 @@
static kdev_t vt_console_device(struct console *c)
{
- return mk_dev(TTY_MAJOR, c->index ? c->index : admin_vt->fg_console->vc_num);
+ return mk_kdev(TTY_MAJOR, c->index ? c->index : admin_vt->fg_console->vc_num);
}
struct console vt_console_driver = {
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:56:51
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input In directory usw-pr-cvs1:/tmp/cvs-serv22735 Removed Files: bttv.c i8042.c i8042.h joydump.c Log Message: --- bttv.c DELETED --- --- i8042.c DELETED --- --- i8042.h DELETED --- --- joydump.c DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-23 06:56:19
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick
In directory usw-pr-cvs1:/tmp/cvs-serv22662
Added Files:
joydump.c
Log Message:
--- NEW FILE: joydump.c ---
/*
* $Id: joydump.c,v 1.1 2002/01/23 06:56:16 jsimmons Exp $
*
* Copyright (c) 1996-2001 Vojtech Pavlik
*/
/*
* This is just a very simple driver that can dump the data
* out of the joystick port into the syslog ...
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vo...@uc...>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <linux/module.h>
#include <linux/gameport.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vo...@uc...>");
MODULE_DESCRIPTION("Gameport data dumper module");
MODULE_LICENSE("GPL");
#define BUF_SIZE 256
struct joydump {
unsigned int time;
unsigned char data;
};
static void __devinit joydump_connect(struct gameport *gameport, struct gameport_dev *dev)
{
struct joydump buf[BUF_SIZE];
int axes[4], buttons;
int i, j, t, timeout;
unsigned long flags;
unsigned char u;
printk(KERN_INFO "joydump: ,------------------- START ------------------.\n");
printk(KERN_INFO "joydump: | Dumping gameport%s.\n", gameport->phys);
printk(KERN_INFO "joydump: | Speed: %4d kHz. |\n", gameport->speed);
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW)) {
printk(KERN_INFO "joydump: | Raw mode not available - trying cooked. |\n");
if (gameport_open(gameport, dev, GAMEPORT_MODE_COOKED)) {
printk(KERN_INFO "joydump: | Cooked not available either. Failing. |\n");
printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
return;
}
gameport_cooked_read(gameport, axes, &buttons);
for (i = 0; i < 4; i++)
printk(KERN_INFO "joydump: | Axis %d: %4d. |\n", i, axes[i]);
printk(KERN_INFO "joydump: | Buttons %02x. |\n", buttons);
printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
}
timeout = gameport_time(gameport, 10000); /* 10 ms */
t = 0;
i = 1;
save_flags(flags);
cli();
u = gameport_read(gameport);
buf[0].data = u;
buf[0].time = t;
gameport_trigger(gameport);
while (i < BUF_SIZE && t < timeout) {
buf[i].data = gameport_read(gameport);
if (buf[i].data ^ u) {
u = buf[i].data;
buf[i].time = t;
i++;
}
t++;
}
restore_flags(flags);
/*
* Dump data.
*/
t = i;
printk(KERN_INFO "joydump: >------------------- DATA -------------------<\n");
printk(KERN_INFO "joydump: | index: %3d delta: %3d.%02d us data: ", 0, 0, 0);
for (j = 7; j >= 0; j--)
printk("%d",(buf[0].data >> j) & 1);
printk(" |\n");
for (i = 1; i < t; i++) {
printk(KERN_INFO "joydump: | index: %3d delta: %3d us data: ",
i, buf[i].time - buf[i-1].time);
for (j = 7; j >= 0; j--)
printk("%d",(buf[i].data >> j) & 1);
printk(" |\n");
}
printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
}
static void __devexit joydump_disconnect(struct gameport *gameport)
{
gameport_close(gameport);
}
static struct gameport_dev joydump_dev = {
connect: joydump_connect,
disconnect: joydump_disconnect,
};
static int __init joydump_init(void)
{
gameport_register_device(&joydump_dev);
return 0;
}
static void __exit joydump_exit(void)
{
gameport_unregister_device(&joydump_dev);
}
module_init(joydump_init);
module_exit(joydump_exit);
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:55:21
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick
In directory usw-pr-cvs1:/tmp/cvs-serv22540
Modified Files:
Config.in
Log Message:
Index: Config.in
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/Config.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Config.in 2002/01/23 05:31:51 1.1
+++ Config.in 2002/01/23 06:55:18 1.2
@@ -31,3 +31,7 @@
if [ "$CONFIG_AMIGA" = "y" ]; then
dep_tristate ' Amiga joysticks' CONFIG_JOYSTICK_AMIJOY $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
fi
+dep_tristate ' #BTTV Infrared remote' CONFIG_JOYSTICK_BTTV $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
+
+dep_tristate ' Gameport data dumper' CONFIG_INPUT_JOYDUMP $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
+
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:50:31
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick In directory usw-pr-cvs1:/tmp/cvs-serv21639 Modified Files: Makefile Log Message: Index: Makefile =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 2002/01/23 05:23:06 1.1 +++ Makefile 2002/01/23 06:50:28 1.2 @@ -12,6 +12,7 @@ obj-$(CONFIG_JOYSTICK_ADI) += adi.o obj-$(CONFIG_JOYSTICK_AMIGA) += amijoy.o obj-$(CONFIG_JOYSTICK_ANALOG) += analog.o +#obj-$(CONIG_INPUT_BTTV) += bttv.o obj-$(CONFIG_JOYSTICK_COBRA) += cobra.o obj-$(CONFIG_JOYSTICK_DB9) += db9.o obj-$(CONFIG_JOYSTICK_GAMECON) += gamecon.o |
|
From: James S. <jsi...@us...> - 2002-01-23 06:49:22
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick
In directory usw-pr-cvs1:/tmp/cvs-serv21340
Added Files:
bttv.c
Log Message:
--- NEW FILE: bttv.c ---
/*
* joy-bttv.c Version 1.0
*
* Copyright (c) 2000 Ryan Gammon <rgg...@uw...>
*
*/
/*
* This is a module for the Linux joystick driver, supporting
* the tv remote control hooked up to tv cards based on the bt848 chip.
*
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
I've received the following documentation from Avermedia. (It's not 100%
correct for bt848-based cards. There have been reports that it works with
later bt878 boards)
The following is the define of our remote function for the GPIO pins:
Remote code(8 bits):
GPIO (MSB)23 22 21 20 19 17 16 15(LSB)
Handshaking:(3 bits):
GPIO 14: 0 Get the code of remote
1 Read the code of remote
GPIO 23: 0 The code of remote not ready
1 The code of remote is ready
GPIO 22: 0
1 Repeat
Algorithm:
If (bit 23 is 1)
Set (bit 14 to 1)
Get remote code(8 bits)
Set (bit 14 to 0)
Endif
*/
#include <asm/io.h>
#include <asm/param.h>
#include <asm/system.h>
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/joystick.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/init.h>
#if 0
#include "../bttv.h"
#else
int bttv_read_gpio(unsigned int card, unsigned long *data);
int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data);
#endif
static struct js_port* js_bttv_port __initdata = NULL;
#define MODEL_AVERMEDIA_BT848 0 /* Old TV Phone/TV98 (pre 1998-ish) */
#define MODEL_AVERMEDIA_BT878 1 /* Newer avermedia cards */
MODULE_AUTHOR("Ryan Gammon <rgg...@uw...>");
MODULE_DESCRIPTION("joy-bttv - joystick driver for tv remote controls hooked up via bttv chips");
MODULE_PARM(card, "1-4i");
MODULE_PARM(model, "0-1i");
static unsigned int card = 1;
static unsigned int model = 0;
/*
* js_avermedia_bt848_read_code() reads remote control data.
*/
static int js_avermedia_bt848_read_code(int *button, int *repeat)
{
unsigned long gpio;
int result;
result = bttv_read_gpio(card - 1, &gpio);
if(result < 0)
return result;
*button = (int)(((gpio & 0x00F00000) >> 20) + ((gpio & 0x00080000) >> 15));
*repeat = (gpio & 0x00010000)? 1: 0;
return 0;
}
/*
* js_avermedia_bt878_read_code() reads remote control data.
*/
static int js_avermedia_bt878_read_code(int *button, int *repeat)
{
unsigned long gpio;
int result;
result = bttv_read_gpio(card - 1, &gpio);
if(result < 0)
return result;
if(!(gpio & 0x00800000)) /* remote is not ready */
return -1;
gpio |= 0x00008000; /* bit 15 (14?) is flow control */
result = bttv_write_gpio(card - 1, 0x00008000, gpio);
if(result < 0)
return result;
bttv_read_gpio(card - 1, &gpio);
*button = (int)((gpio & 0x003F0000) >> 16);
*repeat = (gpio & 0x00400000)? 1: 0;
gpio &= ~0x00008000;
bttv_write_gpio(card - 1, 0x00008000, gpio);
if(result < 0)
return result;
return 0;
}
/*
* js_bttv_read() reads remote control data.
*/
static int js_bttv_read(void *unused, int **axes, int **buttons)
{
unsigned int b, r;
int result = -1;
switch(model)
{
case MODEL_AVERMEDIA_BT848:
result = js_avermedia_bt848_read_code(&b, &r);
break;
case MODEL_AVERMEDIA_BT878:
result = js_avermedia_bt878_read_code(&b, &r);
break;
default:
return -1;
}
if((result < 0) || (b >= 32))
return -1;
if(r)
buttons[0][0] |= 1 << b;
else
buttons[0][0] &= ~(1 << b);
return 0;
}
/*
* js_bttv_open() is a callback from the file open routine.
*/
static int js_bttv_open(struct js_dev *jd)
{
MOD_INC_USE_COUNT;
return 0;
}
/*
* js_bttv_close() is a callback from the file release routine.
*/
static int js_bttv_close(struct js_dev *jd)
{
MOD_DEC_USE_COUNT;
return 0;
}
#ifdef MODULE
int init_module(void)
#else
int __init js_bttv_init(void)
#endif
{
int dev;
char *names[] = { "Avermedia bt848 remote", "Avermedia bt878 remote" };
js_bttv_port = js_register_port(js_bttv_port,
NULL, /* no private data */
1, /* 1 remote/card */
0, /* sizeof(info) */
js_bttv_read);
if(!js_bttv_port)
{
printk(KERN_INFO "js_bttv_init: Error registering port\n");
return -ENODEV;
}
dev = js_register_device(js_bttv_port,
0, /* remote 0 */
0, /* 0 axes */
32, /* 32 buttons */
names[model], /* name */
js_bttv_open, /* open */
js_bttv_close); /* close */
if(dev < 0)
{
printk(KERN_INFO "js_bttv_init: Error registering device\n");
return -ENODEV;
}
printk(KERN_INFO "js%d: Avermedia bt848 remote\n", dev);
return 0;
}
#ifdef MODULE
void cleanup_module(void)
{
js_unregister_device(js_bttv_port->devs[0]);
js_bttv_port = js_unregister_port(js_bttv_port);
}
#endif
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:48:25
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/mouse
In directory usw-pr-cvs1:/tmp/cvs-serv21176/mouse
Added Files:
atarimouse.c
Log Message:
--- NEW FILE: atarimouse.c ---
/*
* Atari Mouse Driver for Linux
* by Robert de Vries (ro...@an...) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Compatibility with busmouse
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*
* 1996/02/11 Andreas Schwab
* Module support
* Allow multiple open's
*
* Converted to use new generic busmouse code. 5 Apr 1998
* Russell King <rm...@ar...>
*/
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/logibusmouse.h>
#include <asm/setup.h>
#include <asm/atarikb.h>
#include <asm/uaccess.h>
#include "busmouse.h"
static int msedev;
static int mouse_threshold[2] = {2,2};
MODULE_PARM(mouse_threshold, "2i");
extern int atari_mouse_buttons;
static void atari_mouse_interrupt(char *buf)
{
int buttons;
/* ikbd_mouse_disable(); */
buttons = ((buf[0] & 1)
| ((buf[0] & 2) << 1)
| (atari_mouse_buttons & 2));
atari_mouse_buttons = buttons;
busmouse_add_movementbuttons(msedev, buf[1], -buf[2], buttons ^ 7);
/* ikbd_mouse_rel_pos(); */
}
static int release_mouse(struct inode *inode, struct file *file)
{
ikbd_mouse_disable();
atari_mouse_interrupt_hook = NULL;
MOD_DEC_USE_COUNT;
return 0;
}
static int open_mouse(struct inode *inode, struct file *file)
{
atari_mouse_buttons = 0;
ikbd_mouse_y0_top ();
ikbd_mouse_thresh (mouse_threshold[0], mouse_threshold[1]);
ikbd_mouse_rel_pos();
MOD_INC_USE_COUNT;
atari_mouse_interrupt_hook = atari_mouse_interrupt;
return 0;
}
static struct busmouse atarimouse = {
ATARIMOUSE_MINOR, "atarimouse", open_mouse, release_mouse, 0
};
static int __init atari_mouse_init(void)
{
if (!MACH_IS_ATARI)
return -ENODEV;
msedev = register_busmouse(&atarimouse);
if (msedev < 0)
printk(KERN_WARNING "Unable to register Atari mouse driver.\n");
else
printk(KERN_INFO "Atari mouse installed.\n");
return msedev < 0 ? msedev : 0;
}
#ifndef MODULE
#define MIN_THRESHOLD 1
#define MAX_THRESHOLD 20 /* more seems not reasonable... */
static int __init atari_mouse_setup( char *str )
{
int ints[8];
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] < 1) {
printk(KERN_ERR "atari_mouse_setup: no arguments!\n" );
return 0;
}
else if (ints[0] > 2) {
printk(KERN_WARNING "atari_mouse_setup: too many arguments\n" );
}
if (ints[1] < MIN_THRESHOLD || ints[1] > MAX_THRESHOLD)
printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" );
else {
mouse_threshold[0] = ints[1];
mouse_threshold[1] = ints[1];
if (ints[0] > 1) {
if (ints[2] < MIN_THRESHOLD || ints[2] > MAX_THRESHOLD)
printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" );
else
mouse_threshold[1] = ints[2];
}
}
return 1;
}
__setup("atarimouse=",atari_mouse_setup);
#endif /* !MODULE */
static void __exit atari_mouse_cleanup (void)
{
unregister_busmouse(msedev);
}
module_init(atari_mouse_init);
module_exit(atari_mouse_cleanup);
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:48:25
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input In directory usw-pr-cvs1:/tmp/cvs-serv21176 Removed Files: atarijoy.c atarikbd.c atarimouse.c h3600_ts_input.c Log Message: --- atarijoy.c DELETED --- --- atarikbd.c DELETED --- --- atarimouse.c DELETED --- --- h3600_ts_input.c DELETED --- |
|
From: James S. <jsi...@us...> - 2002-01-23 06:47:05
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/keyboard
In directory usw-pr-cvs1:/tmp/cvs-serv20918
Added Files:
atarikbd.c
Log Message:
--- NEW FILE: atarikbd.c ---
/*
* linux/atari/atakeyb.c
*
* Atari Keyboard driver for 680x0 Linux
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
/*
* Atari support by Robert de Vries
* enhanced by Bjoern Brauel and Roman Hodek
*/
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/random.h>
#include <linux/init.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
#include <asm/atarikb.h>
#include <asm/atari_joystick.h>
#include <asm/irq.h>
static void atakeyb_rep( unsigned long ignore );
extern unsigned int keymap_count;
/* Hook for MIDI serial driver */
void (*atari_MIDI_interrupt_hook) (void);
/* Hook for mouse driver */
void (*atari_mouse_interrupt_hook) (char *);
/* variables for IKBD self test: */
/* state: 0: off; >0: in progress; >1: 0xf1 received */
static volatile int ikbd_self_test;
/* timestamp when last received a char */
static volatile unsigned long self_test_last_rcv;
/* bitmap of keys reported as broken */
static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, };
#define BREAK_MASK (0x80)
/*
* ++roman: The following changes were applied manually:
*
* - The Alt (= Meta) key works in combination with Shift and
* Control, e.g. Alt+Shift+a sends Meta-A (0xc1), Alt+Control+A sends
* Meta-Ctrl-A (0x81) ...
*
* - The parentheses on the keypad send '(' and ')' with all
* modifiers (as would do e.g. keypad '+'), but they cannot be used as
* application keys (i.e. sending Esc O c).
*
* - HELP and UNDO are mapped to be F21 and F24, resp, that send the
* codes "\E[M" and "\E[P". (This is better than the old mapping to
* F11 and F12, because these codes are on Shift+F1/2 anyway.) This
* way, applications that allow their own keyboard mappings
* (e.g. tcsh, X Windows) can be configured to use them in the way
* the label suggests (providing help or undoing).
*
* - Console switching is done with Alt+Fx (consoles 1..10) and
* Shift+Alt+Fx (consoles 11..20).
*
* - The misc. special function implemented in the kernel are mapped
* to the following key combinations:
*
* ClrHome -> Home/Find
* Shift + ClrHome -> End/Select
* Shift + Up -> Page Up
* Shift + Down -> Page Down
* Alt + Help -> show system status
* Shift + Help -> show memory info
* Ctrl + Help -> show registers
* Ctrl + Alt + Del -> Reboot
* Alt + Undo -> switch to last console
* Shift + Undo -> send interrupt
* Alt + Insert -> stop/start output (same as ^S/^Q)
* Alt + Up -> Scroll back console (if implemented)
* Alt + Down -> Scroll forward console (if implemented)
* Alt + CapsLock -> NumLock
*
* ++Andreas:
*
* - Help mapped to K_HELP
* - Undo mapped to K_UNDO (= K_F246)
* - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
*/
static u_short ataplain_map[NR_KEYS] __initdata = {
0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200,
0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_map[NR_KEYS] __initdata = {
0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf008, 0xf009,
0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf200,
0xf703, 0xf020, 0xf207, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e,
0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf117,
0xf118, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf119, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf205, 0xf203, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atactrl_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e,
0xf01f, 0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf200,
0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf201, 0xf702, 0xf001, 0xf013,
0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
0xf007, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf07f, 0xf700, 0xf200,
0xf703, 0xf000, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf202, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_ctrl_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf200,
0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
0xf00f, 0xf010, 0xf200, 0xf200, 0xf201, 0xf702, 0xf001, 0xf013,
0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
0xf200, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf07f, 0xf700, 0xf200,
0xf703, 0xf200, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf117,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short ataalt_map[NR_KEYS] __initdata = {
0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf808, 0xf809,
0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf200,
0xf703, 0xf820, 0xf208, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf200, 0xf200, 0xf114,
0xf20b, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf20a, 0xf200, 0xf209, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf206, 0xf204, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf907,
0xf908, 0xf909, 0xf904, 0xf905, 0xf906, 0xf901, 0xf902, 0xf903,
0xf900, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_alt_map[NR_KEYS] __initdata = {
0xf200, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf808, 0xf809,
0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf201, 0xf702, 0xf841, 0xf853,
0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf200,
0xf703, 0xf820, 0xf207, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf50e,
0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf200, 0xf200, 0xf117,
0xf118, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf119, 0xf200, 0xf115, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atactrl_alt_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf800, 0xf81b, 0xf81c, 0xf81d, 0xf81e,
0xf81f, 0xf87f, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf200,
0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf201, 0xf702, 0xf801, 0xf813,
0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
0xf807, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf87f, 0xf700, 0xf200,
0xf703, 0xf800, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf202, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_ctrl_alt_map[NR_KEYS] = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf200,
0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
0xf80f, 0xf810, 0xf200, 0xf200, 0xf201, 0xf702, 0xf801, 0xf813,
0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
0xf200, 0xf200, 0xf700, 0xf200, 0xf81a, 0xf818, 0xf803, 0xf816,
0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf87f, 0xf700, 0xf200,
0xf703, 0xf200, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf117,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
typedef enum kb_state_t
{
KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC
} KB_STATE_T;
#define IS_SYNC_CODE(sc) ((sc) >= 0x04 && (sc) <= 0xfb)
typedef struct keyboard_state
{
unsigned char buf[6];
int len;
KB_STATE_T state;
} KEYBOARD_STATE;
KEYBOARD_STATE kb_state;
#define DEFAULT_KEYB_REP_DELAY (HZ/4)
#define DEFAULT_KEYB_REP_RATE (HZ/25)
/* These could be settable by some ioctl() in future... */
static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY;
static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
static unsigned char rep_scancode;
static struct timer_list atakeyb_rep_timer = { NULL, NULL, 0, 0, atakeyb_rep };
static void atakeyb_rep( unsigned long ignore )
{
kbd_pt_regs = NULL;
/* Disable keyboard for the time we call handle_scancode(), else a race
* in the keyboard tty queue may happen */
atari_disable_irq( IRQ_MFP_ACIA );
del_timer( &atakeyb_rep_timer );
/* A keyboard int may have come in before we disabled the irq, so
* double-check whether rep_scancode is still != 0 */
if (rep_scancode) {
atakeyb_rep_timer.expires = jiffies + key_repeat_rate;
atakeyb_rep_timer.prev = atakeyb_rep_timer.next = NULL;
add_timer( &atakeyb_rep_timer );
handle_scancode(rep_scancode, 1);
}
atari_enable_irq( IRQ_MFP_ACIA );
}
/* ++roman: If a keyboard overrun happened, we can't tell in general how much
* bytes have been lost and in which state of the packet structure we are now.
* This usually causes keyboards bytes to be interpreted as mouse movements
* and vice versa, which is very annoying. It seems better to throw away some
* bytes (that are usually mouse bytes) than to misinterpret them. Therefor I
* introduced the RESYNC state for IKBD data. In this state, the bytes up to
* one that really looks like a key event (0x04..0xf2) or the start of a mouse
* packet (0xf8..0xfb) are thrown away, but at most 2 bytes. This at least
* speeds up the resynchronization of the event structure, even if maybe a
* mouse movement is lost. However, nothing is perfect. For bytes 0x01..0x03,
* it's really hard to decide whether they're mouse or keyboard bytes. Since
* overruns usually occur when moving the Atari mouse rapidly, they're seen as
* mouse bytes here. If this is wrong, only a make code of the keyboard gets
* lost, which isn't too bad. Loosing a break code would be disastrous,
* because then the keyboard repeat strikes...
*/
static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
u_char acia_stat;
int scancode;
int break_flag;
/* save frame for register dump */
kbd_pt_regs = fp;
repeat:
if (acia.mid_ctrl & ACIA_IRQ)
if (atari_MIDI_interrupt_hook)
atari_MIDI_interrupt_hook();
acia_stat = acia.key_ctrl;
/* check out if the interrupt came from this ACIA */
if (!((acia_stat | acia.mid_ctrl) & ACIA_IRQ))
return;
if (acia_stat & ACIA_OVRN)
{
/* a very fast typist or a slow system, give a warning */
/* ...happens often if interrupts were disabled for too long */
printk( KERN_DEBUG "Keyboard overrun\n" );
scancode = acia.key_data;
/* Turn off autorepeating in case a break code has been lost */
del_timer( &atakeyb_rep_timer );
rep_scancode = 0;
if (ikbd_self_test)
/* During self test, don't do resyncing, just process the code */
goto interpret_scancode;
else if (IS_SYNC_CODE(scancode)) {
/* This code seem already to be the start of a new packet or a
* single scancode */
kb_state.state = KEYBOARD;
goto interpret_scancode;
}
else {
/* Go to RESYNC state and skip this byte */
kb_state.state = RESYNC;
kb_state.len = 1; /* skip max. 1 another byte */
goto repeat;
}
}
if (acia_stat & ACIA_RDRF) /* received a character */
{
scancode = acia.key_data; /* get it or reset the ACIA, I'll get it! */
mark_bh(KEYBOARD_BH);
interpret_scancode:
switch (kb_state.state)
{
case KEYBOARD:
switch (scancode)
{
case 0xF7:
kb_state.state = AMOUSE;
kb_state.len = 0;
break;
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
kb_state.state = RMOUSE;
kb_state.len = 1;
kb_state.buf[0] = scancode;
break;
case 0xFC:
kb_state.state = CLOCK;
kb_state.len = 0;
break;
case 0xFE:
case 0xFF:
kb_state.state = JOYSTICK;
kb_state.len = 1;
kb_state.buf[0] = scancode;
break;
case 0xF1:
/* during self-test, note that 0xf1 received */
if (ikbd_self_test) {
++ikbd_self_test;
self_test_last_rcv = jiffies;
break;
}
/* FALL THROUGH */
default:
break_flag = scancode & BREAK_MASK;
scancode &= ~BREAK_MASK;
if (ikbd_self_test) {
/* Scancodes sent during the self-test stand for broken
* keys (keys being down). The code *should* be a break
* code, but nevertheless some AT keyboard interfaces send
* make codes instead. Therefore, simply ignore
* break_flag...
* */
int keyval = plain_map[scancode], keytyp;
set_bit( scancode, broken_keys );
self_test_last_rcv = jiffies;
keyval = plain_map[scancode];
keytyp = KTYP(keyval) - 0xf0;
keyval = KVAL(keyval);
printk( KERN_WARNING "Key with scancode %d ", scancode );
if (keytyp == KT_LATIN || keytyp == KT_LETTER) {
if (keyval < ' ')
printk( "('^%c') ", keyval + '@' );
else
printk( "('%c') ", keyval );
}
printk( "is broken -- will be ignored.\n" );
break;
}
else if (test_bit( scancode, broken_keys ))
break;
if (break_flag) {
del_timer( &atakeyb_rep_timer );
rep_scancode = 0;
}
else {
del_timer( &atakeyb_rep_timer );
rep_scancode = scancode;
atakeyb_rep_timer.expires = jiffies + key_repeat_delay;
atakeyb_rep_timer.prev = atakeyb_rep_timer.next = NULL;
add_timer( &atakeyb_rep_timer );
}
handle_scancode(scancode, !break_flag);
break;
}
break;
case AMOUSE:
kb_state.buf[kb_state.len++] = scancode;
if (kb_state.len == 5)
{
kb_state.state = KEYBOARD;
/* not yet used */
/* wake up someone waiting for this */
}
break;
case RMOUSE:
kb_state.buf[kb_state.len++] = scancode;
if (kb_state.len == 3)
{
kb_state.state = KEYBOARD;
if (atari_mouse_interrupt_hook)
atari_mouse_interrupt_hook(kb_state.buf);
}
break;
case JOYSTICK:
kb_state.buf[1] = scancode;
kb_state.state = KEYBOARD;
atari_joystick_interrupt(kb_state.buf);
break;
case CLOCK:
kb_state.buf[kb_state.len++] = scancode;
if (kb_state.len == 6)
{
kb_state.state = KEYBOARD;
/* wake up someone waiting for this.
But will this ever be used, as Linux keeps its own time.
Perhaps for synchronization purposes? */
/* wake_up_interruptible(&clock_wait); */
}
break;
case RESYNC:
if (kb_state.len <= 0 || IS_SYNC_CODE(scancode)) {
kb_state.state = KEYBOARD;
goto interpret_scancode;
}
kb_state.len--;
break;
}
}
#if 0
if (acia_stat & ACIA_CTS)
/* cannot happen */;
#endif
if (acia_stat & (ACIA_FE | ACIA_PE))
{
printk("Error in keyboard communication\n");
}
/* handle_scancode() can take a lot of time, so check again if
* some character arrived
*/
goto repeat;
}
/*
* I write to the keyboard without using interrupts, I poll instead.
* This takes for the maximum length string allowed (7) at 7812.5 baud
* 8 data 1 start 1 stop bit: 9.0 ms
* If this takes too long for normal operation, interrupt driven writing
* is the solution. (I made a feeble attempt in that direction but I
* kept it simple for now.)
*/
void ikbd_write(const char *str, int len)
{
u_char acia_stat;
if ((len < 1) || (len > 7))
panic("ikbd: maximum string length exceeded");
while (len)
{
acia_stat = acia.key_ctrl;
if (acia_stat & ACIA_TDRE)
{
acia.key_data = *str++;
len--;
}
}
}
/* Reset (without touching the clock) */
void ikbd_reset(void)
{
static const char cmd[2] = { 0x80, 0x01 };
ikbd_write(cmd, 2);
/* if all's well code 0xF1 is returned, else the break codes of
all keys making contact */
}
/* Set mouse button action */
void ikbd_mouse_button_action(int mode)
{
char cmd[2] = { 0x07, mode };
ikbd_write(cmd, 2);
}
/* Set relative mouse position reporting */
void ikbd_mouse_rel_pos(void)
{
static const char cmd[1] = { 0x08 };
ikbd_write(cmd, 1);
}
/* Set absolute mouse position reporting */
void ikbd_mouse_abs_pos(int xmax, int ymax)
{
char cmd[5] = { 0x09, xmax>>8, xmax&0xFF, ymax>>8, ymax&0xFF };
ikbd_write(cmd, 5);
}
/* Set mouse keycode mode */
void ikbd_mouse_kbd_mode(int dx, int dy)
{
char cmd[3] = { 0x0A, dx, dy };
ikbd_write(cmd, 3);
}
/* Set mouse threshold */
void ikbd_mouse_thresh(int x, int y)
{
char cmd[3] = { 0x0B, x, y };
ikbd_write(cmd, 3);
}
/* Set mouse scale */
void ikbd_mouse_scale(int x, int y)
{
char cmd[3] = { 0x0C, x, y };
ikbd_write(cmd, 3);
}
/* Interrogate mouse position */
void ikbd_mouse_pos_get(int *x, int *y)
{
static const char cmd[1] = { 0x0D };
ikbd_write(cmd, 1);
/* wait for returning bytes */
}
/* Load mouse position */
void ikbd_mouse_pos_set(int x, int y)
{
char cmd[6] = { 0x0E, 0x00, x>>8, x&0xFF, y>>8, y&0xFF };
ikbd_write(cmd, 6);
}
/* Set Y=0 at bottom */
void ikbd_mouse_y0_bot(void)
{
static const char cmd[1] = { 0x0F };
ikbd_write(cmd, 1);
}
/* Set Y=0 at top */
void ikbd_mouse_y0_top(void)
{
static const char cmd[1] = { 0x10 };
ikbd_write(cmd, 1);
}
/* Resume */
void ikbd_resume(void)
{
static const char cmd[1] = { 0x11 };
ikbd_write(cmd, 1);
}
/* Disable mouse */
void ikbd_mouse_disable(void)
{
static const char cmd[1] = { 0x12 };
ikbd_write(cmd, 1);
}
/* Pause output */
void ikbd_pause(void)
{
static const char cmd[1] = { 0x13 };
ikbd_write(cmd, 1);
}
/* Set joystick event reporting */
void ikbd_joystick_event_on(void)
{
static const char cmd[1] = { 0x14 };
ikbd_write(cmd, 1);
}
/* Set joystick interrogation mode */
void ikbd_joystick_event_off(void)
{
static const char cmd[1] = { 0x15 };
ikbd_write(cmd, 1);
}
/* Joystick interrogation */
void ikbd_joystick_get_state(void)
{
static const char cmd[1] = { 0x16 };
ikbd_write(cmd, 1);
}
#if 0
/* This disables all other ikbd activities !!!! */
/* Set joystick monitoring */
void ikbd_joystick_monitor(int rate)
{
static const char cmd[2] = { 0x17, rate };
ikbd_write(cmd, 2);
kb_state.state = JOYSTICK_MONITOR;
}
#endif
/* some joystick routines not in yet (0x18-0x19) */
/* Disable joysticks */
void ikbd_joystick_disable(void)
{
static const char cmd[1] = { 0x1A };
ikbd_write(cmd, 1);
}
/* Time-of-day clock set */
void ikbd_clock_set(int year, int month, int day, int hour, int minute, int second)
{
char cmd[7] = { 0x1B, year, month, day, hour, minute, second };
ikbd_write(cmd, 7);
}
/* Interrogate time-of-day clock */
void ikbd_clock_get(int *year, int *month, int *day, int *hour, int *minute, int second)
{
static const char cmd[1] = { 0x1C };
ikbd_write(cmd, 1);
}
/* Memory load */
void ikbd_mem_write(int address, int size, char *data)
{
panic("Attempt to write data into keyboard memory");
}
/* Memory read */
void ikbd_mem_read(int address, char data[6])
{
char cmd[3] = { 0x21, address>>8, address&0xFF };
ikbd_write(cmd, 3);
/* receive data and put it in data */
}
/* Controller execute */
void ikbd_exec(int address)
{
char cmd[3] = { 0x22, address>>8, address&0xFF };
ikbd_write(cmd, 3);
}
/* Status inquiries (0x87-0x9A) not yet implemented */
/* Set the state of the caps lock led. */
void atari_kbd_leds (unsigned int leds)
{
char cmd[6] = {32, 0, 4, 1, 254 + ((leds & 4) != 0), 0};
ikbd_write(cmd, 6);
}
/*
* The original code sometimes left the interrupt line of
* the ACIAs low forever. I hope, it is fixed now.
*
* Martin Rogge, 20 Aug 1995
*/
int __init atari_keyb_init(void)
{
/* setup key map */
memcpy(key_maps[0], ataplain_map, sizeof(plain_map));
memcpy(key_maps[1], atashift_map, sizeof(plain_map));
memcpy(key_maps[4], atactrl_map, sizeof(plain_map));
memcpy(key_maps[5], atashift_ctrl_map, sizeof(plain_map));
memcpy(key_maps[8], ataalt_map, sizeof(plain_map));
/* Atari doesn't have an altgr_map, so we can reuse its memory for
atashift_alt_map */
memcpy(key_maps[2], atashift_alt_map, sizeof(plain_map));
key_maps[9] = key_maps[2];
key_maps[2] = 0; /* ataaltgr_map */
memcpy(key_maps[12], atactrl_alt_map, sizeof(plain_map));
key_maps[13] = atashift_ctrl_alt_map;
keymap_count = 8;
/* say that we don't have an AltGr key */
keyboard_type = KB_84;
kb_state.state = KEYBOARD;
kb_state.len = 0;
request_irq(IRQ_MFP_ACIA, keyboard_interrupt, IRQ_TYPE_SLOW,
"keyboard/mouse/MIDI", keyboard_interrupt);
atari_turnoff_irq(IRQ_MFP_ACIA);
do {
/* reset IKBD ACIA */
acia.key_ctrl = ACIA_RESET |
(atari_switches & ATARI_SWITCH_IKBD) ? ACIA_RHTID : 0;
(void)acia.key_ctrl;
(void)acia.key_data;
/* reset MIDI ACIA */
acia.mid_ctrl = ACIA_RESET |
(atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
(void)acia.mid_ctrl;
(void)acia.mid_data;
/* divide 500kHz by 64 gives 7812.5 baud */
/* 8 data no parity 1 start 1 stop bit */
/* receive interrupt enabled */
/* RTS low (except if switch selected), transmit interrupt disabled */
acia.key_ctrl = (ACIA_DIV64|ACIA_D8N1S|ACIA_RIE) |
((atari_switches & ATARI_SWITCH_IKBD) ?
ACIA_RHTID : ACIA_RLTID);
acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S |
(atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
}
/* make sure the interrupt line is up */
while ((mfp.par_dt_reg & 0x10) == 0);
/* enable ACIA Interrupts */
mfp.active_edge &= ~0x10;
atari_turnon_irq(IRQ_MFP_ACIA);
ikbd_self_test = 1;
ikbd_reset();
/* wait for a period of inactivity (here: 0.25s), then assume the IKBD's
* self-test is finished */
self_test_last_rcv = jiffies;
while (time_before(jiffies, self_test_last_rcv + HZ/4))
barrier();
/* if not incremented: no 0xf1 received */
if (ikbd_self_test == 1)
printk( KERN_ERR "WARNING: keyboard self test failed!\n" );
ikbd_self_test = 0;
ikbd_mouse_disable();
ikbd_joystick_disable();
atari_joystick_init();
return 0;
}
int atari_kbdrate( struct kbd_repeat *k )
{
if (k->delay > 0) {
/* convert from msec to jiffies */
key_repeat_delay = (k->delay * HZ + 500) / 1000;
if (key_repeat_delay < 1)
key_repeat_delay = 1;
}
if (k->rate > 0) {
key_repeat_rate = (k->rate * HZ + 500) / 1000;
if (key_repeat_rate < 1)
key_repeat_rate = 1;
}
k->delay = key_repeat_delay * 1000 / HZ;
k->rate = key_repeat_rate * 1000 / HZ;
return( 0 );
}
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:45:46
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick
In directory usw-pr-cvs1:/tmp/cvs-serv20763
Added Files:
atarijoy.c
Log Message:
--- NEW FILE: atarijoy.c ---
/*
* Atari Joystick Driver for Linux
* by Robert de Vries (ro...@an...) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*/
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/major.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
void atari_joystick_interrupt(char*);
int atari_joystick_init(void);
extern int atari_mouse_buttons;
struct joystick_status {
char fire;
char dir;
int ready;
int active;
wait_queue_head_t wait;
};
#include <asm/atarikb.h>
#include <asm/uaccess.h>
#define MAJOR_NR JOYSTICK_MAJOR
#define ANALOG_JOY(n) (!(n & 0x80))
#define DIGITAL_JOY(n) (n & 0x80)
#define DEVICE_NR(n) (MINOR(n) & 0x7f)
static struct joystick_status joystick[2];
int atari_mouse_buttons; /* for three-button mouse */
void atari_joystick_interrupt(char *buf)
{
int j;
/* ikbd_joystick_disable(); */
j = buf[0] & 0x1;
joystick[j].dir = buf[1] & 0xF;
joystick[j].fire = (buf[1] & 0x80) >> 7;
joystick[j].ready = 1;
wake_up_interruptible(&joystick[j].wait);
/* For three-button mouse emulation fake a mouse packet */
if (atari_mouse_interrupt_hook &&
j == 1 && (buf[1] & 1) != ((atari_mouse_buttons & 2) >> 1))
{
char faked_packet[3];
atari_mouse_buttons = (atari_mouse_buttons & 5) | ((buf[1] & 1) << 1);
faked_packet[0] = (atari_mouse_buttons & 1) |
(atari_mouse_buttons & 4 ? 2 : 0);
faked_packet[1] = 0;
faked_packet[2] = 0;
atari_mouse_interrupt_hook (faked_packet);
}
/* ikbd_joystick_event_on(); */
}
static int release_joystick(struct inode *inode, struct file *file)
{
int minor = DEVICE_NR(inode->i_rdev);
joystick[minor].active = 0;
joystick[minor].ready = 0;
if ((joystick[0].active == 0) && (joystick[1].active == 0))
ikbd_joystick_disable();
return 0;
}
static int open_joystick(struct inode *inode, struct file *file)
{
int minor = DEVICE_NR(inode->i_rdev);
if (!DIGITAL_JOY(inode->i_rdev) || minor > 1)
return -ENODEV;
if (joystick[minor].active)
return -EBUSY;
joystick[minor].active = 1;
joystick[minor].ready = 0;
ikbd_joystick_event_on();
return 0;
}
static ssize_t write_joystick(struct file *file, const char *buffer,
size_t count, loff_t *ppos)
{
return -EINVAL;
}
static ssize_t read_joystick(struct file *file, char *buffer, size_t count,
loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
int minor = DEVICE_NR(inode->i_rdev);
if (count < 2)
return -EINVAL;
if (!joystick[minor].ready)
return -EAGAIN;
joystick[minor].ready = 0;
if (put_user(joystick[minor].fire, buffer++) ||
put_user(joystick[minor].dir, buffer++))
return -EFAULT;
if (count > 2)
if (clear_user(buffer, count - 2))
return -EFAULT;
return count;
}
static unsigned int joystick_poll(struct file *file, poll_table *wait)
{
int minor = DEVICE_NR(file->f_dentry->d_inode->i_rdev);
poll_wait(file, &joystick[minor].wait, wait);
if (joystick[minor].ready)
return POLLIN | POLLRDNORM;
return 0;
}
struct file_operations atari_joystick_fops = {
read: read_joystick,
write: write_joystick,
poll: joystick_poll,
open: open_joystick,
release: release_joystick,
};
int __init atari_joystick_init(void)
{
joystick[0].active = joystick[1].active = 0;
joystick[0].ready = joystick[1].ready = 0;
init_waitqueue_head(&joystick[0].wait);
init_waitqueue_head(&joystick[1].wait);
if (devfs_register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops))
printk("unable to get major %d for joystick devices\n", MAJOR_NR);
devfs_register_series (NULL, "joysticks/digital%u", 2, DEVFS_FL_DEFAULT,
MAJOR_NR, 128, S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&atari_joystick_fops, NULL);
return 0;
}
|
|
From: James S. <jsi...@us...> - 2002-01-23 06:43:57
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/touchscreen In directory usw-pr-cvs1:/tmp/cvs-serv20483 Modified Files: Config.in Log Message: Finished adding iPAQ driver. Index: Config.in =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/touchscreen/Config.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Config.in 2002/01/23 05:37:26 1.2 +++ Config.in 2002/01/23 06:43:54 1.3 @@ -4,4 +4,6 @@ bool 'Touchscreens' CONFIG_INPUT_TS +if [ "$CONFIG_SA1100_BITSY" = "y" ]; then +dep_tristate ' Compaq iPAQ H3600 (Bitsy) touchscreen input driver' CONFIG_TS_BITSY $CONFIG_INPUT $CONFIG_INPUT_TS $CONFIG_SERIO dep_tristate ' Gunze AHL-51S touchscreen' CONFIG_TS_GUNZE $CONFIG_INPUT $CONFIG_INPUT_TS $CONFIG_SERIO |
|
From: James S. <jsi...@us...> - 2002-01-23 06:41:00
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/touchscreen In directory usw-pr-cvs1:/tmp/cvs-serv19925 Modified Files: Makefile Log Message: Moved iPAQ touchscreen here. Index: Makefile =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/touchscreen/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 2002/01/23 05:37:52 1.1 +++ Makefile 2002/01/23 06:40:56 1.2 @@ -8,6 +8,7 @@ # Each configuration option enables a list of files. +obj-$(CONFIG_TS_BITSY) += h3600_ts_input.o obj-$(CONFIG_TS_GUNZE) += gunze.o # The global Rules.make. |
|
From: James S. <jsi...@us...> - 2002-01-23 06:39:40
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/touchscreen
In directory usw-pr-cvs1:/tmp/cvs-serv19650
Added Files:
Tag: 1.4
h3600_ts_input.c
Log Message:
Moving around.
--- NEW FILE: h3600_ts_input.c ---
/*
* $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $
*
* Copyright (c) 2001 "Crazy" James Simmons jsi...@tr...
*
* Sponsored by Transvirtual Technology.
*
* Derived from the code in h3600_ts.[ch] by Charles Flynn
*/
/*
* Driver for the h3600 Touch Screen and other Atmel controlled devices.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so by
* e-mail - mail your message to <jsi...@tr...>.
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
/* SA1100 serial defines */
#include <asm/arch/hardware.h>
#include <asm/arch/irqs.h>
/*
* Definitions & global arrays.
*/
/* The start and end of frame characters SOF and EOF */
#define CHAR_SOF 0x02
#define CHAR_EOF 0x03
#define FRAME_OVERHEAD 3 /* CHAR_SOF,CHAR_EOF,LENGTH = 3 */
/*
Atmel events and response IDs contained in frame.
Programmer has no control over these numbers.
TODO there are holes - specifically 1,7,0x0a
*/
#define VERSION_ID 0 /* Get Version (request/respose) */
#define KEYBD_ID 2 /* Keyboard (event) */
#define TOUCHS_ID 3 /* Touch Screen (event)*/
#define EEPROM_READ_ID 4 /* (request/response) */
#define EEPROM_WRITE_ID 5 /* (request/response) */
#define THERMAL_ID 6 /* (request/response) */
#define NOTIFY_LED_ID 8 /* (request/response) */
#define BATTERY_ID 9 /* (request/response) */
#define SPI_READ_ID 0x0b /* ( request/response) */
#define SPI_WRITE_ID 0x0c /* ( request/response) */
#define FLITE_ID 0x0d /* backlight ( request/response) */
#define STX_ID 0xa1 /* extension pack status (req/resp) */
#define MAX_ID 14
#define H3600_MAX_LENGTH 16
#define H3600_KEY 0xf
#define H3600_SCANCODE_RECORD 1 /* 1 -> record button */
#define H3600_SCANCODE_CALENDAR 2 /* 2 -> calendar */
#define H3600_SCANCODE_CONTACTS 3 /* 3 -> contact */
#define H3600_SCANCODE_Q 4 /* 4 -> Q button */
#define H3600_SCANCODE_START 5 /* 5 -> start menu */
#define H3600_SCANCODE_UP 6 /* 6 -> up */
#define H3600_SCANCODE_RIGHT 7 /* 7 -> right */
#define H3600_SCANCODE_LEFT 8 /* 8 -> left */
#define H3600_SCANCODE_DOWN 9 /* 9 -> down */
static char *h3600_name = "H3600 TouchScreen";
/*
* Per-touchscreen data.
*/
struct h3600_dev {
struct input_dev dev;
struct serio *serio;
unsigned char event; /* event ID from packet */
unsigned char chksum;
unsigned char len;
unsigned char idx;
unsigned char buf[H3600_MAX_LENGTH];
char phys[32];
};
static void action_button_handler(int irq, void *dev_id, struct pt_regs *regs)
{
int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1;
struct input_dev *dev = (struct input_dev *) dev_id;
input_report_key(dev, KEY_ENTER, down);
}
static void npower_button_handler(int irq, void *dev_id, struct pt_regs *regs)
{
int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1;
struct input_dev *dev = (struct input_dev *) dev_id;
/*
* This interrupt is only called when we release the key. So we have
* to fake a key press.
*/
input_report_key(dev, KEY_SUSPEND, 1);
input_report_key(dev, KEY_SUSPEND, down);
}
#ifdef CONFIG_PM
static int flite_brightness = 25;
enum flite_pwr {
FLITE_PWR_OFF = 0,
FLITE_PWR_ON = 1
};
/*
* h3600_flite_power: enables or disables power to frontlight, using last bright */
unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr)
{
unsigned char brightness = ((pwr==FLITE_PWR_OFF) ? 0:flite_brightness);
struct h3600_dev *ts = dev->private;
/* Must be in this order */
ts->serio->write(ts->serio, 1);
ts->serio->write(ts->serio, pwr);
ts->serio->write(ts->serio, brightness);
return 0;
}
static int suspended = 0;
static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req,
void *data)
{
struct input_dev *dev = (struct input_dev *) data;
switch (req) {
case PM_SUSPEND: /* enter D1-D3 */
suspended = 1;
h3600_flite_power(dev, FLITE_PWR_OFF);
break;
case PM_BLANK:
if (!suspended)
h3600_flite_power(dev, FLITE_PWR_OFF);
break;
case PM_RESUME: /* enter D0 */
/* same as unblank */
case PM_UNBLANK:
if (suspended) {
//initSerial();
suspended = 0;
}
h3600_flite_power(dev, FLITE_PWR_ON);
break;
}
return 0;
}
#endif
/*
* This function translates the native event packets to linux input event
* packets. Some packets coming from serial are not touchscreen related. In
* this case we send them off to be processed elsewhere.
*/
static void h3600ts_process_packet(struct h3600_dev *ts)
{
struct input_dev *dev = &ts->dev;
static int touched = 0;
int key, down = 0;
switch (ts->event) {
/*
Buttons - returned as a single byte
7 6 5 4 3 2 1 0
S x x x N N N N
S switch state ( 0=pressed 1=released)
x Unused.
NNNN switch number 0-15
Note: This is true for non interrupt generated key events.
*/
case KEYBD_ID:
down = (ts->buf[0] & 0x80) ? 0 : 1;
switch (ts->buf[0] & 0x7f) {
case H3600_SCANCODE_RECORD:
key = KEY_RECORD;
break;
case H3600_SCANCODE_CALENDAR:
key = KEY_PROG1;
break;
case H3600_SCANCODE_CONTACTS:
key = KEY_PROG2;
break;
case H3600_SCANCODE_Q:
key = KEY_Q;
break;
case H3600_SCANCODE_START:
key = KEY_PROG3;
break;
case H3600_SCANCODE_UP:
key = KEY_UP;
break;
case H3600_SCANCODE_RIGHT:
key = KEY_RIGHT;
break;
case H3600_SCANCODE_LEFT:
key = KEY_LEFT;
break;
case H3600_SCANCODE_DOWN:
key = KEY_DOWN;
break;
default:
key = 0;
}
if (key)
input_report_key(dev, key, down);
break;
/*
* Native touchscreen event data is formatted as shown below:-
*
* +-------+-------+-------+-------+
* | Xmsb | Xlsb | Ymsb | Ylsb |
* +-------+-------+-------+-------+
* byte 0 1 2 3
*/
case TOUCHS_ID:
if (!touched) {
input_report_key(dev, BTN_TOUCH, 1);
touched = 1;
}
if (ts->len) {
unsigned short x, y;
x = ts->buf[0]; x <<= 8; x += ts->buf[1];
y = ts->buf[2]; y <<= 8; y += ts->buf[3];
input_report_abs(dev, ABS_X, x);
input_report_abs(dev, ABS_Y, y);
} else {
input_report_key(dev, BTN_TOUCH, 0);
touched = 0;
}
break;
default:
/* Send a non input event elsewhere */
break;
}
}
/*
* h3600ts_event() handles events from the input module.
*/
static int h3600ts_event(struct input_dev *dev, unsigned int type,
unsigned int code, int value)
{
struct h3600_dev *ts = dev->private;
switch (type) {
case EV_LED: {
// ts->serio->write(ts->serio, SOME_CMD);
return 0;
}
}
return -1;
}
/*
Frame format
byte 1 2 3 len + 4
+-------+---------------+---------------+--=------------+
|SOF |id |len | len bytes | Chksum |
+-------+---------------+---------------+--=------------+
bit 0 7 8 11 12 15 16
+-------+---------------+-------+
|SOF |id |0 |Chksum | - Note Chksum does not include SOF
+-------+---------------+-------+
bit 0 7 8 11 12 15 16
*/
static int state;
/* decode States */
#define STATE_SOF 0 /* start of FRAME */
#define STATE_ID 1 /* state where we decode the ID & len */
#define STATE_DATA 2 /* state where we decode data */
#define STATE_EOF 3 /* state where we decode checksum or EOF */
static void h3600ts_interrupt(struct serio *serio, unsigned char data,
unsigned int flags)
{
struct h3600_dev *ts = serio->private;
/*
* We have a new frame coming in.
*/
switch (state) {
case STATE_SOF:
if (data == CHAR_SOF)
state = STATE_ID;
return;
case STATE_ID:
ts->event = (data & 0xf0) >> 4;
ts->len = (data & 0xf);
ts->idx = 0;
if (ts->event >= MAX_ID) {
state = STATE_SOF;
break;
}
ts->chksum = data;
state=(ts->len > 0 ) ? STATE_DATA : STATE_EOF;
break;
case STATE_DATA:
ts->chksum += data;
ts->buf[ts->idx]= data;
if(++ts->idx == ts->len)
state = STATE_EOF;
break;
case STATE_EOF:
state = STATE_SOF;
if (data == CHAR_EOF || data == ts->chksum )
h3600ts_process_packet(ts);
break;
default:
printk("Error3\n");
break;
}
}
/*
* h3600ts_connect() is the routine that is called when someone adds a
* new serio device. It looks whether it was registered as a H3600 touchscreen
* and if yes, registers it as an input device.
*/
static void h3600ts_connect(struct serio *serio, struct serio_dev *dev)
{
struct h3600_dev *ts;
if (serio->type != (SERIO_RS232 | SERIO_H3600))
return;
if (!(ts = kmalloc(sizeof(struct h3600_dev), GFP_KERNEL)))
return;
memset(ts, 0, sizeof(struct h3600_dev));
/* Device specific stuff */
set_GPIO_IRQ_edge( GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES );
set_GPIO_IRQ_edge( GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE );
if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler,
SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
"h3600_action", &ts->dev)) {
printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
kfree(ts);
return;
}
if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
"h3600_suspend", &ts->dev)) {
free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev);
printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n");
kfree(ts);
return;
}
/* Now we have things going we setup our input device */
ts->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR);
ts->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
ts->dev.ledbit[0] = BIT(LED_SLEEP);
ts->dev.absmin[ABS_X] = 60; ts->dev.absmin[ABS_Y] = 35;
ts->dev.absmax[ABS_X] = 985; ts->dev.absmax[ABS_Y] = 1024;
ts->dev.absfuzz[ABS_X] = 0; ts->dev.absfuzz[ABS_Y] = 0;
ts->serio = serio;
serio->private = ts;
set_bit(KEY_RECORD, ts->dev.keybit);
set_bit(KEY_Q, ts->dev.keybit);
set_bit(KEY_PROG1, ts->dev.keybit);
set_bit(KEY_PROG2, ts->dev.keybit);
set_bit(KEY_PROG3, ts->dev.keybit);
set_bit(KEY_UP, ts->dev.keybit);
set_bit(KEY_RIGHT, ts->dev.keybit);
set_bit(KEY_LEFT, ts->dev.keybit);
set_bit(KEY_DOWN, ts->dev.keybit);
set_bit(KEY_ENTER, ts->dev.keybit);
ts->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
ts->dev.keybit[LONG(KEY_SUSPEND)] |= BIT(KEY_SUSPEND);
sprintf(ts->phys, "%s/input0", serio->phys);
ts->dev.event = h3600ts_event;
ts->dev.private = ts;
ts->dev.name = h3600_name;
ts->dev.phys = ts->phys;
ts->dev.idbus = BUS_RS232;
ts->dev.idvendor = SERIO_H3600;
ts->dev.idproduct = 0x0666; /* FIXME !!! We can ask the hardware */
ts->dev.idversion = 0x0100;
if (serio_open(serio, dev)) {
free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts);
free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts);
kfree(ts);
return;
}
//h3600_flite_control(1, 25); /* default brightness */
#ifdef CONFIG_PM
ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT,
h3600ts_pm_callback);
printk("registered pm callback\n");
#endif
input_register_device(&ts->dev);
printk(KERN_INFO "input: %s on %s\n", h3600_name, serio->phys);
}
/*
* h3600ts_disconnect() is the opposite of h3600ts_connect()
*/
static void h3600ts_disconnect(struct serio *serio)
{
struct h3600_dev *ts = serio->private;
free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev);
free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, &ts->dev);
input_unregister_device(&ts->dev);
serio_close(serio);
kfree(ts);
}
/*
* The serio device structure.
*/
static struct serio_dev h3600ts_dev = {
interrupt: h3600ts_interrupt,
connect: h3600ts_connect,
disconnect: h3600ts_disconnect,
};
/*
* The functions for inserting/removing us as a module.
*/
static int __init h3600ts_init(void)
{
serio_register_device(&h3600ts_dev);
return 0;
}
static void __exit h3600ts_exit(void)
{
serio_unregister_device(&h3600ts_dev);
}
module_init(h3600ts_init);
module_exit(h3600ts_exit);
|