* [patch] Amiga input driver compile fixes
@ 2002-08-20 13:38 Vojtech Pavlik
2002-08-21 17:10 ` [patch 1/2] Fix shift-pgup problems in i8042.c Vojtech Pavlik
0 siblings, 1 reply; 6+ messages in thread
From: Vojtech Pavlik @ 2002-08-20 13:38 UTC (permalink / raw)
To: torvalds, linux-kernel
Hi!
Geert fixed the input drivers on Amiga to at least compile properly.
===================================================================
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.
===================================================================
ChangeSet@1.490, 2002-08-19 11:20:09+02:00, geert@linux-m68k.org
Compile fixes for Amiga input drivers
joystick/Config.help | 4 ++--
joystick/Config.in | 2 +-
joystick/amijoy.c | 31 +++++++++++++++----------------
keyboard/amikbd.c | 25 +++++++++++++------------
mouse/amimouse.c | 9 +++++----
5 files changed, 36 insertions(+), 35 deletions(-)
===================================================================
diff -Nru a/drivers/input/joystick/Config.help b/drivers/input/joystick/Config.help
--- a/drivers/input/joystick/Config.help Tue Aug 20 15:35:25 2002
+++ b/drivers/input/joystick/Config.help Tue Aug 20 15:35:25 2002
@@ -203,13 +203,13 @@
The module will be called turbografx.o. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
-CONFIG_JOYSTICK_AMIJOY
+CONFIG_JOYSTICK_AMIGA
Say Y here if you have an Amiga with a digital joystick connected
to it.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
- The module will be called joy-amiga.o. If you want to compile it as
+ The module will be called amijoy.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
CONFIG_INPUT_JOYDUMP
diff -Nru a/drivers/input/joystick/Config.in b/drivers/input/joystick/Config.in
--- a/drivers/input/joystick/Config.in Tue Aug 20 15:35:25 2002
+++ b/drivers/input/joystick/Config.in Tue Aug 20 15:35:25 2002
@@ -28,7 +28,7 @@
dep_tristate ' Multisystem joysticks via TurboGraFX device' CONFIG_JOYSTICK_TURBOGRAFX $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK $CONFIG_PARPORT
if [ "$CONFIG_AMIGA" = "y" ]; then
- dep_tristate ' Amiga joysticks' CONFIG_JOYSTICK_AMIJOY $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
+ dep_tristate ' Amiga joysticks' CONFIG_JOYSTICK_AMIGA $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
fi
dep_tristate ' Gameport data dumper' CONFIG_INPUT_JOYDUMP $CONFIG_INPUT $CONFIG_INPUT_JOYSTICK
diff -Nru a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
--- a/drivers/input/joystick/amijoy.c Tue Aug 20 15:35:25 2002
+++ b/drivers/input/joystick/amijoy.c Tue Aug 20 15:35:25 2002
@@ -37,6 +37,7 @@
#include <asm/system.h>
#include <asm/amigahw.h>
+#include <asm/amigaints.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Driver for Amiga joysticks");
@@ -78,13 +79,13 @@
if ((*used)++)
return 0;
-
- if (request_irq(IRQ_AMIGA_VERTB, amijoy_interrupt, 0, "amijoy", NULL)) {
+
+ if (request_irq(IRQ_AMIGA_VERTB, amijoy_interrupt, 0, "amijoy", amijoy_interrupt)) {
(*used)--;
- printk(KERN_ERR "amijoy.c: Can't allocate irq %d\n", amijoy_irq);
+ printk(KERN_ERR "amijoy.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB);
return -EBUSY;
}
-
+
return 0;
}
@@ -99,8 +100,9 @@
static int __init amijoy_setup(char *str)
{
int i;
- int ints[4]
- str = get_options(str, ARRAY_SIZE(ints), ints);
+ int ints[4];
+
+ str = get_options(str, ARRAY_SIZE(ints), ints);
for (i = 0; i <= ints[0] && i < 2; i++) amijoy[i] = ints[i+1];
return 1;
}
@@ -110,9 +112,6 @@
{
int i, j;
- init_timer(amijoy_timer);
- port->timer.function = amijoy_timer;
-
for (i = 0; i < 2; i++)
if (amijoy[i]) {
if (!request_mem_region(CUSTOM_PHYSADDR+10+i*2, 2,
@@ -134,12 +133,12 @@
amijoy_dev[i].absmax[ABS_X + j] = 1;
}
- amijoy->dev[i].name = amijoy_name;
- amijoy->dev[i].phys = amijoy_phys[i];
- amijoy->dev[i].id.bustype = BUS_AMIGA;
- amijoy->dev[i].id.vendor = 0x0001;
- amijoy->dev[i].id.product = 0x0003;
- amijoy->dev[i].id.version = 0x0100;
+ amijoy_dev[i].name = amijoy_name;
+ amijoy_dev[i].phys = amijoy_phys[i];
+ amijoy_dev[i].id.bustype = BUS_AMIGA;
+ amijoy_dev[i].id.vendor = 0x0001;
+ amijoy_dev[i].id.product = 0x0003;
+ amijoy_dev[i].id.version = 0x0100;
amijoy_dev[i].private = amijoy_used + i;
@@ -149,7 +148,7 @@
return 0;
}
-static void _exit amijoy_exit(void)
+static void __exit amijoy_exit(void)
{
int i;
diff -Nru a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
--- a/drivers/input/keyboard/amikbd.c Tue Aug 20 15:35:25 2002
+++ b/drivers/input/keyboard/amikbd.c Tue Aug 20 15:35:25 2002
@@ -34,6 +34,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
+#include <linux/delay.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
@@ -51,9 +52,9 @@
57, 14, 15, 96, 28, 1,111, 0, 0, 0, 74, 0,103,108,106,105,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 98, 55, 78, 87,
42, 54, 58, 29, 56,100
-}
+};
-static char *amikbd_messages[] = {
+static const char *amikbd_messages[8] = {
KERN_ALERT "amikbd: Ctrl-Amiga-Amiga reset warning!!\n",
KERN_WARNING "amikbd: keyboard lost sync\n",
KERN_WARNING "amikbd: keyboard buffer overflow\n",
@@ -79,19 +80,19 @@
ciaa.cra &= ~0x40; /* switch CIA serial port to input mode */
down = scancode & 1; /* lowest bit is release bit */
- scancode = scancode >> 1;
+ scancode >>= 1;
if (scancode < 0x78) { /* scancodes < 0x78 are keys */
scancode = amikbd_keycode[scancode];
-
- if (scancode == KEY_CAPS) { /* CapsLock is a toggle switch key on Amiga */
+
+ if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */
input_report_key(&amikbd_dev, scancode, 1);
input_report_key(&amikbd_dev, scancode, 0);
input_sync(&amikbd_dev);
return;
}
-
+
input_report_key(&amikbd_dev, scancode, down);
input_sync(&amikbd_dev);
@@ -106,20 +107,20 @@
int i;
if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
- return -EIO;
+ return -EIO;
- if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
+ if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
- amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+ amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
amikbd_dev.keycode = amikbd_keycode;
-
- for (i = 0; i < 0x78; i++)
+
+ for (i = 0; i < 0x78; i++)
if (amikbd_keycode[i])
set_bit(amikbd_keycode[i], amikbd_dev.keybit);
ciaa.cra &= ~0x41; /* serial data in, turn off TA */
- request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", NULL);
+ request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt);
amikbd_dev.name = amikbd_name;
amikbd_dev.phys = amikbd_phys;
diff -Nru a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c
--- a/drivers/input/mouse/amimouse.c Tue Aug 20 15:35:25 2002
+++ b/drivers/input/mouse/amimouse.c Tue Aug 20 15:35:25 2002
@@ -64,7 +64,7 @@
input_report_rel(&amimouse_dev, REL_X, dx);
input_report_rel(&amimouse_dev, REL_Y, dy);
-
+
input_report_key(&amimouse_dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(&amimouse_dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(&amimouse_dev, BTN_RIGHT, potgor & 0x0400);
@@ -84,9 +84,9 @@
amimouse_lastx = joy0dat & 0xff;
amimouse_lasty = joy0dat >> 8;
- if (request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", NULL)) {
+ if (request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", amimouse_interrupt)) {
amimouse_used--;
- printk(KERN_ERR "amimouse.c: Can't allocate irq %d\n", amimouse_irq);
+ printk(KERN_ERR "amimouse.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB);
return -EBUSY;
}
@@ -116,10 +116,11 @@
amimouse_dev.id.vendor = 0x0001;
amimouse_dev.id.product = 0x0002;
amimouse_dev.id.version = 0x0100;
-
+
input_register_device(&amimouse_dev);
printk(KERN_INFO "input: %s at joy0dat\n", amimouse_name);
+ return 0;
}
static void __exit amimouse_exit(void)
===================================================================
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch13023
M'XL(`)U%8CT``\U9;7/:2!+^C'Y%GW-7,;&!&;TAR#H5@MDLYVSLPTZJ<DF*
M$M(`LT82JQEA>X_[[]<S$@X&0C";;!VX1M)HU-,O3S_=PD_@G6!ILS1+?I,L
M&!M/X)=$R&9)9()5@S_PNI<D>%T;)Q&K%:MJ@^L:CZ>9-/#^A2^#,<Q8*IHE
M6K7N9^3=E#5+O<[K=V]:/<,X.8'VV(]'[))).#DQ9)+._$DH7OIR/$GBJDS]
M6$1,^M4@B>;W2^<F(29^'5JWB./.J4OL^CR@(:6^35E(3-MS;6/FQV&:S-C+
M65`-9IE$U5=E>-0U+:=.S+GI>M0R3H%6[08!8M:(5Z,-H+1IDB9I'!&S20B,
M&$OERPF/L]M*Y'K7U20=P9$#%6*\@N^K?=L(H)U$4SYA,.2W3,`P2:$5\9$/
MVL\0IEQYV#@#TW8:CG'QQ9E&Y9$?PR`^,5[`5(5ILP'%=K5@[*>UWY([(7EP
M76LG\9"/JF,VF2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z4D?/BUELXX$]C;W_S30C;S(HI.AZ3AUVZT;
*_P--*'V8H1@`````
`
end
--
Vojtech Pavlik
SuSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 1/2] Fix shift-pgup problems in i8042.c
2002-08-20 13:38 [patch] Amiga input driver compile fixes Vojtech Pavlik
@ 2002-08-21 17:10 ` Vojtech Pavlik
[not found] ` <20020821191227.B6014@ucw.cz>
0 siblings, 1 reply; 6+ messages in thread
From: Vojtech Pavlik @ 2002-08-21 17:10 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: torvalds, linux-kernel
Hi!
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.
===================================================================
ChangeSet@1.510, 2002-08-21 19:00:13+02:00, vojtech@suse.cz
Fix i8042.c to ignore fake key releases generated by AT keyboard
in translated set 2. This fixes a problem where shift-pgup, with
the pgup released first generated an unknown scancode warning and
the shift remained stuck.
i8042.c | 4 ++++
1 files changed, 4 insertions(+)
===================================================================
diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c Wed Aug 21 19:00:39 2002
+++ b/drivers/input/serio/i8042.c Wed Aug 21 19:00:39 2002
@@ -54,6 +54,7 @@
static struct serio i8042_aux_port;
static unsigned char i8042_initial_ctr;
static unsigned char i8042_ctr;
+static unsigned char i8042_last_e0;
struct timer_list i8042_timer;
#ifdef I8042_DEBUG_IO
@@ -366,12 +367,15 @@
if (data > 0x7f) {
if (test_and_clear_bit(data & 0x7f, i8042_unxlate_seen)) {
serio_interrupt(&i8042_kbd_port, 0xf0, dfl);
+ if (i8042_last_e0 && (data == 0xaa || data == 0xb6))
+ set_bit(data & 0x7f, i8042_unxlate_seen);
data = i8042_unxlate_table[data & 0x7f];
}
} else {
set_bit(data, i8042_unxlate_seen);
data = i8042_unxlate_table[data];
}
+ i8042_last_e0 = (data == 0xe0);
}
serio_interrupt(&i8042_kbd_port, data, dfl);
}
===================================================================
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch5769
M'XL(`#?'8ST``[54;4_;,!#^7/^*DY`0")J<G==VZ@1C;$.;-,3@<^4Z;N,U
M=:K8H67*CY_3E@*58*\D413[[IX[^7F>[,&-D56_<UM^MU+D9`\^E<;V.Z8V
MTA,_W/JJ+-W:S\N9]#=9_FCJ*SVO+7'Q2VY%#K>R,OT.]8+MCKV;RW[GZOSC
MS9?3*T(&`SC+N9[(;]+"8$!L6=WR(C,GW.9%J3U;<6UFTG)/E+-FF]HP1.;N
MB"8!1G%#8PR31M",4AY2F2$+TS@DF\%.-F/OUJ>,8N3>81,QEL;D/5`OH@C(
M?$Q]1H'V^HA]&APA<Q^P`P='%+I(WL'_'?J,"/B@EJ!2#)DG'#JHB2XK"6,^
ME3"5=U#)0G(C#4RDEA6W,H/1'9Q>M\%1R:O,02@-JSF*5=BXXV4>7.?*P%@M
M72F'>56."CF#12X=N,G5V';GDWI^#`ME<P=A<PGMQGV_S)56QC[JRC74>JK+
MA08CN!9E)F'!*ZWTQ,6R#<8*VH',N-+M++864X]\AHB&*9++!P60[A]>A"!'
M\G;+C%VH0DURZ]5BT1*>5:J5X%J6OI.T*OW-N:[92#"@+(IIW`1.#*Q)L"6"
M4R$QI&/,=CG_-:(3%4T0L==$O9;.5N(O%+6B?[7I_P&9A2P($TJ;,.YALK)&
MNFL,[#UGC/"UC''Q6TYH1?>L%6:M2-E*?RN"OD*W6JP>IZ?+E[CZ"WE>1#%0
M8BRW2CBK&.=D-X+(>;7V][#@Q@XEOB$709P"(YWUI<9P\"0!]O?A(..6.\$`
M+CF'IH&']2@^/+RO[3BS#T?*KM/W7309'V_:U7K9GL+02*D/VZ9)Z.9;MWS2
?;O"XFT27N_V%BUR*J:EG@QA9)#"FY">W!0:/+P8`````
`
end
--
Vojtech Pavlik
SuSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch] Franz Sirl's final PPC input conversion part
[not found] ` <20020821191227.B6014@ucw.cz>
@ 2002-08-21 20:32 ` Vojtech Pavlik
2002-08-22 9:09 ` [patch] Two minor fixes for the PPC input conversion Vojtech Pavlik
0 siblings, 1 reply; 6+ messages in thread
From: Vojtech Pavlik @ 2002-08-21 20:32 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: torvalds, linux-kernel
Hi!
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.
===================================================================
ChangeSet@1.512, 2002-08-21 22:30:28+02:00, Franz.Sirl-kernel@lauterbach.com
Hi Vojtech,
I noticed you just pushed the pc_keyb.c removal to linux-input, here is the
PPC part of it that removes now superflous stuff. The small change in
keyboard.c is a bugfix from 2.4 and ruby that didn't make it into 2.5 yet.
Franz.
arch/ppc/config.in | 5 --
arch/ppc/platforms/chrp_setup.c | 17 ------
arch/ppc/platforms/pmac_setup.c | 12 ----
drivers/char/keyboard.c | 2
drivers/macintosh/Makefile | 2
drivers/macintosh/mac_hid.c | 98 +---------------------------------------
include/asm-ppc/machdep.h | 6 --
7 files changed, 6 insertions(+), 136 deletions(-)
===================================================================
diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in
--- a/arch/ppc/config.in Wed Aug 21 22:30:48 2002
+++ b/arch/ppc/config.in Wed Aug 21 22:30:48 2002
@@ -540,11 +540,6 @@
bool ' Support for mouse button 2+3 emulation' CONFIG_MAC_EMUMOUSEBTN
fi
fi
- # This is for drivers/macintosh/mac_hid.o, which is needed if the input
- # layer is used.
- if [ "$CONFIG_INPUT" != "n" ]; then
- define_bool CONFIG_MAC_HID y
- fi
if [ "$CONFIG_ADB_CUDA" != "n" ]; then
bool 'Support for ANS LCD display' CONFIG_ANSLCD
fi
diff -Nru a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c
--- a/arch/ppc/platforms/chrp_setup.c Wed Aug 21 22:30:48 2002
+++ b/arch/ppc/platforms/chrp_setup.c Wed Aug 21 22:30:48 2002
@@ -68,7 +68,6 @@
void btext_progress(char *, unsigned short);
extern unsigned long pmac_find_end_of_memory(void);
-extern void select_adb_keyboard(void);
extern int of_show_percpuinfo(struct seq_file *, int);
extern kdev_t boot_dev;
@@ -437,22 +436,6 @@
if (ppc_md.progress)
ppc_md.progress(" Have fun! ", 0x7777);
-
-#if defined(CONFIG_VT) && defined(CONFIG_INPUT)
- /* see if there is a keyboard in the device tree
- with a parent of type "adb" */
- {
- struct device_node *kbd;
-
- for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) {
- if (kbd->parent && kbd->parent->type
- && strcmp(kbd->parent->type, "adb") == 0) {
- select_adb_keyboard();
- break;
- }
- }
- }
-#endif /* CONFIG_VT && CONFIG_INPUT */
}
void __init
diff -Nru a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
--- a/arch/ppc/platforms/pmac_setup.c Wed Aug 21 22:30:48 2002
+++ b/arch/ppc/platforms/pmac_setup.c Wed Aug 21 22:30:48 2002
@@ -66,7 +66,6 @@
#include <asm/ohare.h>
#include <asm/mediabay.h>
#include <asm/machdep.h>
-#include <asm/keyboard.h>
#include <asm/dma.h>
#include <asm/bootx.h>
#include <asm/cputable.h>
@@ -618,15 +617,6 @@
}
void __init
-select_adb_keyboard(void)
-{
-#ifdef CONFIG_VT
- ppc_md.kbd_translate = mac_hid_kbd_translate;
- ppc_md.kbd_unexpected_up = mac_hid_kbd_unexpected_up;
-#endif /* CONFIG_VT */
-}
-
-void __init
pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7)
{
@@ -665,8 +655,6 @@
ppc_md.find_end_of_memory = pmac_find_end_of_memory;
ppc_md.feature_call = pmac_do_feature_call;
-
- select_adb_keyboard();
#ifdef CONFIG_BOOTX_TEXT
ppc_md.progress = pmac_progress;
diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c
--- a/drivers/char/keyboard.c Wed Aug 21 22:30:48 2002
+++ b/drivers/char/keyboard.c Wed Aug 21 22:30:48 2002
@@ -222,7 +222,7 @@
if (!test_bit(k, key_down))
continue;
- sym = U(plain_map[k]);
+ sym = U(key_maps[0][k]);
if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK)
continue;
diff -Nru a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
--- a/drivers/macintosh/Makefile Wed Aug 21 22:30:48 2002
+++ b/drivers/macintosh/Makefile Wed Aug 21 22:30:48 2002
@@ -20,7 +20,7 @@
ifneq ($(CONFIG_MAC),y)
obj-$(CONFIG_NVRAM) += nvram.o
endif
-obj-$(CONFIG_MAC_HID) += mac_hid.o
+obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o
obj-$(CONFIG_INPUT_ADBHID) += adbhid.o
obj-$(CONFIG_PPC_RTC) += rtc.o
obj-$(CONFIG_ANSLCD) += ans-lcd.o
diff -Nru a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
--- a/drivers/macintosh/mac_hid.c Wed Aug 21 22:30:48 2002
+++ b/drivers/macintosh/mac_hid.c Wed Aug 21 22:30:48 2002
@@ -5,7 +5,7 @@
*
* Copyright (C) 2000 Franz Sirl.
*
- * Stuff inside CONFIG_MAC_EMUMOUSEBTN should really be moved to userspace.
+ * This file will soon be removed in favor of an uinput userspace tool.
*/
#include <linux/config.h>
@@ -16,36 +16,14 @@
#include <linux/module.h>
-static unsigned char e0_keys[128] = {
- 0, 0, 0, KEY_KPCOMMA, 0, KEY_INTL3, 0, 0, /* 0x00-0x07 */
- 0, 0, 0, 0, KEY_LANG1, KEY_LANG2, 0, 0, /* 0x08-0x0f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
- 0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, KEY_VOLUMEUP, 0,/* 0x18-0x1f */
- 0, 0, 0, 0, 0, KEY_VOLUMEDOWN, KEY_MUTE, 0, /* 0x20-0x27 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
- 0, 0, 0, 0, 0, KEY_KPSLASH, 0, KEY_SYSRQ, /* 0x30-0x37 */
- KEY_RIGHTALT, KEY_BRIGHTNESSUP, KEY_BRIGHTNESSDOWN,
- KEY_EJECTCD, 0, 0, 0, 0, /* 0x38-0x3f */
- 0, 0, 0, 0, 0, 0, 0, KEY_HOME, /* 0x40-0x47 */
- KEY_UP, KEY_PAGEUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, /* 0x48-0x4f */
- KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0, 0, 0, 0, /* 0x50-0x57 */
- 0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, KEY_POWER, 0, /* 0x58-0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
- 0, 0, 0, 0, 0, 0, 0, KEY_MACRO, /* 0x68-0x6f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0 /* 0x78-0x7f */
-};
-
-#ifdef CONFIG_MAC_EMUMOUSEBTN
static struct input_dev emumousebtn;
static void emumousebtn_input_register(void);
static int mouse_emulate_buttons = 0;
static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */
static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */
static int mouse_last_keycode = 0;
-#endif
-#if defined(CONFIG_SYSCTL) && defined(CONFIG_MAC_EMUMOUSEBTN)
+#if defined(CONFIG_SYSCTL)
/* file(s) in /proc/sys/dev/mac_hid */
ctl_table mac_hid_files[] =
{
@@ -85,76 +63,11 @@
#endif /* endif CONFIG_SYSCTL */
-int mac_hid_kbd_translate(unsigned char scancode, unsigned char *keycode,
- char raw_mode)
-{
- /* This code was copied from char/pc_keyb.c and will be
- * superflous when the input layer is fully integrated.
- * We don't need the high_keys handling, so this part
- * has been removed.
- */
- static int prev_scancode = 0;
-
- /* special prefix scancodes.. */
- if (scancode == 0xe0 || scancode == 0xe1) {
- prev_scancode = scancode;
- return 0;
- }
-
- scancode &= 0x7f;
-
- if (prev_scancode) {
- if (prev_scancode != 0xe0) {
- if (prev_scancode == 0xe1 && scancode == 0x1d) {
- prev_scancode = 0x100;
- return 0;
- } else if (prev_scancode == 0x100 && scancode == 0x45) {
- *keycode = KEY_PAUSE;
- prev_scancode = 0;
- } else {
- if (!raw_mode)
- printk(KERN_INFO "keyboard: unknown e1 escape sequence\n");
- prev_scancode = 0;
- return 0;
- }
- } else {
- prev_scancode = 0;
- if (scancode == 0x2a || scancode == 0x36)
- return 0;
- }
- if (e0_keys[scancode])
- *keycode = e0_keys[scancode];
- else {
- if (!raw_mode)
- printk(KERN_INFO "keyboard: unknown scancode e0 %02x\n",
- scancode);
- return 0;
- }
- } else {
- switch (scancode) {
- case 91: scancode = KEY_LINEFEED; break;
- case 92: scancode = KEY_KPEQUAL; break;
- case 125: scancode = KEY_INTL1; break;
- }
- *keycode = scancode;
- }
- return 1;
-}
-
-char mac_hid_kbd_unexpected_up(unsigned char keycode)
-{
- if (keycode == KEY_F13)
- return 0;
- else
- return 0x80;
-}
-
-#ifdef CONFIG_MAC_EMUMOUSEBTN
int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
{
switch (caller) {
case 1:
- /* Called from keybdev.c */
+ /* Called from keyboard.c */
if (mouse_emulate_buttons
&& (keycode == mouse_button2_keycode
|| keycode == mouse_button3_keycode)) {
@@ -191,16 +104,13 @@
printk(KERN_INFO "input: Macintosh mouse button emulation\n");
}
-#endif
int __init mac_hid_init(void)
{
-#ifdef CONFIG_MAC_EMUMOUSEBTN
emumousebtn_input_register();
-#endif
-#if defined(CONFIG_SYSCTL) && defined(CONFIG_MAC_EMUMOUSEBTN)
+#if defined(CONFIG_SYSCTL)
mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir, 1);
#endif /* CONFIG_SYSCTL */
diff -Nru a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
--- a/include/asm-ppc/machdep.h Wed Aug 21 22:30:48 2002
+++ b/include/asm-ppc/machdep.h Wed Aug 21 22:30:48 2002
@@ -57,12 +57,6 @@
unsigned char (*nvram_read_val)(int addr);
void (*nvram_write_val)(int addr, unsigned char val);
- /* Tons of keyboard stuff. */
- int (*kbd_translate)(unsigned char scancode,
- unsigned char *keycode,
- char raw_mode);
- char (*kbd_unexpected_up)(unsigned char keycode);
-
/*
* optional PCI "hooks"
*/
===================================================================
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch19000
M'XL(`'CX8ST``\U8:V^;2!3];'[%E;K2]F4\,PP#9)55NDD?T39ME,=*JZJ*
M!A@"#0;$0-)4_/B]0!*[=KS$SK;:)()@P[UG[CES'SR!4ZW*K=%E_J5206P\
M@7>YKK9&NM;*#+[A]5&>X_4DSJ=J<G/7Q+^8)%E15P9^?RBK((9+5>JM$36M
MNT^JZT)MC8Y>OSU]_^K(,+:W83>6V;DZ5A5L;QM57E[*--0[LHK3/#.K4F9Z
MJBII!OFTN;NU880P_+6I8Q%;-%00[C0!#2F5G*J0,.X*;MP`V[F!O?B\RRAU
MB."LL5U/>,8>4-.F#`B;$'?"*#"V99$MYKX@;(L0>(-@OIG'29F.+U29J70G
ME76E2E\&<8L/7C@P)L8?\-^N8M<(X%T"?_6+>8E7^Y#E51*H$*[S&K[4NH*B
MUC%>5[&"(CB[4->^&4"IICD"03R0)EG]==S1\Q)B52I(='LW6CL\W(5"EA7D
M$205?BBK_DFET<\5Z+I0993FM09=U5%DP@EZT5.9IA!T:X$D0SNMTUR6(3I&
MVQ+\^CQ*OD)48F28R4%F(92U?]U["),P^[6"J;Q0K=<D0Y#,M.%:528:ZV-M
M_`F6XQB',Y$8XS5_#(-(8OP^P(DL4;]%$4QZ8B?%5`9G6E5U809S-''"[(8Z
MGDL;VV8JXB$+!0L9L^F@.F8^BE1645Y.]3UN4).,6*T;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GIK%'/6!M/R&ZKJ*SWQV?)!&$*.%,A;?Z
M._[[>/?D_3-$X8*P\5';:6_O3Z/1Y#GLRC2]S9ES->CYI/7#6P_4Z\H7([0_
M]5+O3O_BL=7VRKEF6-F/&[F,LM;5]4Y[#/*R:"V:LAXRZC#!&'.9:`1WL1UM
M-4VMQS4UXJ=KNI\1%S2]<N4;M3,$Q.Q-;Q"KX$+7T^W`#7W?IY;Q#^0_@H9$
#%@``
`
end
--
Vojtech Pavlik
SuSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch] Two minor fixes for the PPC input conversion.
2002-08-21 20:32 ` [patch] Franz Sirl's final PPC input conversion part Vojtech Pavlik
@ 2002-08-22 9:09 ` Vojtech Pavlik
2002-08-25 13:25 ` [patch] (re)implement setkeycode/getkeycode/kd_mksound/kbd_setrate via the input core Vojtech Pavlik
0 siblings, 1 reply; 6+ messages in thread
From: Vojtech Pavlik @ 2002-08-22 9:09 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: torvalds, linux-kernel
Hi!
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.
===================================================================
ChangeSet@1.513, 2002-08-22 11:07:41+02:00, Franz.Sirl-kernel@lauterbach.com
Two minor fixes on top of the PPC final input conversion.
adbhid.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
===================================================================
diff -Nru a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
--- a/drivers/macintosh/adbhid.c Thu Aug 22 11:08:09 2002
+++ b/drivers/macintosh/adbhid.c Thu Aug 22 11:08:09 2002
@@ -37,7 +37,6 @@
#include <linux/init.h>
#include <linux/notifier.h>
#include <linux/input.h>
-#include <linux/kbd_ll.h>
#include <linux/adb.h>
#include <linux/cuda.h>
@@ -51,6 +50,8 @@
#define KEYB_KEYREG 0 /* register # for key up/down data */
#define KEYB_LEDREG 2 /* register # for leds on ADB keyboard */
#define MOUSE_DATAREG 0 /* reg# for movement/button codes from mouse */
+
+extern struct pt_regs *kbd_pt_regs;
static int adb_message_handler(struct notifier_block *, unsigned long, void *);
static struct notifier_block adbhid_adb_notifier = {
===================================================================
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch25220
M'XL(`/FI9#T``[V46V_3,!3'G^M/<:2],37Q<2Y.@HH*'3`$$E7'WI`FUW&;
MT"2N8J<=4SX\;E4VA`;A)FP_^/ARCO[G_.PSN#:JS48[_<DJ69`SN-3&9B/3
M&>7).V<OM':V7^A:^:=3_G+CE\VVL\3MSX65!>Q4:[(1>L']BOV\5=EH\?+U
M];OG"T(F$Y@5HEFK*V5A,B%6MSM1Y68J;%'IQK.M:$RMK/"DKOO[HSVCE+D>
M(0]H%/<8TY#W$G-$$:+**0N3."2OW.T[[ZILJ_%&M8VJII7HK&J70A:/.4P8
M,AI0EO24!IR3"T`OP@`H\VGB,P:(&>59B.>4993"D'\X1QA3\@+^K:P9D?!A
MKZ$N&]W"JKQ5!G3C@FQ!K\`6"N;SF5MO1`7'@H#4S:$4I0M-WCH5/"'SA\23
M\6\V0JB@Y-F`K+PM#T']6LBRL=H4OLB719E[\AN=(<6X#S")PCY<(5<4HR1-
M>1RE^6!Z!R,DC-&4\H#W%`/D1]Q^?&>8O[]51$XO96KW956N"^MU<N_>TZ!C
MSB+$*&:A`Q-C/(*9?H]EP'\92P9C_"]8KMSL*Y"/HG@HRWL8M_OC<&C-?U*A
M/P#U(J2`Y$T4`",?B;IU:6C`V+:3%K;VIE5K`T\VR_SF9#Q]^+QDH>3&=/4D
0B9<!9VE,O@#-M3R,%P4`````
`
end
--
Vojtech Pavlik
SuSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch] (re)implement setkeycode/getkeycode/kd_mksound/kbd_setrate via the input core
2002-08-22 9:09 ` [patch] Two minor fixes for the PPC input conversion Vojtech Pavlik
@ 2002-08-25 13:25 ` Vojtech Pavlik
2002-08-26 9:15 ` [patch] Stricter checks in [gs]etkeycode, recompute keybit there also Vojtech Pavlik
0 siblings, 1 reply; 6+ messages in thread
From: Vojtech Pavlik @ 2002-08-25 13:25 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: torvalds, linux-kernel
Hi!
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.
===================================================================
ChangeSet@1.514, 2002-08-25 15:21:22+02:00, vojtech@suse.cz
This (re)implements getkeycode/setkeycode, kbd_rate and kd_mksound
as functions interfacing to the input core. PC-Speaker handling is
moved to a separate file. Uinput is moved to a input/misc directory.
===================================================================
b/drivers/char/keyboard.c | 126 ++++++++++-
b/drivers/char/vt.c | 72 ------
b/drivers/input/Config.help | 9
b/drivers/input/Config.in | 2
b/drivers/input/Makefile | 2
b/drivers/input/input.c | 5
b/drivers/input/keyboard/amikbd.c | 2
b/drivers/input/keyboard/atkbd.c | 2
b/drivers/input/keyboard/newtonkbd.c | 2
b/drivers/input/keyboard/sunkbd.c | 3
b/drivers/input/keyboard/xtkbd.c | 2
b/drivers/input/misc/Config.help | 28 ++
b/drivers/input/misc/Config.in | 8
b/drivers/input/misc/Makefile | 12 +
b/drivers/input/misc/pcspkr.c | 94 ++++++++
b/drivers/input/misc/uinput.c | 385 +++++++++++++++++++++++++++++++++++
b/include/linux/input.h | 1
b/include/linux/vt_kern.h | 4
drivers/input/uinput.c | 385 -----------------------------------
19 files changed, 655 insertions(+), 489 deletions(-)
===================================================================
diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c
--- a/drivers/char/keyboard.c Sun Aug 25 15:21:40 2002
+++ b/drivers/char/keyboard.c Sun Aug 25 15:21:40 2002
@@ -80,7 +80,7 @@
static fn_handler_fn *fn_handler[] = { FN_HANDLERS };
/*
- * Variables/functions exported for vt_ioctl.c
+ * Variables exported for vt_ioctl.c
*/
/* maximum values each key_handler can handle */
@@ -98,21 +98,7 @@
int spawnpid, spawnsig;
/*
- * Translation of scancodes to keycodes.
- */
-
-int getkeycode(unsigned int scancode)
-{
- return 0; /* FIXME */
-}
-
-int setkeycode(unsigned int scancode, unsigned int keycode)
-{
- return 0; /* FIXME */
-}
-
-/*
- * Variables/function exported for vt.c
+ * Variables exported for vt.c
*/
int shift_state = 0;
@@ -137,6 +123,114 @@
unsigned int mask;
unsigned char valid:1;
} ledptrs[3];
+
+/*
+ * Translation of scancodes to keycodes. We set them on only the first attached
+ * keyboard - for per-keyboard setting, /dev/input/event is more useful.
+ */
+int getkeycode(unsigned int scancode)
+{
+ struct input_handle *handle;
+ unsigned int keycode;
+
+ for (handle = kbd_handler.handle; handle; handle = handle->hnext)
+ if (handle->dev->keycodesize) break;
+
+ if (!handle->dev->keycodesize)
+ return -ENODEV;
+
+ switch (handle->dev->keycodesize) {
+ case 1: keycode = *(u8*)(handle->dev->keycode + scancode); break;
+ case 2: keycode = *(u16*)(handle->dev->keycode + scancode * 2); break;
+ case 4: keycode = *(u32*)(handle->dev->keycode + scancode * 4); break;
+ default: return -EINVAL;
+ }
+
+ return keycode;
+}
+
+int setkeycode(unsigned int scancode, unsigned int keycode)
+{
+ struct input_handle *handle;
+
+ for (handle = kbd_handler.handle; handle; handle = handle->hnext)
+ if (handle->dev->keycodesize) break;
+
+ if (!handle->dev->keycodesize)
+ return -ENODEV;
+
+ switch (handle->dev->keycodesize) {
+ case 1: *(u8*)(handle->dev->keycode + scancode) = keycode; break;
+ case 2: *(u16*)(handle->dev->keycode + scancode * 2) = keycode; break;
+ case 4: *(u32*)(handle->dev->keycode + scancode * 4) = keycode; break;
+ }
+
+ return 0;
+}
+
+/*
+ * Making beeps and bells.
+ */
+static void kd_nosound(unsigned long ignored)
+{
+ struct input_handle *handle;
+
+ for (handle = kbd_handler.handle; handle; handle = handle->hnext)
+ if (test_bit(EV_SND, handle->dev->evbit)) {
+ if (test_bit(SND_TONE, handle->dev->sndbit))
+ input_event(handle->dev, EV_SND, SND_TONE, 0);
+ if (test_bit(SND_BELL, handle->dev->sndbit))
+ input_event(handle->dev, EV_SND, SND_BELL, 0);
+ }
+}
+
+static struct timer_list kd_mksound_timer = { function: kd_nosound };
+
+void kd_mksound(unsigned int hz, unsigned int ticks)
+{
+ struct input_handle *handle;
+
+ del_timer(&kd_mksound_timer);
+
+ if (hz) {
+ for (handle = kbd_handler.handle; handle; handle = handle->hnext)
+ if (test_bit(EV_SND, handle->dev->evbit)) {
+ if (test_bit(SND_TONE, handle->dev->sndbit)) {
+ input_event(handle->dev, EV_SND, SND_TONE, hz);
+ break;
+ }
+ if (test_bit(SND_BELL, handle->dev->sndbit)) {
+ input_event(handle->dev, EV_SND, SND_BELL, 1);
+ break;
+ }
+ }
+ if (ticks)
+ mod_timer(&kd_mksound_timer, jiffies + ticks);
+ } else
+ kd_nosound(0);
+}
+
+/*
+ * Setting the keyboard rate.
+ */
+int kbd_rate(struct kbd_repeat *rep)
+{
+ struct input_handle *handle;
+
+ if (rep->rate < 0 || rep->delay < 0)
+ return -EINVAL;
+
+ for (handle = kbd_handler.handle; handle; handle = handle->hnext)
+ if (test_bit(EV_REP, handle->dev->evbit)) {
+ if (rep->rate > HZ) rep->rate = HZ;
+ handle->dev->rep[REP_PERIOD] = rep->rate ? (HZ / rep->rate) : 0;
+ handle->dev->rep[REP_DELAY] = rep->delay * HZ / 1000;
+ if (handle->dev->rep[REP_DELAY] < handle->dev->rep[REP_PERIOD])
+ handle->dev->rep[REP_DELAY] = handle->dev->rep[REP_PERIOD];
+ }
+
+ return 0;
+}
/*
* Helper Functions.
diff -Nru a/drivers/char/vt.c b/drivers/char/vt.c
--- a/drivers/char/vt.c Sun Aug 25 15:21:40 2002
+++ b/drivers/char/vt.c Sun Aug 25 15:21:40 2002
@@ -75,78 +75,6 @@
#define GPLAST 0x3df
#define GPNUM (GPLAST - GPFIRST + 1)
-/*
- * Generates sound of some frequency for some number of clock ticks
- *
- * If freq is 0, will turn off sound, else will turn it on for that time.
- * If msec is 0, will return immediately, else will sleep for msec time, then
- * turn sound off.
- *
- * We also return immediately, which is what was implied within the X
- * comments - KDMKTONE doesn't put the process to sleep.
- */
-
-#if defined(__i386__) || defined(__alpha__) || defined(__powerpc__) \
- || (defined(__mips__) && defined(CONFIG_ISA)) \
- || (defined(__arm__) && defined(CONFIG_HOST_FOOTBRIDGE)) \
- || defined(__x86_64__)
-
-static void
-kd_nosound(unsigned long ignored)
-{
- /* disable counter 2 */
- outb(inb_p(0x61)&0xFC, 0x61);
- return;
-}
-
-void
-_kd_mksound(unsigned int hz, unsigned int ticks)
-{
- static struct timer_list sound_timer = { function: kd_nosound };
- unsigned int count = 0;
- unsigned long flags;
-
- if (hz > 20 && hz < 32767)
- count = 1193180 / hz;
-
- local_irq_save(flags); // FIXME: is this safe?
- del_timer(&sound_timer);
- if (count) {
- /* enable counter 2 */
- outb_p(inb_p(0x61)|3, 0x61);
- /* set command for counter 2, 2 byte write */
- outb_p(0xB6, 0x43);
- /* select desired HZ */
- outb_p(count & 0xff, 0x42);
- outb((count >> 8) & 0xff, 0x42);
-
- if (ticks) {
- sound_timer.expires = jiffies+ticks;
- add_timer(&sound_timer);
- }
- } else
- kd_nosound(0);
- local_irq_restore(flags);
- return;
-}
-
-#else
-
-void
-_kd_mksound(unsigned int hz, unsigned int ticks)
-{
-}
-
-#endif
-
-int _kbd_rate(struct kbd_repeat *rep)
-{
- return -EINVAL;
-}
-
-void (*kd_mksound)(unsigned int hz, unsigned int ticks) = _kd_mksound;
-int (*kbd_rate)(struct kbd_repeat *rep) = _kbd_rate;
-
#define i (tmp.kb_index)
#define s (tmp.kb_table)
#define v (tmp.kb_value)
diff -Nru a/drivers/input/Config.help b/drivers/input/Config.help
--- a/drivers/input/Config.help Sun Aug 25 15:21:40 2002
+++ b/drivers/input/Config.help Sun Aug 25 15:21:40 2002
@@ -88,12 +88,3 @@
inserted in and removed from the running kernel whenever you want).
The module will be called joydev.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
-
-CONFIG_INPUT_UINPUT
- Say Y here if you want to support user level drivers for input
- subsystem accessible under char device 10:223 - /dev/input/uinput.
-
- This driver is also available as a module ( = code which can be
- inserted in and removed from the running kernel whenever you want).
- The module will be called uinput.o. If you want to compile it as a
- module, say M here and read <file:Documentation/modules.txt>.
diff -Nru a/drivers/input/Config.in b/drivers/input/Config.in
--- a/drivers/input/Config.in Sun Aug 25 15:21:40 2002
+++ b/drivers/input/Config.in Sun Aug 25 15:21:40 2002
@@ -22,7 +22,6 @@
fi
dep_tristate ' Event interface' CONFIG_INPUT_EVDEV $CONFIG_INPUT
dep_tristate ' Event debugging' CONFIG_INPUT_EVBUG $CONFIG_INPUT
-dep_tristate ' User level driver support' CONFIG_INPUT_UINPUT $CONFIG_INPUT $CONFIG_EXPERIMENTAL
comment 'Input I/O drivers'
source drivers/input/gameport/Config.in
@@ -34,6 +33,7 @@
source drivers/input/mouse/Config.in
source drivers/input/joystick/Config.in
source drivers/input/touchscreen/Config.in
+ source drivers/input/misc/Config.in
fi
endmenu
diff -Nru a/drivers/input/Makefile b/drivers/input/Makefile
--- a/drivers/input/Makefile Sun Aug 25 15:21:40 2002
+++ b/drivers/input/Makefile Sun Aug 25 15:21:40 2002
@@ -15,12 +15,12 @@
obj-$(CONFIG_INPUT_TSDEV) += tsdev.o
obj-$(CONFIG_INPUT_POWER) += power.o
obj-$(CONFIG_INPUT_EVBUG) += evbug.o
-obj-$(CONFIG_INPUT_UINPUT) += uinput.o
obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/
obj-$(CONFIG_INPUT_MOUSE) += mouse/
obj-$(CONFIG_INPUT_JOYSTICK) += joystick/
obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
+obj-$(CONFIG_INPUT_MISC) += misc/
# The global Rules.make.
diff -Nru a/drivers/input/input.c b/drivers/input/input.c
--- a/drivers/input/input.c Sun Aug 25 15:21:40 2002
+++ b/drivers/input/input.c Sun Aug 25 15:21:40 2002
@@ -105,7 +105,7 @@
change_bit(code, dev->key);
- if (test_bit(EV_REP, dev->evbit) && value) {
+ if (test_bit(EV_REP, dev->evbit) && dev->rep[REP_PERIOD] && value) {
dev->repeat_key = code;
mod_timer(&dev->timer, jiffies + dev->rep[REP_DELAY]);
}
@@ -165,10 +165,9 @@
case EV_SND:
- if (code > SND_MAX || !test_bit(code, dev->sndbit) || !!test_bit(code, dev->snd) == value)
+ if (code > SND_MAX || !test_bit(code, dev->sndbit))
return;
- change_bit(code, dev->snd);
if (dev->event) dev->event(dev, type, code, value);
break;
diff -Nru a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
--- a/drivers/input/keyboard/amikbd.c Sun Aug 25 15:21:40 2002
+++ b/drivers/input/keyboard/amikbd.c Sun Aug 25 15:21:40 2002
@@ -114,6 +114,8 @@
amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
amikbd_dev.keycode = amikbd_keycode;
+ amikbd_dev.keycodesize = sizeof(unsigned char);
+ amikbd_dev.keycodemax = ARRAY_SIZE(amikbd_keycode);
for (i = 0; i < 0x78; i++)
if (amikbd_keycode[i])
diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
--- a/drivers/input/keyboard/atkbd.c Sun Aug 25 15:21:40 2002
+++ b/drivers/input/keyboard/atkbd.c Sun Aug 25 15:21:40 2002
@@ -470,6 +470,8 @@
atkbd->serio = serio;
atkbd->dev.keycode = atkbd->keycode;
+ atkbd->dev.keycodesize = sizeof(unsigned char);
+ atkbd->dev.keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
atkbd->dev.event = atkbd_event;
atkbd->dev.private = atkbd;
diff -Nru a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c
--- a/drivers/input/keyboard/newtonkbd.c Sun Aug 25 15:21:40 2002
+++ b/drivers/input/keyboard/newtonkbd.c Sun Aug 25 15:21:40 2002
@@ -94,6 +94,8 @@
nkbd->serio = serio;
nkbd->dev.keycode = nkbd->keycode;
+ nkbd->dev.keycodesize = sizeof(unsigned char);
+ nkbd->dev.keycodemax = ARRAY_SIZE(nkbd_keycode);
nkbd->dev.private = nkbd;
serio->private = nkbd;
diff -Nru a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
--- a/drivers/input/keyboard/sunkbd.c Sun Aug 25 15:21:40 2002
+++ b/drivers/input/keyboard/sunkbd.c Sun Aug 25 15:21:40 2002
@@ -245,6 +245,9 @@
sunkbd->tq.data = sunkbd;
sunkbd->dev.keycode = sunkbd->keycode;
+ sunkbd->dev.keycodesize = sizeof(unsigned char);
+ sunkbd->dev.keycodemax = ARRAY_SIZE(sunkbd_keycode);
+
sunkbd->dev.event = sunkbd_event;
sunkbd->dev.private = sunkbd;
diff -Nru a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
--- a/drivers/input/keyboard/xtkbd.c Sun Aug 25 15:21:40 2002
+++ b/drivers/input/keyboard/xtkbd.c Sun Aug 25 15:21:40 2002
@@ -101,6 +101,8 @@
xtkbd->serio = serio;
xtkbd->dev.keycode = xtkbd->keycode;
+ xtkbd->dev.keycodesize = sizeof(unsigned char);
+ xtkbd->dev.keycodemax = ARRAY_SIZE(xtkbd_keycode);
xtkbd->dev.private = xtkbd;
serio->private = xtkbd;
diff -Nru a/drivers/input/misc/Config.help b/drivers/input/misc/Config.help
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/input/misc/Config.help Sun Aug 25 15:21:40 2002
@@ -0,0 +1,28 @@
+CONFIG_INPUT_MISC
+
+ Say Y here, and a list of miscellaneous input drivers will be displayed.
+ Everything that didn't fit into the other categories is here. This option
+ doesn't affect the kernel.
+
+ If unsure, say Y.
+
+CONFIG_INPUT_PCSPKR
+ Say Y here if you want the standard PC Speaker to be used for
+ bells and whistles.
+
+ If unsure, say Y.
+
+ This driver is also available as a module ( = code which can be
+ inserted in and removed from the running kernel whenever you want).
+ The module will be called pcspkr.o. If you want to compile it as a
+ module, say M here and read <file:Documentation/modules.txt>.
+
+
+CONFIG_INPUT_UINPUT
+ Say Y here if you want to support user level drivers for input
+ subsystem accessible under char device 10:223 - /dev/input/uinput.
+
+ This driver is also available as a module ( = code which can be
+ inserted in and removed from the running kernel whenever you want).
+ The module will be called uinput.o. If you want to compile it as a
+ module, say M here and read <file:Documentation/modules.txt>.
diff -Nru a/drivers/input/misc/Config.in b/drivers/input/misc/Config.in
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/input/misc/Config.in Sun Aug 25 15:21:40 2002
@@ -0,0 +1,8 @@
+#
+# Input misc drivers configuration
+#
+
+bool 'Misc' CONFIG_INPUT_MISC
+
+dep_tristate ' PC Speaker support' CONFIG_INPUT_PCSPKR $CONFIG_INPUT $CONFIG_INPUT_MISC
+dep_tristate ' User level driver support' CONFIG_INPUT_UINPUT $CONFIG_INPUT $CONFIG_INPUT_MISC
diff -Nru a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/input/misc/Makefile Sun Aug 25 15:21:40 2002
@@ -0,0 +1,12 @@
+#
+# Makefile for the input misc drivers.
+#
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
+obj-$(CONFIG_INPUT_UINPUT) += uinput.o
+
+# The global Rules.make.
+
+include $(TOPDIR)/Rules.make
diff -Nru a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/input/misc/pcspkr.c Sun Aug 25 15:21:40 2002
@@ -0,0 +1,94 @@
+/*
+ * PC Speaker beeper driver for Linux
+ *
+ * Copyright (c) 2002 Vojtech Pavlik
+ * Copyright (c) 1992 Orest Zborowski
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <asm/io.h>
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
+MODULE_DESCRIPTION("PC Speaker beeper driver");
+MODULE_LICENSE("GPL");
+
+static char *pcspkr_name = "PC Speaker";
+static char *pcspkr_phys = "isa0061/input0";
+static struct input_dev pcspkr_dev;
+
+spinlock_t i8253_beep_lock = SPIN_LOCK_UNLOCKED;
+
+static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
+{
+ unsigned int count = 0;
+ unsigned long flags;
+
+ if (type != EV_SND)
+ return -1;
+
+ switch (code) {
+ case SND_BELL: if (value) value = 1000;
+ case SND_TONE: break;
+ default: return -1;
+ }
+
+ if (value > 20 && value < 32767)
+ count = 1193182 / value;
+
+ spin_lock_irqsave(&i8253_beep_lock, flags);
+
+ if (count) {
+ /* enable counter 2 */
+ outb_p(inb_p(0x61) | 3, 0x61);
+ /* set command for counter 2, 2 byte write */
+ outb_p(0xB6, 0x43);
+ /* select desired HZ */
+ outb_p(count & 0xff, 0x42);
+ outb((count >> 8) & 0xff, 0x42);
+ } else {
+ /* disable counter 2 */
+ outb(inb_p(0x61) & 0xFC, 0x61);
+ }
+
+ spin_unlock_irqrestore(&i8253_beep_lock, flags);
+
+ return 0;
+}
+
+static int __init pcspkr_init(void)
+{
+ pcspkr_dev.evbit[0] = BIT(EV_SND);
+ pcspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
+ pcspkr_dev.event = pcspkr_event;
+
+ pcspkr_dev.name = pcspkr_name;
+ pcspkr_dev.phys = pcspkr_phys;
+ pcspkr_dev.id.bustype = BUS_ISA;
+ pcspkr_dev.id.vendor = 0x001f;
+ pcspkr_dev.id.product = 0x0001;
+ pcspkr_dev.id.version = 0x0100;
+
+ input_register_device(&pcspkr_dev);
+
+ printk(KERN_INFO "input: %s\n", pcspkr_name);
+
+ return 0;
+}
+
+static void __exit pcspkr_exit(void)
+{
+ input_unregister_device(&pcspkr_dev);
+}
+
+module_init(pcspkr_init);
+module_exit(pcspkr_exit);
diff -Nru a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/input/misc/uinput.c Sun Aug 25 15:21:40 2002
@@ -0,0 +1,385 @@
+/*
+ * User level driver support for input subsystem
+ *
+ * Heavily based on evdev.c by Vojtech Pavlik
+ *
+ * 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
+ *
+ * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
+ *
+ * Changes/Revisions:
+ * 0.1 20/06/2002
+ * - first public version
+ */
+#include <linux/poll.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/smp_lock.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/uinput.h>
+
+static int uinput_dev_open(struct input_dev *dev)
+{
+ return 0;
+}
+
+static void uinput_dev_close(struct input_dev *dev)
+{
+
+}
+
+static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
+{
+ struct uinput_device *udev;
+
+ udev = (struct uinput_device *)dev->private;
+
+ udev->head = (udev->head + 1) & 0xF;
+ udev->buff[udev->head].type = type;
+ udev->buff[udev->head].code = code;
+ udev->buff[udev->head].value = value;
+ do_gettimeofday(&udev->buff[udev->head].time);
+
+ wake_up_interruptible(&udev->waitq);
+
+ return 0;
+}
+
+static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)
+{
+ return 0;
+}
+
+static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
+{
+ return 0;
+}
+
+static int uinput_create_device(struct uinput_device *udev)
+{
+ if (!udev->dev->name) {
+ printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME);
+ return -EINVAL;
+ }
+
+ udev->dev->open = uinput_dev_open;
+ udev->dev->close = uinput_dev_close;
+ udev->dev->event = uinput_dev_event;
+ udev->dev->upload_effect = uinput_dev_upload_effect;
+ udev->dev->erase_effect = uinput_dev_erase_effect;
+
+ init_waitqueue_head(&(udev->waitq));
+
+ input_register_device(udev->dev);
+
+ udev->state |= UIST_CREATED;
+
+ return 0;
+}
+
+static int uinput_destroy_device(struct uinput_device *udev)
+{
+ if (!(udev->state & UIST_CREATED)) {
+ printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME);
+ return -EINVAL;
+ }
+
+ input_unregister_device(udev->dev);
+
+ clear_bit(UIST_CREATED, &(udev->state));
+
+ return 0;
+}
+
+static int uinput_open(struct inode *inode, struct file *file)
+{
+ struct uinput_device *newdev;
+ struct input_dev *newinput;
+
+ MOD_INC_USE_COUNT;
+
+ newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL);
+ if (!newdev)
+ goto error;
+ memset(newdev, 0, sizeof(struct uinput_device));
+
+ newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
+ if (!newinput)
+ goto cleanup;
+ memset(newinput, 0, sizeof(struct input_dev));
+
+ newdev->dev = newinput;
+
+ file->private_data = newdev;
+
+ return 0;
+cleanup:
+ kfree(newdev);
+error:
+ MOD_DEC_USE_COUNT;
+ return -ENOMEM;
+}
+
+static int uinput_alloc_device(struct file *file, const char *buffer, size_t count)
+{
+ struct uinput_user_dev user_dev;
+ struct input_dev *dev;
+ struct uinput_device *udev;
+ int size,
+ retval;
+
+ retval = count;
+
+ if (copy_from_user(&user_dev, buffer, sizeof(struct uinput_user_dev))) {
+ retval = -EFAULT;
+ goto exit;
+ }
+
+ udev = (struct uinput_device *)file->private_data;
+ dev = udev->dev;
+
+ size = strnlen(user_dev.name, UINPUT_MAX_NAME_SIZE);
+ dev->name = kmalloc(size + 1, GFP_KERNEL);
+ if (!dev->name) {
+ retval = -ENOMEM;
+ goto exit;
+ }
+
+ strncpy(dev->name, user_dev.name, size);
+ dev->name[size] = '\0';
+ dev->id.bustype = user_dev.id.bustype;
+ dev->id.vendor = user_dev.id.vendor;
+ dev->id.product = user_dev.id.product;
+ dev->id.version = user_dev.id.version;
+ dev->ff_effects_max = user_dev.ff_effects_max;
+
+ size = sizeof(unsigned long) * NBITS(ABS_MAX + 1);
+ memcpy(dev->absmax, user_dev.absmax, size);
+ memcpy(dev->absmin, user_dev.absmin, size);
+ memcpy(dev->absfuzz, user_dev.absfuzz, size);
+ memcpy(dev->absflat, user_dev.absflat, size);
+
+ /* check if absmin/absmax/absfuzz/absflat are filled as
+ * told in Documentation/input/input-programming.txt */
+ if (test_bit(EV_ABS, dev->evbit)) {
+ unsigned int cnt;
+ for (cnt = 1; cnt < ABS_MAX; cnt++)
+ if (test_bit(cnt, dev->absbit) &&
+ (!dev->absmin[cnt] ||
+ !dev->absmax[cnt] ||
+ !dev->absfuzz[cnt] ||
+ !dev->absflat[cnt])) {
+ printk(KERN_DEBUG "%s: set abs fields "
+ "first\n", UINPUT_NAME);
+ retval = -EINVAL;
+ goto free_name;
+ }
+ }
+
+exit:
+ return retval;
+free_name:
+ kfree(dev->name);
+ goto exit;
+}
+
+static int uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+{
+ struct uinput_device *udev = file->private_data;
+
+
+ if (udev->state & UIST_CREATED) {
+ struct input_event ev;
+
+ if (copy_from_user(&ev, buffer, sizeof(struct input_event)))
+ return -EFAULT;
+ input_event(udev->dev, ev.type, ev.code, ev.value);
+ }
+ else
+ count = uinput_alloc_device(file, buffer, count);
+
+ return count;
+}
+
+static ssize_t uinput_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+{
+ struct uinput_device *udev;
+ int retval = 0;
+ DECLARE_WAITQUEUE(waitq, current);
+
+ udev = (struct uinput_device *)file->private_data;
+
+ if (udev->head == udev->tail) {
+ add_wait_queue(&udev->waitq, &waitq);
+ current->state = TASK_INTERRUPTIBLE;
+
+ while (udev->head == udev->tail) {
+ if (!(udev->state & UIST_CREATED)) {
+ retval = -ENODEV;
+ break;
+ }
+ if (file->f_flags & O_NONBLOCK) {
+ retval = -EAGAIN;
+ break;
+ }
+ if (signal_pending(current)) {
+ retval = -ERESTARTSYS;
+ break;
+ }
+ schedule();
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&udev->waitq, &waitq);
+ }
+
+ if (retval)
+ return retval;
+
+ while (udev->head != udev->tail && retval + sizeof(struct uinput_device) <= count) {
+ if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]),
+ sizeof(struct input_event)))
+ return -EFAULT;
+ udev->tail = (udev->tail + 1)%(UINPUT_BUFFER_SIZE - 1);
+ retval += sizeof(struct input_event);
+ }
+
+ return retval;
+}
+
+static unsigned int uinput_poll(struct file *file, poll_table *wait)
+{
+ struct uinput_device *udev = file->private_data;
+
+ poll_wait(file, &udev->waitq, wait);
+
+ if (udev->head != udev->tail)
+ return POLLIN | POLLRDNORM;
+
+ return 0;
+}
+
+static int uinput_burn_device(struct uinput_device *udev)
+{
+ if (udev->state & UIST_CREATED)
+ uinput_destroy_device(udev);
+
+ kfree(udev->dev);
+ kfree(udev);
+
+ return 0;
+}
+
+static int uinput_close(struct inode *inode, struct file *file)
+{
+ int retval;
+
+ retval = uinput_burn_device((struct uinput_device *)file->private_data);
+ MOD_DEC_USE_COUNT;
+ return retval;
+}
+
+static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+{
+ int retval = 0;
+ struct uinput_device *udev;
+
+ udev = (struct uinput_device *)file->private_data;
+
+ if (cmd >= UI_SET_EVBIT && (udev->state & UIST_CREATED))
+ return -EINVAL;
+
+ switch (cmd) {
+ case UI_DEV_CREATE:
+ retval = uinput_create_device(udev);
+
+ break;
+ case UI_DEV_DESTROY:
+ retval = uinput_destroy_device(udev);
+
+ break;
+ case UI_SET_EVBIT:
+ set_bit(arg, udev->dev->evbit);
+
+ break;
+ case UI_SET_KEYBIT:
+ set_bit(arg, udev->dev->keybit);
+
+ break;
+ case UI_SET_RELBIT:
+ set_bit(arg, udev->dev->relbit);
+
+ break;
+ case UI_SET_ABSBIT:
+ set_bit(arg, udev->dev->absbit);
+
+ break;
+ case UI_SET_MSCBIT:
+ set_bit(arg, udev->dev->mscbit);
+
+ break;
+ case UI_SET_LEDBIT:
+ set_bit(arg, udev->dev->ledbit);
+
+ break;
+ case UI_SET_SNDBIT:
+ set_bit(arg, udev->dev->sndbit);
+
+ break;
+ case UI_SET_FFBIT:
+ set_bit(arg, udev->dev->ffbit);
+
+ break;
+ default:
+ retval = -EFAULT;
+ }
+ return retval;
+}
+
+struct file_operations uinput_fops = {
+ .owner = THIS_MODULE,
+ .open = uinput_open,
+ .release = uinput_close,
+ .read = uinput_read,
+ .write = uinput_write,
+ .poll = uinput_poll,
+ .ioctl = uinput_ioctl,
+};
+
+static struct miscdevice uinput_misc = {
+ .fops = &uinput_fops,
+ .minor = UINPUT_MINOR,
+ .name = UINPUT_NAME,
+};
+
+static int __init uinput_init(void)
+{
+ return misc_register(&uinput_misc);
+}
+
+static void __exit uinput_exit(void)
+{
+ misc_deregister(&uinput_misc);
+}
+
+MODULE_AUTHOR("Aristeu Sergio Rozanski Filho");
+MODULE_DESCRIPTION("User level driver support for input subsystem");
+MODULE_LICENSE("GPL");
+
+module_init(uinput_init);
+module_exit(uinput_exit);
+
diff -Nru a/drivers/input/uinput.c b/drivers/input/uinput.c
--- a/drivers/input/uinput.c Sun Aug 25 15:21:40 2002
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,385 +0,0 @@
-/*
- * User level driver support for input subsystem
- *
- * Heavily based on evdev.c by Vojtech Pavlik
- *
- * 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
- *
- * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
- *
- * Changes/Revisions:
- * 0.1 20/06/2002
- * - first public version
- */
-#include <linux/poll.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/input.h>
-#include <linux/smp_lock.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/uinput.h>
-
-static int uinput_dev_open(struct input_dev *dev)
-{
- return 0;
-}
-
-static void uinput_dev_close(struct input_dev *dev)
-{
-
-}
-
-static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
-{
- struct uinput_device *udev;
-
- udev = (struct uinput_device *)dev->private;
-
- udev->head = (udev->head + 1) & 0xF;
- udev->buff[udev->head].type = type;
- udev->buff[udev->head].code = code;
- udev->buff[udev->head].value = value;
- do_gettimeofday(&udev->buff[udev->head].time);
-
- wake_up_interruptible(&udev->waitq);
-
- return 0;
-}
-
-static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)
-{
- return 0;
-}
-
-static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
-{
- return 0;
-}
-
-static int uinput_create_device(struct uinput_device *udev)
-{
- if (!udev->dev->name) {
- printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME);
- return -EINVAL;
- }
-
- udev->dev->open = uinput_dev_open;
- udev->dev->close = uinput_dev_close;
- udev->dev->event = uinput_dev_event;
- udev->dev->upload_effect = uinput_dev_upload_effect;
- udev->dev->erase_effect = uinput_dev_erase_effect;
-
- init_waitqueue_head(&(udev->waitq));
-
- input_register_device(udev->dev);
-
- udev->state |= UIST_CREATED;
-
- return 0;
-}
-
-static int uinput_destroy_device(struct uinput_device *udev)
-{
- if (!(udev->state & UIST_CREATED)) {
- printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME);
- return -EINVAL;
- }
-
- input_unregister_device(udev->dev);
-
- clear_bit(UIST_CREATED, &(udev->state));
-
- return 0;
-}
-
-static int uinput_open(struct inode *inode, struct file *file)
-{
- struct uinput_device *newdev;
- struct input_dev *newinput;
-
- MOD_INC_USE_COUNT;
-
- newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL);
- if (!newdev)
- goto error;
- memset(newdev, 0, sizeof(struct uinput_device));
-
- newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
- if (!newinput)
- goto cleanup;
- memset(newinput, 0, sizeof(struct input_dev));
-
- newdev->dev = newinput;
-
- file->private_data = newdev;
-
- return 0;
-cleanup:
- kfree(newdev);
-error:
- MOD_DEC_USE_COUNT;
- return -ENOMEM;
-}
-
-static int uinput_alloc_device(struct file *file, const char *buffer, size_t count)
-{
- struct uinput_user_dev user_dev;
- struct input_dev *dev;
- struct uinput_device *udev;
- int size,
- retval;
-
- retval = count;
-
- if (copy_from_user(&user_dev, buffer, sizeof(struct uinput_user_dev))) {
- retval = -EFAULT;
- goto exit;
- }
-
- udev = (struct uinput_device *)file->private_data;
- dev = udev->dev;
-
- size = strnlen(user_dev.name, UINPUT_MAX_NAME_SIZE);
- dev->name = kmalloc(size + 1, GFP_KERNEL);
- if (!dev->name) {
- retval = -ENOMEM;
- goto exit;
- }
-
- strncpy(dev->name, user_dev.name, size);
- dev->name[size] = '\0';
- dev->id.bustype = user_dev.id.bustype;
- dev->id.vendor = user_dev.id.vendor;
- dev->id.product = user_dev.id.product;
- dev->id.version = user_dev.id.version;
- dev->ff_effects_max = user_dev.ff_effects_max;
-
- size = sizeof(unsigned long) * NBITS(ABS_MAX + 1);
- memcpy(dev->absmax, user_dev.absmax, size);
- memcpy(dev->absmin, user_dev.absmin, size);
- memcpy(dev->absfuzz, user_dev.absfuzz, size);
- memcpy(dev->absflat, user_dev.absflat, size);
-
- /* check if absmin/absmax/absfuzz/absflat are filled as
- * told in Documentation/input/input-programming.txt */
- if (test_bit(EV_ABS, dev->evbit)) {
- unsigned int cnt;
- for (cnt = 1; cnt < ABS_MAX; cnt++)
- if (test_bit(cnt, dev->absbit) &&
- (!dev->absmin[cnt] ||
- !dev->absmax[cnt] ||
- !dev->absfuzz[cnt] ||
- !dev->absflat[cnt])) {
- printk(KERN_DEBUG "%s: set abs fields "
- "first\n", UINPUT_NAME);
- retval = -EINVAL;
- goto free_name;
- }
- }
-
-exit:
- return retval;
-free_name:
- kfree(dev->name);
- goto exit;
-}
-
-static int uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
-{
- struct uinput_device *udev = file->private_data;
-
-
- if (udev->state & UIST_CREATED) {
- struct input_event ev;
-
- if (copy_from_user(&ev, buffer, sizeof(struct input_event)))
- return -EFAULT;
- input_event(udev->dev, ev.type, ev.code, ev.value);
- }
- else
- count = uinput_alloc_device(file, buffer, count);
-
- return count;
-}
-
-static ssize_t uinput_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
-{
- struct uinput_device *udev;
- int retval = 0;
- DECLARE_WAITQUEUE(waitq, current);
-
- udev = (struct uinput_device *)file->private_data;
-
- if (udev->head == udev->tail) {
- add_wait_queue(&udev->waitq, &waitq);
- current->state = TASK_INTERRUPTIBLE;
-
- while (udev->head == udev->tail) {
- if (!(udev->state & UIST_CREATED)) {
- retval = -ENODEV;
- break;
- }
- if (file->f_flags & O_NONBLOCK) {
- retval = -EAGAIN;
- break;
- }
- if (signal_pending(current)) {
- retval = -ERESTARTSYS;
- break;
- }
- schedule();
- }
- current->state = TASK_RUNNING;
- remove_wait_queue(&udev->waitq, &waitq);
- }
-
- if (retval)
- return retval;
-
- while (udev->head != udev->tail && retval + sizeof(struct uinput_device) <= count) {
- if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]),
- sizeof(struct input_event)))
- return -EFAULT;
- udev->tail = (udev->tail + 1)%(UINPUT_BUFFER_SIZE - 1);
- retval += sizeof(struct input_event);
- }
-
- return retval;
-}
-
-static unsigned int uinput_poll(struct file *file, poll_table *wait)
-{
- struct uinput_device *udev = file->private_data;
-
- poll_wait(file, &udev->waitq, wait);
-
- if (udev->head != udev->tail)
- return POLLIN | POLLRDNORM;
-
- return 0;
-}
-
-static int uinput_burn_device(struct uinput_device *udev)
-{
- if (udev->state & UIST_CREATED)
- uinput_destroy_device(udev);
-
- kfree(udev->dev);
- kfree(udev);
-
- return 0;
-}
-
-static int uinput_close(struct inode *inode, struct file *file)
-{
- int retval;
-
- retval = uinput_burn_device((struct uinput_device *)file->private_data);
- MOD_DEC_USE_COUNT;
- return retval;
-}
-
-static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
- int retval = 0;
- struct uinput_device *udev;
-
- udev = (struct uinput_device *)file->private_data;
-
- if (cmd >= UI_SET_EVBIT && (udev->state & UIST_CREATED))
- return -EINVAL;
-
- switch (cmd) {
- case UI_DEV_CREATE:
- retval = uinput_create_device(udev);
-
- break;
- case UI_DEV_DESTROY:
- retval = uinput_destroy_device(udev);
-
- break;
- case UI_SET_EVBIT:
- set_bit(arg, udev->dev->evbit);
-
- break;
- case UI_SET_KEYBIT:
- set_bit(arg, udev->dev->keybit);
-
- break;
- case UI_SET_RELBIT:
- set_bit(arg, udev->dev->relbit);
-
- break;
- case UI_SET_ABSBIT:
- set_bit(arg, udev->dev->absbit);
-
- break;
- case UI_SET_MSCBIT:
- set_bit(arg, udev->dev->mscbit);
-
- break;
- case UI_SET_LEDBIT:
- set_bit(arg, udev->dev->ledbit);
-
- break;
- case UI_SET_SNDBIT:
- set_bit(arg, udev->dev->sndbit);
-
- break;
- case UI_SET_FFBIT:
- set_bit(arg, udev->dev->ffbit);
-
- break;
- default:
- retval = -EFAULT;
- }
- return retval;
-}
-
-struct file_operations uinput_fops = {
- .owner = THIS_MODULE,
- .open = uinput_open,
- .release = uinput_close,
- .read = uinput_read,
- .write = uinput_write,
- .poll = uinput_poll,
- .ioctl = uinput_ioctl,
-};
-
-static struct miscdevice uinput_misc = {
- .fops = &uinput_fops,
- .minor = UINPUT_MINOR,
- .name = UINPUT_NAME,
-};
-
-static int __init uinput_init(void)
-{
- return misc_register(&uinput_misc);
-}
-
-static void __exit uinput_exit(void)
-{
- misc_deregister(&uinput_misc);
-}
-
-MODULE_AUTHOR("Aristeu Sergio Rozanski Filho");
-MODULE_DESCRIPTION("User level driver support for input subsystem");
-MODULE_LICENSE("GPL");
-
-module_init(uinput_init);
-module_exit(uinput_exit);
-
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h Sun Aug 25 15:21:40 2002
+++ b/include/linux/input.h Sun Aug 25 15:21:40 2002
@@ -570,6 +570,7 @@
#define SND_CLICK 0x00
#define SND_BELL 0x01
+#define SND_TONE 0x02
#define SND_MAX 0x07
/*
diff -Nru a/include/linux/vt_kern.h b/include/linux/vt_kern.h
--- a/include/linux/vt_kern.h Sun Aug 25 15:21:40 2002
+++ b/include/linux/vt_kern.h Sun Aug 25 15:21:40 2002
@@ -32,8 +32,8 @@
wait_queue_head_t paste_wait;
} *vt_cons[MAX_NR_CONSOLES];
-extern void (*kd_mksound)(unsigned int hz, unsigned int ticks);
-extern int (*kbd_rate)(struct kbd_repeat *rep);
+extern void kd_mksound(unsigned int hz, unsigned int ticks);
+extern int kbd_rate(struct kbd_repeat *rep);
/* console.c */
===================================================================
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch26655
M'XL(`.39:#T``]U<>W?;-K+_V_H4:-*;RJXE`7S3CGV;VDZKD\3VL>/<;3?W
MZ%`D9+&F2"U)^9%5O_N=`4B)DJ@'E77W9M,>2R*!P6!F\,/,8,B7Y";A\<'.
M??1'RMU^[27Y-4K2@YUDE/"F^P5^7T41_&[UHP%O9:U:W;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"S>&K?P]
M+EO85K47RWPE]8E5Z;I!C:I6I?[[K4J^&&<SJ\KGOHU)*9I)5/#21U6MJJ3'
M@EW)-@7+^KS*MAZWWA*KO*GEZVA/[,J@JJ[^/T4K9Y6;A2^:V<RL'K??$,&]
M1:1ZK+HA+G98L"G19"58S;RD:'-KJO:BI.V(@OEHJ@&[*36H;I:8#UH0_4MS
MZK+B&T.T^6.%B0@;QZLDC&`EWORTTJIFNU0WJ<G;+-T^=^^2T>#([GFJYW35
+VO\![J0JRSI3````
`
end
--
Vojtech Pavlik
SuSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch] Stricter checks in [gs]etkeycode, recompute keybit there also
2002-08-25 13:25 ` [patch] (re)implement setkeycode/getkeycode/kd_mksound/kbd_setrate via the input core Vojtech Pavlik
@ 2002-08-26 9:15 ` Vojtech Pavlik
0 siblings, 0 replies; 6+ messages in thread
From: Vojtech Pavlik @ 2002-08-26 9:15 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: torvalds, linux-kernel
Hi!
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.
===================================================================
ChangeSet@1.542, 2002-08-26 11:13:55+02:00, vojtech@suse.cz
Shorten the keycode handling code in keyboard.c and evdev.c.
Recompute keybit when keycode table changes.
Stricter checks on input keycode/scancode values.
===================================================================
drivers/char/keyboard.c | 39 ++++++++++++++++++++++-----------------
drivers/input/evdev.c | 29 ++++++++++++-----------------
include/linux/input.h | 3 +++
3 files changed, 37 insertions(+), 34 deletions(-)
===================================================================
diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c
--- a/drivers/char/keyboard.c Mon Aug 26 11:14:16 2002
+++ b/drivers/char/keyboard.c Mon Aug 26 11:14:16 2002
@@ -131,39 +131,44 @@
int getkeycode(unsigned int scancode)
{
struct input_handle *handle;
- unsigned int keycode;
+ struct input_dev *dev = NULL;
for (handle = kbd_handler.handle; handle; handle = handle->hnext)
- if (handle->dev->keycodesize) break;
+ if (handle->dev->keycodesize) { dev = handle->dev; break; }
- if (!handle->dev->keycodesize)
+ if (!dev)
return -ENODEV;
- switch (handle->dev->keycodesize) {
- case 1: keycode = *(u8*)(handle->dev->keycode + scancode); break;
- case 2: keycode = *(u16*)(handle->dev->keycode + scancode * 2); break;
- case 4: keycode = *(u32*)(handle->dev->keycode + scancode * 4); break;
- default: return -EINVAL;
- }
+ if (scancode < 0 || scancode >= dev->keycodemax)
+ return -EINVAL;
- return keycode;
+ return INPUT_KEYCODE(dev, scancode);
}
int setkeycode(unsigned int scancode, unsigned int keycode)
{
struct input_handle *handle;
+ struct input_dev *dev = NULL;
+ int i, oldkey;
for (handle = kbd_handler.handle; handle; handle = handle->hnext)
- if (handle->dev->keycodesize) break;
+ if (handle->dev->keycodesize) { dev = handle->dev; break; }
- if (!handle->dev->keycodesize)
+ if (!dev)
return -ENODEV;
- switch (handle->dev->keycodesize) {
- case 1: *(u8*)(handle->dev->keycode + scancode) = keycode; break;
- case 2: *(u16*)(handle->dev->keycode + scancode * 2) = keycode; break;
- case 4: *(u32*)(handle->dev->keycode + scancode * 4) = keycode; break;
- }
+ if (scancode < 0 || scancode >= dev->keycodemax)
+ return -EINVAL;
+
+ oldkey = INPUT_KEYCODE(dev, scancode);
+ INPUT_KEYCODE(dev, scancode) = keycode;
+
+ for (i = 0; i < dev->keycodemax; i++)
+ if(INPUT_KEYCODE(dev, scancode) == oldkey)
+ break;
+ if (i == dev->keycodemax)
+ clear_bit(oldkey, dev->keybit);
+ set_bit(keycode, dev->keybit);
return 0;
}
diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c Mon Aug 26 11:14:16 2002
+++ b/drivers/input/evdev.c Mon Aug 26 11:14:16 2002
@@ -234,7 +234,7 @@
struct evdev *evdev = list->evdev;
struct input_dev *dev = evdev->handle.dev;
struct input_absinfo abs;
- int t, u;
+ int i, t, u;
if (!evdev->exist) return -ENODEV;
@@ -258,26 +258,21 @@
case EVIOCGKEYCODE:
if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
- if (t < 0 || t > dev->keycodemax) return -EINVAL;
- switch (dev->keycodesize) {
- case 1: u = *(u8*)(dev->keycode + t); break;
- case 2: u = *(u16*)(dev->keycode + t * 2); break;
- case 4: u = *(u32*)(dev->keycode + t * 4); break;
- default: return -EINVAL;
- }
- if (put_user(u, ((int *) arg) + 1)) return -EFAULT;
+ if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
+ if (put_user(INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
return 0;
case EVIOCSKEYCODE:
if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
- if (t < 0 || t > dev->keycodemax) return -EINVAL;
- if (get_user(u, ((int *) arg) + 1)) return -EFAULT;
- switch (dev->keycodesize) {
- case 1: *(u8*)(dev->keycode + t) = u; break;
- case 2: *(u16*)(dev->keycode + t * 2) = u; break;
- case 4: *(u32*)(dev->keycode + t * 4) = u; break;
- default: return -EINVAL;
- }
+ if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
+ u = INPUT_KEYCODE(dev, t);
+ if (get_user(INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
+
+ for (i = 0; i < dev->keycodemax; i++)
+ if(INPUT_KEYCODE(dev, t) == u) break;
+ if (i == dev->keycodemax) clear_bit(u, dev->keybit);
+ set_bit(INPUT_KEYCODE(dev, t), dev->keybit);
+
return 0;
case EVIOCSFF:
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h Mon Aug 26 11:14:16 2002
+++ b/include/linux/input.h Mon Aug 26 11:14:16 2002
@@ -757,6 +757,9 @@
#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
#define LONG(x) ((x)/BITS_PER_LONG)
+#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
+ ((dev->keycodesize == 1) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
+
struct input_dev {
void *private;
===================================================================
This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##
begin 664 bkpatch9436
M'XL(`&CQ:3T``]U8:T_C1A3];/^*N]HO,1!G9OP.#5T*M$6+6`1+I:I4R+''
MQ$MB(WN<?=3][[WC24+("PJTE1JBC#SW,6?NW'-L\Q8N2UYTM7'^2?!HH+^%
MG_-2=+6R*KD9?</K\SS'Z\X@'_'.Q*O3O^VDV5TE=+2?A2(:P)@795>CIC6;
M$5_O>%<[/_KI\F3_7-=[/3@8A-D-O^`">CU=Y,4X',;ENU`,AGEFBB+,RA$7
MH1GEHWKF6C-"&/XYU+.(X];4);971S2F-+0ICPFS?=?6)\#>36`OQOO,H1;S
MF%?;5A`P_1"HZ=@,".L0O\-<H+1+K:[C;!/6)006TL&V!6VB_P"O"_I`C^!B
MD!>"9R`&'&[YURB/.6":>)AF-]!<I9DT]/.PB,T(T`1\'/.Q&9D8?LYQ83R(
M)KB?"O@\X-DLD0C[0PY1`ZN4[A>B2"/!"YSCT6T)>0;-.4XC.F449DTH;K.2
M,>_!MFS/T<_N3T]O_\V/KI.0Z'N/5"_-HF&%$'#GU1?57N9@OI*!36O7MJE?
M)Q;K^\QRW803'A)_\;PVY?*92P)J.:RV**6/PXJ+5/:V2M*9E'X.EHU#[2(\
MK^:!G]`@LOMQ%-I>D"S!VI#K'I:+B>F38>'A%IW[_G@`C-BUXP0TJ+D=Q82[
M?18G/$DL=RVPE=FFT&C-`@\K)JF\)N!Q8K\(]Q+-'\$M24^Q7RR;(-TDZ2E=
MXCQ=QWG&H$V]_X;U_Q*WU8%^@';QN?DB5\_6G>TS:'](+1NH?JP&K11%%0F%
MZAI['[;D3P].+T].=J6SIYSEH&EI`JVF)KR]AW[MO<D^RO0;-^`/4+%S'KO0
M+WAXNPM_RER!RB6')M4;]##0@*KOHL'V@"G#K"S?`8&ZAMGU7@_FUQV%7PR$
M57!1%1FTCXY/?]EO8-MJJ6:8FH]/SRX_7K\_^O7@P^%1"]/LS/(:N^CLV'+Y
MS071T@QM.Y`/8X0@5W)4@9S7*)"C4#M+!7(9.&APD2"O4Z$K75-;0#2;ZZ)M
M,F/T9)TF99(7T$IQDNQ"BL@6@.#D]K;15*FU.6MO4F#IK*D"J6VGTK9B?]&0
MA\4U$K*E`G=F3C@G=U%RT9@G88OV>?U\<"=XNGH^XV:D]Y'.F+>?WMSE66QF
M7)AAM2DCJABU9.::V(RX2C_=)?UDZ_23_O_U4]VKU^CG@Y(^1SV9$D0U3-5`
M[$"%6L!<"C[:7%\*B1(#,26H@+W%QI73;Y958I&KDTQ2C_`8BU74$<8.M%H2
MS98!87%CP#908R[5C_N7)Q\E1,]J(/H$@M>%6*U6DH9\:IT;_O(-7,ED3Y69
M=4(C&H6I#)@JB[9>6^!>6:HE4=%FLK)F2P_]KQJ96?D<_+C,O.!1?.D1;>.C
M^/0!C3J.K][*J/=T@?G'7LKVXWBAOPP8A5&12\ZKUX8%SJ_<Y3,X?^SA#1G?
MH6.>I!G?>+O$'EXDBVPJ:L#W:*K\+6/>;/PV#?P=NH"MO3F:NIO"6^AAL;4>
<AF'(_IO^(T#I:37J6<0E<>(Z^E]T]1+!=1``````
`
end
--
Vojtech Pavlik
SuSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-08-26 9:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20 13:38 [patch] Amiga input driver compile fixes Vojtech Pavlik
2002-08-21 17:10 ` [patch 1/2] Fix shift-pgup problems in i8042.c Vojtech Pavlik
[not found] ` <20020821191227.B6014@ucw.cz>
2002-08-21 20:32 ` [patch] Franz Sirl's final PPC input conversion part Vojtech Pavlik
2002-08-22 9:09 ` [patch] Two minor fixes for the PPC input conversion Vojtech Pavlik
2002-08-25 13:25 ` [patch] (re)implement setkeycode/getkeycode/kd_mksound/kbd_setrate via the input core Vojtech Pavlik
2002-08-26 9:15 ` [patch] Stricter checks in [gs]etkeycode, recompute keybit there also Vojtech Pavlik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®