summaryrefslogtreecommitdiff
path: root/packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P07-C3000-KBDDEV_041206.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P07-C3000-KBDDEV_041206.patch')
-rw-r--r--packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P07-C3000-KBDDEV_041206.patch115
1 files changed, 115 insertions, 0 deletions
diff --git a/packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P07-C3000-KBDDEV_041206.patch b/packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P07-C3000-KBDDEV_041206.patch
new file mode 100644
index 0000000000..b82be1551d
--- /dev/null
+++ b/packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050602/P07-C3000-KBDDEV_041206.patch
@@ -0,0 +1,115 @@
+diff -Nur c3000_pre/linux/drivers/char/Config.in c3000_work/linux/drivers/char/Config.in
+--- c3000_pre/linux/drivers/char/Config.in 2004-12-06 17:24:32.000000000 +0900
++++ c3000_work/linux/drivers/char/Config.in 2004-12-06 17:25:51.000000000 +0900
+@@ -171,6 +171,7 @@
+ bool ' SL-series Bluetooth support' CONFIG_BLUETOOTH_SL
+ fi
+ fi
++bool 'Use Keyboard device file (EXPERIMENTAL)' CONFIG_KBD_DEV_FILE
+ if [ "$CONFIG_ARCH_DBMX1" = "y" ]; then
+ tristate 'DragonBall MX1 serial port support' CONFIG_SERIAL_DBMX1
+ if [ "$CONFIG_SERIAL_DBMX1" = "y" ]; then
+diff -Nur c3000_pre/linux/drivers/char/keyboard.c c3000_work/linux/drivers/char/keyboard.c
+--- c3000_pre/linux/drivers/char/keyboard.c 2004-08-21 09:48:25.000000000 +0900
++++ c3000_work/linux/drivers/char/keyboard.c 2004-12-06 17:32:08.000000000 +0900
+@@ -35,6 +35,7 @@
+
+ #include <asm/keyboard.h>
+ #include <asm/bitops.h>
++#include <asm/uaccess.h>
+
+ #include <linux/kbd_kern.h>
+ #include <linux/kbd_diacr.h>
+@@ -921,12 +922,35 @@
+
+ pm_callback pm_kbd_request_override = NULL;
+
++#if defined(CONFIG_KBD_DEV_FILE)
++#define KBD_MAJOR 241
++struct fasync_struct *fasync_kbd;
++
++static int kbd_open(struct inode *, struct file *);
++static int kbd_release(struct inode *, struct file *);
++static int kbd_fasync(int fd, struct file *filp, int on);
++static ssize_t kbd_read(struct file *, char *, size_t, loff_t *);
++static ssize_t kbd_write(struct file *, const char *, size_t, loff_t *);
++
++struct file_operations kbd_fops = {
++ open: kbd_open,
++ release: kbd_release,
++ fasync: kbd_fasync,
++ read: kbd_read,
++ write: kbd_write,
++};
++#endif
++
+ int __init kbd_init(void)
+ {
+ int i;
+ struct kbd_struct kbd0;
+ extern struct tty_driver console_driver;
+
++#if defined(CONFIG_KBD_DEV_FILE)
++ if ( register_chrdev(KBD_MAJOR,"kbd",&kbd_fops) )
++ printk("unable to get major %d for keyboard\n", KBD_MAJOR);
++#endif
+ kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS;
+ kbd0.ledmode = LED_SHOW_FLAGS;
+ kbd0.lockstate = KBD_DEFLOCK;
+@@ -948,3 +972,56 @@
+
+ return 0;
+ }
++
++#if defined(CONFIG_KBD_DEV_FILE)
++static int kbd_open(struct inode *inode, struct file *file)
++{
++ kdev_t dev = inode->i_rdev;
++
++ return 0;
++}
++
++
++static int kbd_release(struct inode *inode, struct file *file)
++{
++ kbd_fasync(-1, file, 0);
++ return 0;
++}
++
++static int kbd_fasync(int fd, struct file *filp, int on)
++{
++ int retval;
++
++ retval = fasync_helper(fd, filp, on, &fasync_kbd);
++ if (retval < 0)
++ return retval;
++ return 0;
++}
++
++static ssize_t kbd_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
++{
++// printk("kbd read\n");
++ return 0;
++}
++
++static ssize_t kbd_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
++{
++ char tmp[50];
++ int len;
++ int kbd_scancode,kbd_down;
++
++ len=49;
++
++ if(len>count) len=count;
++ copy_from_user(tmp,buffer,len);
++ tmp[len]='\0';
++
++ if (sscanf(tmp,"%d %d",&kbd_scancode, &kbd_down) == 2) {
++// printk("kbd write %02x %02x\n",kbd_scancode,kbd_down);
++ handle_scancode(kbd_scancode,kbd_down);
++ }
++
++// printk("kbd write\n");
++ return count;
++}
++#endif