[PATCH] module-init-tools: generate modules.seriomap
Hi Rusty, I have converted serio bus to use ID matching and changed serio drivers to use MODULE_DEVICE_TABLE. Now that Vojtech pulled the changes into his tree it would be nice if official module-init-tools generated the module map so that hotplug scripts could automatically load proper drivers. Please consider applying the patch below. Thanks! -- Dmitry diff -urN module-init-tools-3.1-pre5/depmod.c module-init-tools/depmod.c --- module-init-tools-3.1-pre5/depmod.c 2004-06-30 23:24:40.0 -0500 +++ module-init-tools/depmod.c 2005-01-23 01:16:04.0 -0500 @@ -683,6 +683,7 @@ { modules.ieee1394map, output_ieee1394_table }, { modules.isapnpmap, output_isapnp_table }, { modules.inputmap, output_input_table }, + { modules.seriomap, output_serio_table }, { modules.alias, output_aliases }, { modules.symbols, output_symbols }, }; diff -urN module-init-tools-3.1-pre5/depmod.h module-init-tools/depmod.h --- module-init-tools-3.1-pre5/depmod.h 2003-12-23 21:10:57.0 -0500 +++ module-init-tools/depmod.h 2005-01-23 01:17:17.0 -0500 @@ -47,6 +47,8 @@ void *pnp_card_table; unsigned int input_size; void *input_table; + unsigned int serio_size; + void *serio_table; /* File contents and length. */ void *data; diff -urN module-init-tools-3.1-pre5/moduleops_core.c module-init-tools/moduleops_core.c --- module-init-tools-3.1-pre5/moduleops_core.c 2004-05-23 22:01:48.0 -0500 +++ module-init-tools/moduleops_core.c 2005-01-23 01:43:21.0 -0500 @@ -196,6 +196,10 @@ module-input_size = PERBIT(INPUT_DEVICE_SIZE); module-input_table = PERBIT(deref_sym)(module-data, __mod_input_device_table); + + module-serio_size = PERBIT(SERIO_DEVICE_SIZE); + module-serio_table = PERBIT(deref_sym)(module-data, + __mod_serio_device_table); } struct module_ops PERBIT(mod_ops) = { diff -urN module-init-tools-3.1-pre5/tables.c module-init-tools/tables.c --- module-init-tools-3.1-pre5/tables.c 2003-12-24 00:23:38.0 -0500 +++ module-init-tools/tables.c 2005-01-23 01:13:24.0 -0500 @@ -340,3 +340,36 @@ } } } + +static void output_serio_entry(struct serio_device_id *serio, char *name, FILE *out) +{ + fprintf(out, + %-20s 0x%02x 0x%02x 0x%02x 0x%02x\n, + name, + serio-type, + serio-extra, + serio-id, + serio-proto); +} + + +void output_serio_table(struct module *modules, FILE *out) +{ + struct module *i; + + fprintf(out, # serio module type extra id proto\n); + + for (i = modules; i; i = i-next) { + struct serio_device_id *e; + char shortname[strlen(i-pathname) + 1]; + + if (!i-serio_table) + continue; + + make_shortname(shortname, i-pathname); + for (e = i-serio_table; e-type || e-proto; e = (void *)e + i-serio_size) + output_serio_entry(e, shortname, out); + } +} + + diff -urN module-init-tools-3.1-pre5/tables.h module-init-tools/tables.h --- module-init-tools-3.1-pre5/tables.h 2003-12-24 00:18:54.0 -0500 +++ module-init-tools/tables.h 2005-01-23 01:21:48.0 -0500 @@ -116,6 +116,15 @@ #define INPUT_DEVICE_SIZE32 (4 + 4 * 2 + 4 + 16 * 4 + 4 + 2 * 4 + 4 + 4 + 4 + 4 * 4 + 4) #define INPUT_DEVICE_SIZE64 (8 + 4 * 2 + 8 + 8 * 8 + 8 + 8 + 8 + 8 + 8 + 2 * 8 + 8) +struct serio_device_id { + unsigned char type; + unsigned char extra; + unsigned char id; + unsigned char proto; +}; +#define SERIO_DEVICE_SIZE32 (4 * 1) +#define SERIO_DEVICE_SIZE64 (4 * 1 + 4) + /* Functions provided by tables.c */ struct module; void output_usb_table(struct module *modules, FILE *out); @@ -124,5 +133,6 @@ void output_ccw_table(struct module *modules, FILE *out); void output_isapnp_table(struct module *modules, FILE *out); void output_input_table(struct module *modules, FILE *out); +void output_serio_table(struct module *modules, FILE *out); #endif /* MODINITTOOLS_TABLES_H */ - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] hotplug: automatically load proper serio drivers
Hi Greg, I have added ID matching, MODULE_DEVICE_TABLE and hotplug to serio subsystem; now that Vojtech pulled changes into his tree please consider adding these 2 scripts to the hotplug package so drivers for new serio ports could be loaded automatically. Thanks! -- Dmitry serio.agent Description: application/shellscript serio.rc Description: application/shellscript
Re: [RFC/RFT] Better handling of bad xfers/interrupt delays in psmouse
On Sunday 06 February 2005 03:37, Vojtech Pavlik wrote: On Sun, Feb 06, 2005 at 02:23:48AM -0500, Dmitry Torokhov wrote: Ok, here is the patch using PSMOUSE_CMD_POLL. Seems to work fine with 2 external mice that I have and my touchpad in PS/2 compatibility mode. Unfortunately POLL command kicks Synaptics out of absolute mode so I disabled all time-based sync checks for Synaptics altogether. This should be OK since Synaptics have pretty strict protocol rules and usually can resync on their own. I wonder what POLL does to ALPS? Again, 2.6.10 version can be found here: http://www.geocities.com/dt_or/input/2_6_10/ Comments/testing is appreciated. Did you check that issuing the POLL command in the middle of a mouse packet does indeed reset the counter of the streaming mode? I'd expect them to be separate, at least on some mice, if POLL is handled as a normal mouse command, and after the three bytes from POLL are sent, the mouse could just continue sending the packet like with any other command. I have tested with Synaptics touchpad, a noname explorer mouse and a Belkin USB with USB-PS/2 converted, all of them resumed streaming with the full packet. I used the following patch to force polling: = drivers/input/mouse/psmouse-base.c 1.88 vs edited = --- 1.88/drivers/input/mouse/psmouse-base.c 2005-02-06 03:01:36 -05:00 +++ edited/drivers/input/mouse/psmouse-base.c 2005-02-06 12:46:47 -05:00 @@ -185,6 +185,7 @@ static irqreturn_t psmouse_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs) { + static int bcnt; struct psmouse *psmouse = serio_get_drvdata(serio); psmouse_ret_t rc; @@ -237,6 +238,20 @@ goto out; } } + + if (psmouse-state == PSMOUSE_ACTIVATED + psmouse-type != PSMOUSE_SYNAPTICS + !serio-parent + (++bcnt % 502) == 0) { + printk(KERN_WARNING psmouse.c: %s at %s - repolling, throwing %d bytes away.\n, + psmouse-name, psmouse-phys, psmouse-pktcnt); + psmouse-pktcnt = 0; + if (serio_write(serio, PSMOUSE_CMD_POLL 0xff) == 0) { + psmouse-resend = 1; + goto out; + } + } + psmouse-last = jiffies; psmouse-packet[psmouse-pktcnt++] = data; We of course need more testing, I am particularly interested in ALPS reaction to poll command. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] adding the ICS MK712 touchscreen driver to 2.6
On Sunday 06 February 2005 04:25, Vojtech Pavlik wrote: You're right, as usual. ;) How about this one? The spinlock also protects from concurrent hardware register access. I'm always surprised how much code the input API saves when converting a driver ... Yep, this looks much better. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC/RFT] Better handling of bad xfers/interrupt delays in psmouse
On Sunday 06 February 2005 04:27, Pavel Machek wrote: Hi! The patch below attempts to better handle situation when psmouse interrupt is delayed for more than 0.5 sec by requesting a resend. This will allow properly synchronize with the beginning of the packet as mouse is supposed to resend entire package. +* This is second error in a row. If mouse was itialized - attempt +* to rconnect, otherwise just signal failure. Tooo many typso in on coment? Pavel Sorry about that. If the patch turns out to be working fine I'll fix the comments before resubmitting. Hmm, wouldn't it be nice if they put spell checker in GCC? ;) -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2
On Sunday 06 February 2005 08:12, Vojtech Pavlik wrote: On Tue, Feb 01, 2005 at 10:24:39AM -0500, Dmitry Torokhov wrote: On Tue, 1 Feb 2005 08:52:15 -0600, David Fries [EMAIL PROTECTED] wrote: Currently a blocking read, select, or poll call will not return if a joystick device is unplugged. This patch allows them to return. ... static unsigned int joydev_poll(struct file *file, poll_table *wait) { + int mask = 0; struct joydev_list *list = file-private_data; poll_wait(file, list-joydev-wait, wait); - if (list-head != list-tail || list-startup list-joydev-nabs + list-joydev-nkey) - return POLLIN | POLLRDNORM; - return 0; + if(!list-joydev-exist) + mask |= POLLERR; Probably need POLLHUP in addition (or instead of POLLERR). if (joydev-open) + { input_close_device(handle); + wake_up_interruptible(joydev-wait); + } else + { joydev_free(joydev); + } Opening braces should go on the same line as the statement (if (...) {). How about this patch? Looks fine now. Hmm, wait a sec... Don't we also need kill_fasync calls in disconnect routines as well? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] twiddler compile fix.
Hi, Somehow this part of one of the earlier patches was lost... -- Dmitry === [EMAIL PROTECTED], 2005-02-06 20:25:21-05:00, [EMAIL PROTECTED] Input: fix compie error in twidjoy.c Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] twidjoy.c |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) === diff -Nru a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c --- a/drivers/input/joystick/twidjoy.c 2005-02-06 21:56:05 -05:00 +++ b/drivers/input/joystick/twidjoy.c 2005-02-06 21:56:05 -05:00 @@ -58,7 +58,9 @@ #include linux/serio.h #include linux/init.h -MODULE_DESCRIPTION(Handykey Twiddler keyboard as a joystick driver); +#define DRIVER_DESCHandykey Twiddler keyboard as a joystick driver + +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE(GPL); /* - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] module-init-tools: generate modules.seriomap
On Sunday 06 February 2005 22:41, Rusty Russell wrote: On Sun, 2005-02-06 at 02:55 -0500, Dmitry Torokhov wrote: Hi Rusty, I have converted serio bus to use ID matching and changed serio drivers to use MODULE_DEVICE_TABLE. Now that Vojtech pulled the changes into his tree it would be nice if official module-init-tools generated the module map so that hotplug scripts could automatically load proper drivers. Sure, applied. Thanks! I would appreciated tests, however: you can download the testsuite from the same place you get module-init-tools. I don't expect you to be able to compile for all endian/size combinations, but I can do that for you. Ok, I will take a look at it but it will take couple of days... You should also put the logic into the kernel's scripts/mod/file2alias, which is where this is supposed to go these days (I haven't removed the modules.XXX files, since hotplug has enough deployment problems without me making things worse). Oh, I see. I wasn't sure where it should go and FC3 hotplug uses modules.*map so I went that route. What do you think about the patch below then? I am a little bit confused - is anybody using module aliases at the moment? I could not find anything on my box... -- Dmitry === [EMAIL PROTECTED], 2005-02-07 00:14:52-05:00, [EMAIL PROTECTED] Input: adjust file2alias utility to export aliases for serio drivers (serio:tyNprNidNexN). Move serio_device_id from serio.h to mod_devicetable.h Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] include/linux/mod_devicetable.h | 10 ++ include/linux/serio.h | 10 +- scripts/mod/file2alias.c| 23 ++- 3 files changed, 33 insertions(+), 10 deletions(-) === diff -Nru a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h --- a/include/linux/mod_devicetable.h 2005-02-07 00:15:11 -05:00 +++ b/include/linux/mod_devicetable.h 2005-02-07 00:15:11 -05:00 @@ -165,4 +165,14 @@ }; +#define SERIO_ANY 0xff + +struct serio_device_id { + __u8 type; + __u8 extra; + __u8 id; + __u8 proto; +}; + + #endif /* LINUX_MOD_DEVICETABLE_H */ diff -Nru a/include/linux/serio.h b/include/linux/serio.h --- a/include/linux/serio.h 2005-02-07 00:15:11 -05:00 +++ b/include/linux/serio.h 2005-02-07 00:15:11 -05:00 @@ -19,13 +19,7 @@ #include linux/list.h #include linux/spinlock.h #include linux/device.h - -struct serio_device_id { - unsigned char type; - unsigned char extra; - unsigned char id; - unsigned char proto; -}; +#include linux/mod_devicetable.h struct serio { void *port_data; @@ -173,8 +167,6 @@ #define SERIO_TIMEOUT 1 #define SERIO_PARITY 2 #define SERIO_FRAME4 - -#define SERIO_ANY 0xff /* * Serio types diff -Nru a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c --- a/scripts/mod/file2alias.c 2005-02-07 00:15:11 -05:00 +++ b/scripts/mod/file2alias.c 2005-02-07 00:15:11 -05:00 @@ -4,7 +4,7 @@ * * Copyright 2002-2003 Rusty Russell, IBM Corporation * 2003 Kai Germaschewski - * + * * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. @@ -181,6 +181,24 @@ return 1; } +/* Looks like: serio:tyNprNidNexN */ +static int do_serio_entry(const char *filename, + struct serio_device_id *id, char *alias) +{ + id-type = TO_NATIVE(id-type); + id-proto = TO_NATIVE(id-proto); + id-id = TO_NATIVE(id-id); + id-extra = TO_NATIVE(id-extra); + + strcpy(alias, serio:); + ADD(alias, ty, id-type != SERIO_ANY, id-type); + ADD(alias, pr, id-proto != SERIO_ANY, id-proto); + ADD(alias, id, id-id != SERIO_ANY, id-id); + ADD(alias, ex, id-extra != SERIO_ANY, id-extra); + + return 1; +} + /* looks like: pnp:dD */ static int do_pnp_entry(const char *filename, struct pnp_device_id *id, char *alias) @@ -270,6 +288,9 @@ else if (sym_is(symname, __mod_ccw_device_table)) do_table(symval, sym-st_size, sizeof(struct ccw_device_id), do_ccw_entry, mod); + else if (sym_is(symname, __mod_serio_device_table)) + do_table(symval, sym-st_size, sizeof(struct serio_device_id), +do_serio_entry, mod); else if (sym_is(symname, __mod_pnp_device_table)) do_table(symval, sym-st_size, sizeof(struct pnp_device_id), do_pnp_entry, mod); - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org
Re: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2
On Mon, 7 Feb 2005 13:20:33 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Sun, Feb 06, 2005 at 08:21:13PM -0500, Dmitry Torokhov wrote: Opening braces should go on the same line as the statement (if (...) {). How about this patch? Looks fine now. Hmm, wait a sec... Don't we also need kill_fasync calls in disconnect routines as well? This should do it: Not quite... + list_for_each_entry(list, evdev-list, node) + kill_fasync(list-fasync, SIGIO, POLLHUP | POLLERR); Wrong band constants - for SIGIO POLL_HUP and POLL_ERR should be used. /* * SIGPOLL si_codes */ #define POLL_IN (__SI_POLL|1) /* data input available */ #define POLL_OUT(__SI_POLL|2) /* output buffers available */ #define POLL_MSG(__SI_POLL|3) /* input message available */ #define POLL_ERR(__SI_POLL|4) /* i/o error */ #define POLL_PRI(__SI_POLL|5) /* high priority input available */ #define POLL_HUP(__SI_POLL|6) /* device disconnected */ -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ATTN: Dmitry Torokhov] About the trackpad and 2.6.11-rc[23] but not -rc1
On Mon, 7 Feb 2005 09:43:27 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: Hi. Sorry; I accidentally deleted my email and your response, Dmitry. :/ Anyhow, here is /proc/bus/input/devices $ cat /proc/bus/input/devices I: Bus=0011 Vendor=0001 Product=0001 Version=ab41 N: Name=AT Translated Set 2 keyboard P: Phys=isa0060/serio0/input0 H: Handlers=kbd event0 B: EV=120013 B: KEY=4 200 3802078 f840d001 f2df ffef fffe B: MSC=10 B: LED=7 I: Bus=0011 Vendor=0002 Product=0001 Version= N: Name=PS/2 Generic Mouse P: Phys=isa0060/serio1/input0 H: Handlers=mouse0 event1 B: EV=7 B: KEY=7 0 0 0 0 0 0 0 0 B: REL=3 Is that with -rc1 or -rc2? Anyway, I think Inspiron 8600 has an ALPS touchpad and externded support for it just went in in -rc2. I think if you boot with psmouse.proto=exps you will get your mouse back (if your psmouse is compiled as a module you'll need to add 'options psmouse proto=exps' to your /etc/modprobe.conf). Nonetheless it would be nice to see the data stream from the touchpad to see why our ALPS support does not work quite right. Could you please try booting with log_buf_len=131072 i8042.debug=1, and working the touchpad a bit. then send me the output of dmesg -s 131072 (or just /var/log/messages). Thanks! -- Dmitry P.S. I am CC-ing Peter Osterlund since he works on Synaptics/ALPS driver as well. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ATTN: Dmitry Torokhov] About the trackpad and 2.6.11-rc[23] but not -rc1
On Mon, 7 Feb 2005 12:09:50 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Monday, 07 February, 2005: Nonetheless it would be nice to see the data stream from the touchpad to see why our ALPS support does not work quite right. Could you please try booting with log_buf_len=131072 i8042.debug=1, and working the touchpad a bit. then send me the output of dmesg -s 131072 (or just /var/log/messages). dmesg output, non-mouse output trimmed (for obvious reasons, if you think about it ;) is attached. I am sorry, I was not clear enough. I'd like to see -rc2 (the broken one), complete with bootup process, so we will see why it can't synchronize at all. (I of course don't need keyboard data of anything that has been typed after boot). -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ATTN: Dmitry Torokhov] About the trackpad and 2.6.11-rc[23] but not -rc1
On Mon, 7 Feb 2005 13:05:41 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Monday, 07 February, 2005: On Mon, 7 Feb 2005 12:09:50 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Monday, 07 February, 2005: Nonetheless it would be nice to see the data stream from the touchpad to see why our ALPS support does not work quite right. Could you please try booting with log_buf_len=131072 i8042.debug=1, and working the touchpad a bit. then send me the output of dmesg -s 131072 (or just /var/log/messages). dmesg output, non-mouse output trimmed (for obvious reasons, if you think about it ;) is attached. I am sorry, I was not clear enough. I'd like to see -rc2 (the broken one), complete with bootup process, so we will see why it can't synchronize at all. (I of course don't need keyboard data of anything that has been typed after boot). They're both broken in about the same way, iirc. Is there something special in -rc2 that's not in -rc3? No, -rc3 will do as well. Any version starting with -rc2 should do the trick. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ATTN: Dmitry Torokhov] About the trackpad and 2.6.11-rc[23] but not -rc1
On Mon, 7 Feb 2005 13:16:15 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Monday, 07 February, 2005: On Mon, 7 Feb 2005 13:05:41 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Monday, 07 February, 2005: On Mon, 7 Feb 2005 12:09:50 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Monday, 07 February, 2005: Nonetheless it would be nice to see the data stream from the touchpad to see why our ALPS support does not work quite right. Could you please try booting with log_buf_len=131072 i8042.debug=1, and working the touchpad a bit. then send me the output of dmesg -s 131072 (or just /var/log/messages). dmesg output, non-mouse output trimmed (for obvious reasons, if you think about it ;) is attached. I am sorry, I was not clear enough. I'd like to see -rc2 (the broken one), complete with bootup process, so we will see why it can't synchronize at all. (I of course don't need keyboard data of anything that has been typed after boot). They're both broken in about the same way, iirc. Is there something special in -rc2 that's not in -rc3? No, -rc3 will do as well. Any version starting with -rc2 should do the trick. All info in the mail to which you repsonded were from -rc3, including and especially the attachemnt. The only info I sent from -rc1 was the contents of /proc/bus/input/devices in response to the *original* request. Ah, I see. Well, the data in foo.gz file looks like standard PS/2 protocol, it would be interesting to see the beginning of the dmesg (where we do all the detection). It looks like something has reset the absolute mode back to standard relative one. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC/RFT] [patch] Elo serial touchscreen driver
On Tue, 8 Feb 2005 17:42:27 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: Hi! I've written a driver for probably the most common touchscreen type - the serial Elo touchscreen. Hi, Looks very nice, unfortunately I don;t have a touchscreen to test it. One thing - now that kcalloc in the mainline I find myself using it more and more instead of kmalloc + memtest. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ATTN: Dmitry Torokhov] About the trackpad and 2.6.11-rc[23] but not -rc1
On Tue, 8 Feb 2005 12:00:20 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Joseph Pingenot on Monday, 07 February, 2005: Hope that helps. Did it help any? Yes, thank you. A patch is forthcoming later tonight. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Fix ALPS sync loss
Hi, Here is the promised patch. It turns out protocol validation code was a bit (or rather a byte ;) ) off. Please let me know if it fixes your touchpad and I believe it would be nice to have it in 2.6.11. -- Dmitry === [EMAIL PROTECTED], 2005-02-08 18:12:06-05:00, [EMAIL PROTECTED] Input: alps - fix protocol validation rules causing touchpad to lose sync if an absolute packet is received after a relative packet with negative Y displacement. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] alps.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) === diff -Nru a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c --- a/drivers/input/mouse/alps.c2005-02-08 18:16:27 -05:00 +++ b/drivers/input/mouse/alps.c2005-02-08 18:16:27 -05:00 @@ -198,8 +198,8 @@ return PSMOUSE_BAD_DATA; /* Bytes 2 - 6 should have 0 in the highest bit */ - if (psmouse-pktcnt 1 psmouse-pktcnt = 6 - (psmouse-packet[psmouse-pktcnt] 0x80)) + if (psmouse-pktcnt = 2 psmouse-pktcnt = 6 + (psmouse-packet[psmouse-pktcnt - 1] 0x80)) return PSMOUSE_BAD_DATA; if (psmouse-pktcnt == 6) { - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC][PATCH] add driver matching priorities
On Thu, 10 Feb 2005 12:18:37 -0500, Adam Belay [EMAIL PROTECTED] wrote: On Thu, 2005-02-10 at 00:41 -0800, Greg KH wrote: On Fri, Jan 28, 2005 at 05:30:04PM -0500, Adam Belay wrote: Hi, This patch adds initial support for driver matching priorities to the driver model. It is needed for my work on converting the pci bridge driver to use struct device_driver. It may also be helpful for driver with more complex (or long id lists as I've seen in many cases) matching criteria. match has been added to struct device_driver. There are now two steps in the matching process. The first step is a bus specific filter that determines possible driver candidates. The second step is a driver specific match function that verifies if the driver will work with the hardware, and returns a priority code (how well it is able to handle the device). The bus layer could override the driver's match function if necessary (similar to how it passes *probe through it's layer and then on to the actual driver). The current priorities are as follows: enum { MATCH_PRIORITY_FAILURE = 0, MATCH_PRIORITY_GENERIC, MATCH_PRIORITY_NORMAL, MATCH_PRIORITY_VENDOR, }; let me know if any of this would need to be changed. For example, the struct bus_type match function could return a priority code. Of course this patch is not going to be effective alone. We also need to change the init order. If a driver is registered early but isn't the best available, it will be bound to the device prematurely. This would be a problem for carbus (yenta) bridges. I think we may have to load all in kernel drivers first, and then begin matching them to hardware. Do you agree? If so, I'd be happy to make a patch for that too. I think the issue that Al raises about drivers grabbing devices, and then trying to unbind them might be a real problem. I agree. Do you think registering every in-kernel driver before probing hardware would solve this problem? And what do you do with drivers that are built as modules? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC][PATCH] add driver matching priorities
On Thu, 10 Feb 2005 10:33:38 -0800, Greg KH [EMAIL PROTECTED] wrote: On Thu, Feb 10, 2005 at 12:18:37PM -0500, Adam Belay wrote: The second *match function in struct device_driver gives the driver a chance to evaluate it's ability of controlling the device and solves a few problems with the current implementation. (ex. it's not possible to detect ISA Modems with only a list of PnP IDs, and some PCI devices support a pool of IDs that is too large to put in an ID table). What deficiancy in the current id tables do you see? What driver has a id table that is too big? Is there some way we can change it to make it work better? Stepping a bit farther away - sometimes generinc matching is not enough to determine if driver suits for a device - actual probing is needed (consider atkbd and psmouse - they can both attach to the same port but we can't determine if it is a keyboard or mouse until we started probing) -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/5] sonypi driver update
On Thu, 10 Feb 2005 16:44:21 +0100, Stelian Pop [EMAIL PROTECTED] wrote: Hi, Over the last few weeks I've collected a few patches in my tree coming from others and it's time to merge them upstream: 1/5: sonypi: replace schedule_timeout() with msleep() 2/5: sonypi: add another HELP button event 3/5: sonypi: use MISC_DYNAMIC_MINOR in miscdevice.minor assignment. 4/5: sonypi: fold the contents of sonypi.h into sonypi.c 5/5: sonypi: add fan and temperature status/control Any chance that last one could be done via sysfs attributes instead of new IOCTLs? This way you can control fan from the command line. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Linux Kernel Subversion Howto
On Thu, 10 Feb 2005 20:23:19 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Thu, Feb 10, 2005 at 10:42:15AM -0600, Steve Lee wrote: Roman, besides BK being closed source, how exactly is it lacking for your needs? If what it lacks is a good idea and helps many, Larry and crew might be willing to add whatever it is you need. A feature I lack is 'floating changesets', that would keep always at the top of the history, rediffed, remerged and updated as other changesets come in. I know quilt can do it, but quilt can't do other things I like on bk. I have switched from BK to BK + quilt - I use BK to do pull from various trees and merge it all together and then quilt to drop my work-in-progress on top and refresh (rediff) so there are no offests. So far it is very handy -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Fix ALPS sync loss
On Wed, 9 Feb 2005 11:35:34 -0600, Joseph Pingenot [EMAIL PROTECTED] wrote: From Dmitry Torokhov on Tuesday, 08 February, 2005: Hi, Here is the promised patch. It turns out protocol validation code was a bit (or rather a byte ;) ) off. Please let me know if it fixes your touchpad and I believe it would be nice to have it in 2.6.11. This patch seems to be working for me too. Thanks a million, Dmitry! I owe you a beer some time. :) You are welcome. I am glad we got your touchpad going. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] arp_queue: serializing unlink + kfree_skb
On Thursday 10 February 2005 22:50, David S. Miller wrote: Unlike the above routines, it is required that explicit memory barriers are performed before and after the operation. It must be done such that all memory operations before and after the atomic operation calls are strongly ordered with respect to the atomic operation itself. Hmm, given that this description will not only be read by implementers of atomic functions, but also by users, the explicit memory barriers may be confusing. Absolutely, I agree. My fingers even itched as I typed those lines in. I didn't change the wording because I couldn't come up with anything better. What about the following: Unlike the routines above, these functions should always perform memory barriers before and after the operation in question so that all memory accesses before and after the atomic operation are strongly ordered with respect to the atomic operation itself. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/10] Gameport: rename driver to port_data
=== [EMAIL PROTECTED], 2005-02-11 01:09:43-05:00, [EMAIL PROTECTED] Input: rename gameport-driver to gameport-port_data in preparation to sysfs integration. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/gameport/lightning.c |8 drivers/input/gameport/vortex.c| 10 +- drivers/input/joystick/a3d.c |8 include/linux/gameport.h |4 ++-- sound/oss/trident.c| 10 +- sound/pci/au88x0/au88x0_game.c | 15 +++ 6 files changed, 27 insertions(+), 28 deletions(-) === diff -Nru a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c --- a/drivers/input/gameport/lightning.c2005-02-11 01:34:39 -05:00 +++ b/drivers/input/gameport/lightning.c2005-02-11 01:34:39 -05:00 @@ -79,7 +79,7 @@ static int l4_cooked_read(struct gameport *gameport, int *axes, int *buttons) { - struct l4 *l4 = gameport-driver; + struct l4 *l4 = gameport-port_data; unsigned char status; int i, result = -1; @@ -112,7 +112,7 @@ static int l4_open(struct gameport *gameport, int mode) { - struct l4 *l4 = gameport-driver; + struct l4 *l4 = gameport-port_data; if (l4-port != 0 mode != GAMEPORT_MODE_COOKED) return -1; outb(L4_SELECT_ANALOG, L4_PORT); @@ -190,7 +190,7 @@ { int i, t; int cal[4]; - struct l4 *l4 = gameport-driver; + struct l4 *l4 = gameport-port_data; if (l4_getcal(l4-port, cal)) return -1; @@ -252,7 +252,7 @@ sprintf(l4-phys, isa%04x/gameport%d, L4_PORT, 4 * i + j); gameport = l4-gameport; - gameport-driver = l4; + gameport-port_data = l4; gameport-open = l4_open; gameport-cooked_read = l4_cooked_read; gameport-calibrate = l4_calibrate; diff -Nru a/drivers/input/gameport/vortex.c b/drivers/input/gameport/vortex.c --- a/drivers/input/gameport/vortex.c 2005-02-11 01:34:39 -05:00 +++ b/drivers/input/gameport/vortex.c 2005-02-11 01:34:39 -05:00 @@ -62,19 +62,19 @@ static unsigned char vortex_read(struct gameport *gameport) { - struct vortex *vortex = gameport-driver; + struct vortex *vortex = gameport-port_data; return readb(vortex-io + VORTEX_LEG); } static void vortex_trigger(struct gameport *gameport) { - struct vortex *vortex = gameport-driver; + struct vortex *vortex = gameport-port_data; writeb(0xff, vortex-io + VORTEX_LEG); } static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons) { - struct vortex *vortex = gameport-driver; + struct vortex *vortex = gameport-port_data; int i; *buttons = (~readb(vortex-base + VORTEX_LEG) 4) 0xf; @@ -89,7 +89,7 @@ static int vortex_open(struct gameport *gameport, int mode) { - struct vortex *vortex = gameport-driver; + struct vortex *vortex = gameport-port_data; switch (mode) { case GAMEPORT_MODE_COOKED: @@ -120,7 +120,7 @@ pci_set_drvdata(dev, vortex); - vortex-gameport.driver = vortex; + vortex-gameport.port_data = vortex; vortex-gameport.fuzz = 64; vortex-gameport.read = vortex_read; diff -Nru a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c --- a/drivers/input/joystick/a3d.c 2005-02-11 01:34:39 -05:00 +++ b/drivers/input/joystick/a3d.c 2005-02-11 01:34:39 -05:00 @@ -197,7 +197,7 @@ static int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons) { - struct a3d *a3d = gameport-driver; + struct a3d *a3d = gameport-port_data; int i; for (i = 0; i 4; i++) axes[i] = (a3d-axes[i] 254) ? a3d-axes[i] : -1; @@ -212,7 +212,7 @@ static int a3d_adc_open(struct gameport *gameport, int mode) { - struct a3d *a3d = gameport-driver; + struct a3d *a3d = gameport-port_data; if (mode != GAMEPORT_MODE_COOKED) return -1; if (!a3d-used++) @@ -226,7 +226,7 @@ static void a3d_adc_close(struct gameport *gameport) { - struct a3d *a3d = gameport-driver; + struct a3d *a3d = gameport-port_data; if (!--a3d-used) del_timer(a3d-timer); } @@ -336,7 +336,7 @@ a3d-dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y); a3d-dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE); - a3d-adc.driver = a3d; + a3d-adc.port_data = a3d; a3d-adc.open = a3d_adc_open; a3d-adc.close = a3d_adc_close; a3d-adc.cooked_read = a3d_adc_cooked_read; diff -Nru
[PATCH 0/10] Convert gameport to driver model/sysfs
Hi, This series of patches adds a new gameport bus to the driver model. It is implemented very similarly to serio bus and also allows individual drivers to be manually bound/disconnected from a port by manipulating port's drvctl attribute. 01-gameport-renames1.patch - rename gameport-driver to gameport-port_data in preparation to sysfs integration to avoid confusion with real drivers. 02-gameport-renames2.patch - more renames in gameport in preparations to sysfs integration, gameport_dev renamed to gameport_driver, gameport_[un]register_device renamed to gameport_[un]register_driver 03-gameport-connect-mandatory.patch - make connect and disconnect mandatory as these call gameport_open and gameport_close which actually bind driver and port together. 04-gameport-dynalloc-prepare.patch - sysfs/kobjects requires objects be allocated synamically. Prepare to dynamic gameport allocation, create gameport_allocate_port and gameport_free_port; dynamically allocated ports are freed by core upon release. Also add gameport_set_name and gameport_set_phys to ease transition. 05-gameport-dynalloc-input.patch - convert drivers in input/gameport to dynamic gameport allocation. 06-gameport-dynalloc-sound-oss.patch - convert drivers in sound/oss to dynamic gameport allocation. 07-gameport-dynalloc-sound-alsa.patch - convert drivers in sound/pci to dynamic gameport allocation. 08-gameport-drivers-sysfs.patch - add gameport bus and have joystick gameport drivers register themselves on this bus. 09-gameport-devices-sysfs.patch - complete gameport sysfs integration. Gameports are registered on the gameport bus. 10-gameport-drvdata.patch - Get rid of gameport-private, use driver-specific data in device structure, access through gameport_get/set_drvdata helpers. The changes can also be pulled from my tree (which has Vojtech's input tree as a parent): bk pull bk://dtor.bkbits.net/input I am CC-ing ALSA list as the changes touch quite a few sound drivers. Comments/testing is appreciated. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/10] Gameport: rename gameport_dev to gameport_driver
=== [EMAIL PROTECTED], 2005-02-11 01:09:59-05:00, [EMAIL PROTECTED] Input: more renames in gameport in preparations to sysfs integration - gameport_dev - gameport_driver - gameport_[un]register_device - gameport_[un]register_driver Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/gameport/gameport.c | 52 ++-- drivers/input/joystick/a3d.c| 10 +++--- drivers/input/joystick/adi.c| 10 +++--- drivers/input/joystick/analog.c | 18 ++-- drivers/input/joystick/cobra.c | 10 +++--- drivers/input/joystick/gf2k.c | 10 +++--- drivers/input/joystick/grip.c | 10 +++--- drivers/input/joystick/grip_mp.c| 10 +++--- drivers/input/joystick/guillemot.c | 10 +++--- drivers/input/joystick/interact.c | 10 +++--- drivers/input/joystick/joydump.c| 12 drivers/input/joystick/sidewinder.c | 10 +++--- drivers/input/joystick/tmdc.c | 10 +++--- include/linux/gameport.h| 12 14 files changed, 97 insertions(+), 97 deletions(-) === diff -Nru a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c --- a/drivers/input/gameport/gameport.c 2005-02-11 01:34:53 -05:00 +++ b/drivers/input/gameport/gameport.c 2005-02-11 01:34:53 -05:00 @@ -25,15 +25,15 @@ EXPORT_SYMBOL(gameport_register_port); EXPORT_SYMBOL(gameport_unregister_port); -EXPORT_SYMBOL(gameport_register_device); -EXPORT_SYMBOL(gameport_unregister_device); +EXPORT_SYMBOL(gameport_register_driver); +EXPORT_SYMBOL(gameport_unregister_driver); EXPORT_SYMBOL(gameport_open); EXPORT_SYMBOL(gameport_close); EXPORT_SYMBOL(gameport_rescan); EXPORT_SYMBOL(gameport_cooked_read); static LIST_HEAD(gameport_list); -static LIST_HEAD(gameport_dev_list); +static LIST_HEAD(gameport_driver_list); #ifdef __i386__ @@ -100,61 +100,61 @@ #endif } -static void gameport_find_dev(struct gameport *gameport) +static void gameport_find_driver(struct gameport *gameport) { -struct gameport_dev *dev; +struct gameport_driver *drv; -list_for_each_entry(dev, gameport_dev_list, node) { - if (gameport-dev) +list_for_each_entry(drv, gameport_driver_list, node) { + if (gameport-drv) break; - if (dev-connect) - dev-connect(gameport, dev); + if (drv-connect) + drv-connect(gameport, drv); } } void gameport_rescan(struct gameport *gameport) { gameport_close(gameport); - gameport_find_dev(gameport); + gameport_find_driver(gameport); } void gameport_register_port(struct gameport *gameport) { list_add_tail(gameport-node, gameport_list); gameport-speed = gameport_measure_speed(gameport); - gameport_find_dev(gameport); + gameport_find_driver(gameport); } void gameport_unregister_port(struct gameport *gameport) { list_del_init(gameport-node); - if (gameport-dev gameport-dev-disconnect) - gameport-dev-disconnect(gameport); + if (gameport-drv gameport-drv-disconnect) + gameport-drv-disconnect(gameport); } -void gameport_register_device(struct gameport_dev *dev) +void gameport_register_driver(struct gameport_driver *drv) { struct gameport *gameport; - list_add_tail(dev-node, gameport_dev_list); + list_add_tail(drv-node, gameport_driver_list); list_for_each_entry(gameport, gameport_list, node) - if (!gameport-dev dev-connect) - dev-connect(gameport, dev); + if (!gameport-drv drv-connect) + drv-connect(gameport, drv); } -void gameport_unregister_device(struct gameport_dev *dev) +void gameport_unregister_driver(struct gameport_driver *drv) { struct gameport *gameport; - list_del_init(dev-node); + list_del_init(drv-node); list_for_each_entry(gameport, gameport_list, node) { - if (gameport-dev == dev dev-disconnect) - dev-disconnect(gameport); - gameport_find_dev(gameport); + if (gameport-drv == drv drv-disconnect) + drv-disconnect(gameport); + gameport_find_driver(gameport); } } -int gameport_open(struct gameport *gameport, struct gameport_dev *dev, int mode) +int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode) { if (gameport-open) { if (gameport-open(gameport, mode)) @@ -164,17 +164,17 @@ return -1; } - if (gameport-dev) + if (gameport-drv) return -1; - gameport-dev = dev; + gameport-drv = drv
[PATCH 3/10] Gameport: connect() is mandatory
=== [EMAIL PROTECTED], 2005-02-11 01:18:29-05:00, [EMAIL PROTECTED] Input: make connect and disconnect methods mandatory for gameport drivers since that's where gameport_{open|close} are called from to actually bind driver to a port. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] gameport.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) === diff -Nru a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c --- a/drivers/input/gameport/gameport.c 2005-02-11 01:35:40 -05:00 +++ b/drivers/input/gameport/gameport.c 2005-02-11 01:35:40 -05:00 @@ -107,8 +107,7 @@ list_for_each_entry(drv, gameport_driver_list, node) { if (gameport-drv) break; - if (drv-connect) - drv-connect(gameport, drv); + drv-connect(gameport, drv); } } @@ -128,7 +127,7 @@ void gameport_unregister_port(struct gameport *gameport) { list_del_init(gameport-node); - if (gameport-drv gameport-drv-disconnect) + if (gameport-drv) gameport-drv-disconnect(gameport); } @@ -138,7 +137,7 @@ list_add_tail(drv-node, gameport_driver_list); list_for_each_entry(gameport, gameport_list, node) - if (!gameport-drv drv-connect) + if (!gameport-drv) drv-connect(gameport, drv); } @@ -148,7 +147,7 @@ list_del_init(drv-node); list_for_each_entry(gameport, gameport_list, node) { - if (gameport-drv == drv drv-disconnect) + if (gameport-drv == drv) drv-disconnect(gameport); gameport_find_driver(gameport); } - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/10] Gameport: convert input/gameport to dynamic allocation
=== [EMAIL PROTECTED], 2005-02-11 01:19:36-05:00, [EMAIL PROTECTED] Input: convert input/gameport to dynamic gameport allocation. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/gameport/cs461x.c | 29 + drivers/input/gameport/emu10k1-gp.c | 40 drivers/input/gameport/fm801-gp.c | 57 +-- drivers/input/gameport/lightning.c | 176 ++-- drivers/input/gameport/ns558.c | 120 +++- drivers/input/gameport/vortex.c | 68 ++--- drivers/input/joystick/a3d.c| 59 +--- include/linux/gameport.h|3 8 files changed, 286 insertions(+), 266 deletions(-) === diff -Nru a/drivers/input/gameport/cs461x.c b/drivers/input/gameport/cs461x.c --- a/drivers/input/gameport/cs461x.c 2005-02-11 01:38:07 -05:00 +++ b/drivers/input/gameport/cs461x.c 2005-02-11 01:38:07 -05:00 @@ -120,9 +120,6 @@ static unsigned long ba0_addr; static unsigned int __iomem *ba0; -static char phys[32]; -static char name[] = CS416x Gameport; - #ifdef CS461X_FULL_MAP static unsigned long ba1_addr; static union ba1_t { @@ -160,10 +157,10 @@ static int cs461x_free(struct pci_dev *pdev) { struct gameport *port = pci_get_drvdata(pdev); - if(port){ + + if (port) gameport_unregister_port(port); - kfree(port); - } + if (ba0) iounmap(ba0); #ifdef CS461X_FULL_MAP if (ba1.name.data0) iounmap(ba1.name.data0); @@ -267,18 +264,17 @@ return -ENOMEM; } #else - if (ba0 == NULL){ + if (ba0 == NULL) { cs461x_free(pdev); return -ENOMEM; } #endif - if (!(port = kmalloc(sizeof(struct gameport), GFP_KERNEL))) { - printk(KERN_ERR Memory allocation failed.\n); + if (!(port = gameport_allocate_port())) { + printk(KERN_ERR cs461x: Memory allocation failed\n); cs461x_free(pdev); return -ENOMEM; } - memset(port, 0, sizeof(struct gameport)); pci_set_drvdata(pdev, port); @@ -287,21 +283,14 @@ port-read = cs461x_gameport_read; port-cooked_read = cs461x_gameport_cooked_read; - sprintf(phys, pci%s/gameport0, pci_name(pdev)); - - port-name = name; - port-phys = phys; - port-id.bustype = BUS_PCI; - port-id.vendor = pdev-vendor; - port-id.product = pdev-device; + gameport_set_name(port, CS416x); + gameport_set_phys(port, pci%s/gameport0, pci_name(pdev)); + port-dev.parent = pdev-dev; cs461x_pokeBA0(BA0_JSIO, 0xFF); // ? cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW); gameport_register_port(port); - - printk(KERN_INFO gameport: %s on pci%s speed %d kHz\n, - name, pci_name(pdev), port-speed); return 0; } diff -Nru a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c --- a/drivers/input/gameport/emu10k1-gp.c 2005-02-11 01:38:07 -05:00 +++ b/drivers/input/gameport/emu10k1-gp.c 2005-02-11 01:38:07 -05:00 @@ -44,13 +44,13 @@ struct emu { struct pci_dev *dev; - struct gameport gameport; + struct gameport *gameport; + int io; int size; - char phys[32]; }; static struct pci_device_id emu_tbl[] = { - + { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ { 0x1102, 0x7004, PCI_ANY_ID, PCI_ANY_ID }, /* Dell SB Live */ @@ -64,6 +64,7 @@ { int ioport, iolen; struct emu *emu; + struct gameport *port; if (pci_enable_device(pdev)) return -EBUSY; @@ -74,31 +75,29 @@ if (!request_region(ioport, iolen, emu10k1-gp)) return -EBUSY; - if (!(emu = kmalloc(sizeof(struct emu), GFP_KERNEL))) { - printk(KERN_ERR emu10k1-gp: Memory allocation failed.\n); + emu = kcalloc(1, sizeof(struct emu), GFP_KERNEL); + port = gameport_allocate_port(); + if (!emu || !port) { + printk(KERN_ERR emu10k1-gp: Memory allocation failed\n); release_region(ioport, iolen); + kfree(emu); + gameport_free_port(port); return -ENOMEM; } - memset(emu, 0, sizeof(struct emu)); - - sprintf(emu-phys, pci%s/gameport0, pci_name(pdev)); + emu-io = ioport; emu-size = iolen; emu-dev = pdev; + emu-gameport = port; - emu-gameport.io = ioport; - emu-gameport.name = pci_name(pdev); - emu-gameport.phys = emu-phys; - emu-gameport.id.bustype = BUS_PCI; - emu-gameport.id.vendor = pdev-vendor; - emu-gameport.id.product = pdev-device
[PATCH 4/10] Gameport: prepare to dynamic allocation
=== [EMAIL PROTECTED], 2005-02-11 01:18:48-05:00, [EMAIL PROTECTED] Input: prepare for dynamic gameport allocation: - provide functions to allocate and free gameports; - provide functions to properly set name and phys; - dynamically allocated gameports are automatically announced in kernel logs and freed when unregistered. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/gameport/gameport.c | 24 include/linux/gameport.h | 38 +++--- 2 files changed, 55 insertions(+), 7 deletions(-) === diff -Nru a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c --- a/drivers/input/gameport/gameport.c 2005-02-11 01:36:13 -05:00 +++ b/drivers/input/gameport/gameport.c 2005-02-11 01:36:13 -05:00 @@ -31,6 +31,8 @@ EXPORT_SYMBOL(gameport_close); EXPORT_SYMBOL(gameport_rescan); EXPORT_SYMBOL(gameport_cooked_read); +EXPORT_SYMBOL(gameport_set_name); +EXPORT_SYMBOL(gameport_set_phys); static LIST_HEAD(gameport_list); static LIST_HEAD(gameport_driver_list); @@ -117,10 +119,30 @@ gameport_find_driver(gameport); } +void gameport_set_phys(struct gameport *gameport, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + gameport-phys = gameport-phys_buf; + vsnprintf(gameport-phys_buf, sizeof(gameport-phys_buf), fmt, args); + va_end(args); +} + void gameport_register_port(struct gameport *gameport) { list_add_tail(gameport-node, gameport_list); gameport-speed = gameport_measure_speed(gameport); + + if (gameport-dyn_alloc) { + if (gameport-io) + printk(KERN_INFO gameport: %s is %s, io %#x, speed %d kHz\n, + gameport-name, gameport-phys, gameport-io, gameport-speed); + else + printk(KERN_INFO gameport: %s is %s, speed %d kHz\n, + gameport-name, gameport-phys, gameport-speed); + } + gameport_find_driver(gameport); } @@ -129,6 +151,8 @@ list_del_init(gameport-node); if (gameport-drv) gameport-drv-disconnect(gameport); + if (gameport-dyn_alloc) + kfree(gameport); } void gameport_register_driver(struct gameport_driver *drv) diff -Nru a/include/linux/gameport.h b/include/linux/gameport.h --- a/include/linux/gameport.h 2005-02-11 01:36:13 -05:00 +++ b/include/linux/gameport.h 2005-02-11 01:36:13 -05:00 @@ -12,15 +12,16 @@ #include asm/io.h #include linux/input.h #include linux/list.h - -struct gameport; +#include linux/device.h struct gameport { void *private; /* Private pointer for joystick drivers */ void *port_data;/* Private pointer for gameport drivers */ char *name; + char name_buf[32]; char *phys; + char phys_buf[32]; struct input_id id; @@ -36,8 +37,12 @@ void (*close)(struct gameport *); struct gameport_driver *drv; + struct device dev; struct list_head node; + + /* temporary, till sysfs transition is complete */ + int dyn_alloc; }; struct gameport_driver { @@ -55,13 +60,32 @@ void gameport_close(struct gameport *gameport); void gameport_rescan(struct gameport *gameport); -#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) +static inline struct gameport *gameport_allocate_port(void) +{ + struct gameport *gameport = kcalloc(1, sizeof(struct gameport), GFP_KERNEL); + + if (gameport) + gameport-dyn_alloc = 1; + + return gameport; +} + +static inline void gameport_free_port(struct gameport *gameport) +{ + kfree(gameport); +} + +static inline void gameport_set_name(struct gameport *gameport, const char *name) +{ + gameport-name = gameport-name_buf; + strlcpy(gameport-name, name, sizeof(gameport-name_buf)); +} + +void gameport_set_phys(struct gameport *gameport, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); + void gameport_register_port(struct gameport *gameport); void gameport_unregister_port(struct gameport *gameport); -#else -static inline void gameport_register_port(struct gameport *gameport) { return; } -static inline void gameport_unregister_port(struct gameport *gameport) { return; } -#endif void gameport_register_driver(struct gameport_driver *drv); void gameport_unregister_driver(struct gameport_driver *drv); - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/10] Gameport: convert sound/oss to dynamic allocation
=== [EMAIL PROTECTED], 2005-02-11 01:20:08-05:00, [EMAIL PROTECTED] Input: convert sound/oss to dynamic gameport allocation. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] cmpci.c | 100 ++- es1370.c | 34 es1371.c | 52 ++ esssolo1.c | 47 --- mad16.c | 47 ++- sonicvibes.c | 49 +--- trident.c| 39 +-- 7 files changed, 249 insertions(+), 119 deletions(-) === diff -Nru a/sound/oss/cmpci.c b/sound/oss/cmpci.c --- a/sound/oss/cmpci.c 2005-02-11 01:38:28 -05:00 +++ b/sound/oss/cmpci.c 2005-02-11 01:38:28 -05:00 @@ -426,7 +426,7 @@ struct address_info mpu_data; #endif #ifdef CONFIG_SOUND_CMPCI_JOYSTICK - struct gameport gameport; + struct gameport *gameport; #endif int chip_version; @@ -468,17 +468,17 @@ static LIST_HEAD(devs); -static int mpuio = 0; -static int fmio = 0; -static int joystick = 0; -static int spdif_inverse = 0; -static int spdif_loop = 0; -static int spdif_out = 0; -static int use_line_as_rear = 0; -static int use_line_as_bass = 0; -static int use_mic_as_bass = 0; -static int mic_boost = 0; -static int hw_copy = 0; +static int mpuio; +static int fmio; +static int joystick; +static int spdif_inverse; +static int spdif_loop; +static int spdif_out; +static int use_line_as_rear; +static int use_line_as_bass; +static int use_mic_as_bass; +static int mic_boost; +static int hw_copy; module_param(mpuio, int, 0); module_param(fmio, int, 0); module_param(joystick, bool, 0); @@ -2984,6 +2984,51 @@ return ChipVersion; } +#ifdef CONFIG_SOUND_CMPCI_JOYSTICK +static int __devinit cm_create_gameport(struct cm_state *s, int io_port) +{ + struct gameport *gp; + + if (!request_region(io_port, CM_EXTENT_GAME, cmpci GAME)) { + printk(KERN_ERR cmpci: gameport io ports 0x%#x in use\n, io_port); + return -EBUSY; + } + + if (!(s-gameport = gp = gameport_allocate_port())) { + printk(KERN_ERR cmpci: can not allocate memory for gameport\n); + release_region(io_port, CM_EXTENT_GAME); + return -ENOMEM; + } + + gameport_set_name(gp, C-Media GP); + gameport_set_phys(gp, pci%s/gameport0, pci_name(s-dev)); + gp-dev.parent = s-dev-dev; + gp-io = io_port; + + /* enable joystick */ + maskb(s-iobase + CODEC_CMI_FUNCTRL1, ~0, 0x02); + + gameport_register_port(gp); + + return 0; +} + +static void __devexit cm_free_gameport(struct cm_state *s) +{ + if (s-gameport) { + int gpio = s-gameport-io; + + gameport_unregister_port(s-gameport); + s-gameport = NULL; + maskb(s-iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0); + release_region(gpio, CM_EXTENT_GAME); + } +} +#else +static inline int cm_create_gameport(struct cm_state *s, int io_port) { return -ENOSYS; } +static inline void cm_free_gameport(struct cm_state *s) { } +#endif + #defineecho_option(x)\ if (x) strcat(options, #x ) @@ -3229,22 +3274,11 @@ } skip_mpu: #endif -#ifdef CONFIG_SOUND_CMPCI_JOYSTICK - /* enable joystick */ - if (joystick) { - s-gameport.io = 0x200; - if (!request_region(s-gameport.io, CM_EXTENT_GAME, cmpci GAME)) { - printk(KERN_ERR cmpci: gameport io ports in use\n); - s-gameport.io = 0; - } else { - maskb(s-iobase + CODEC_CMI_FUNCTRL1, ~0, 0x02); - gameport_register_port(s-gameport); - } - } else { - maskb(s-iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0); - s-gameport.io = 0; - } -#endif + /* disable joystick port */ + maskb(s-iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0); + if (joystick) + cm_create_gameport(s, 0x200); + /* store it in the driver field */ pci_set_drvdata(pcidev, s); /* put it into driver list */ @@ -3278,13 +3312,9 @@ if (!s) return; -#ifdef CONFIG_SOUND_CMPCI_JOYSTICK - if (s-gameport.io) { - gameport_unregister_port(s-gameport); - release_region(s-gameport.io, CM_EXTENT_GAME); - maskb(s-iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0); - } -#endif + + cm_free_gameport(s); + #ifdef CONFIG_SOUND_CMPCI_FM if (s-iosynth) { /* disable FM */ diff -Nru a/sound/oss/es1370.c b/sound/oss/es1370.c --- a/sound/oss/es1370.c2005-02-11 01:38:28 -05:00
[PATCH 7/10] Gameport: convert sound/alsa to dynamic allocation
=== [EMAIL PROTECTED], 2005-02-11 01:20:30-05:00, [EMAIL PROTECTED] Input: convert sound/pci to dynamic gameport allocation. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] include/sound/cs46xx.h |4 - include/sound/trident.h |4 - include/sound/ymfpci.h | 14 +-- sound/pci/als4000.c | 111 +++-- sound/pci/au88x0/au88x0.c|7 - sound/pci/au88x0/au88x0.h|2 sound/pci/au88x0/au88x0_game.c | 49 ++-- sound/pci/azt3328.c | 111 + sound/pci/cmipci.c | 104 ++- sound/pci/cs4281.c | 91 --- sound/pci/cs46xx/cs46xx_lib.c| 81 ++--- sound/pci/ens1370.c | 122 +-- sound/pci/es1938.c | 52 ++--- sound/pci/es1968.c | 76 ++- sound/pci/sonicvibes.c | 55 +++--- sound/pci/trident/trident.c |2 sound/pci/trident/trident_main.c | 87 ++ sound/pci/via82xx.c | 89 +-- sound/pci/ymfpci/ymfpci.c| 149 --- sound/pci/ymfpci/ymfpci_main.c |9 -- 20 files changed, 761 insertions(+), 458 deletions(-) === diff -Nru a/include/sound/cs46xx.h b/include/sound/cs46xx.h --- a/include/sound/cs46xx.h2005-02-11 01:39:33 -05:00 +++ b/include/sound/cs46xx.h2005-02-11 01:39:33 -05:00 @@ -1720,7 +1720,7 @@ snd_kcontrol_t *eapd_switch; /* for amplifier hack */ int accept_valid; /* accept mmap valid (for OSS) */ - struct snd_cs46xx_gameport *gameport; + struct gameport *gameport; #ifdef CONFIG_SND_CS46XX_DEBUG_GPIO int current_gpio; @@ -1751,6 +1751,6 @@ int snd_cs46xx_mixer(cs46xx_t *chip); int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi); int snd_cs46xx_start_dsp(cs46xx_t *chip); -void snd_cs46xx_gameport(cs46xx_t *chip); +int snd_cs46xx_gameport(cs46xx_t *chip); #endif /* __SOUND_CS46XX_H */ diff -Nru a/include/sound/trident.h b/include/sound/trident.h --- a/include/sound/trident.h 2005-02-11 01:39:33 -05:00 +++ b/include/sound/trident.h 2005-02-11 01:39:33 -05:00 @@ -448,7 +448,7 @@ spinlock_t reg_lock; - struct snd_trident_gameport *gameport; + struct gameport *gameport; }; int snd_trident_create(snd_card_t * card, @@ -457,7 +457,7 @@ int pcm_spdif_device, int max_wavetable_size, trident_t ** rtrident); -void snd_trident_gameport(trident_t *trident); +int snd_trident_create_gameport(trident_t *trident); int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); diff -Nru a/include/sound/ymfpci.h b/include/sound/ymfpci.h --- a/include/sound/ymfpci.h2005-02-11 01:39:33 -05:00 +++ b/include/sound/ymfpci.h2005-02-11 01:39:33 -05:00 @@ -198,6 +198,10 @@ #define YMFPCI_LEGACY2_IMOD(1 15) /* legacy IRQ mode */ /* SIEN:IMOD 0:0 = legacy irq, 0:1 = INTA, 1:0 = serialized IRQ */ +#if defined(CONFIG_GAMEPORT) || (defined(MODULE) defined(CONFIG_GAMEPORT_MODULE)) +#define SUPPORT_JOYSTICK +#endif + /* * */ @@ -311,9 +315,8 @@ struct resource *mpu_res; unsigned short old_legacy_ctrl; -#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) - struct resource *joystick_res; - struct gameport gameport; +#ifdef SUPPORT_JOYSTICK + struct gameport *gameport; #endif struct snd_dma_buffer work_ptr; @@ -381,6 +384,7 @@ struct pci_dev *pci, unsigned short old_legacy_ctrl, ymfpci_t ** rcodec); +void snd_ymfpci_free_gameport(ymfpci_t *chip); int snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t **rpcm); int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm); @@ -388,9 +392,5 @@ int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm); int snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch); int snd_ymfpci_timer(ymfpci_t *chip, int device); - -#if defined(CONFIG_GAMEPORT) || (defined(MODULE) defined(CONFIG_GAMEPORT_MODULE)) -#define SUPPORT_JOYSTICK -#endif #endif /* __SOUND_YMFPCI_H */ diff -Nru a/sound/pci/als4000.c b/sound/pci/als4000.c --- a/sound/pci/als4000.c 2005-02-11 01:39:34 -05:00 +++ b/sound/pci/als4000.c 2005-02-11 01:39:34 -05:00 @@ -104,8 +104,7 @@ struct pci_dev *pci; unsigned long gcr; #ifdef SUPPORT_JOYSTICK - struct gameport gameport; - struct resource *res_joystick; + struct gameport *gameport; #endif
[PATCH 8/10] Gameport: add gameport sysfs bus, add drivers
=== [EMAIL PROTECTED], 2005-02-11 01:21:02-05:00, [EMAIL PROTECTED] Input: integrate gameport drivers info dribver model/sysfs, create gameport bus. drivers' connect() routines now return error code instead of void. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/Makefile|2 drivers/input/gameport/gameport.c | 39 ++ drivers/input/joystick/a3d.c| 44 ++--- drivers/input/joystick/adi.c| 63 ++ drivers/input/joystick/analog.c | 52 +++- drivers/input/joystick/cobra.c | 42 drivers/input/joystick/gf2k.c | 42 +--- drivers/input/joystick/grip.c | 61 + drivers/input/joystick/grip_mp.c| 56 +- drivers/input/joystick/guillemot.c | 53 ++--- drivers/input/joystick/interact.c | 32 +++ drivers/input/joystick/joydump.c| 20 ++--- drivers/input/joystick/sidewinder.c | 75 +--- drivers/input/joystick/tmdc.c | 53 + include/linux/gameport.h|6 +- 15 files changed, 407 insertions(+), 233 deletions(-) === diff -Nru a/drivers/Makefile b/drivers/Makefile --- a/drivers/Makefile 2005-02-11 01:40:01 -05:00 +++ b/drivers/Makefile 2005-02-11 01:40:01 -05:00 @@ -47,8 +47,8 @@ obj-$(CONFIG_TC) += tc/ obj-$(CONFIG_USB) += usb/ obj-$(CONFIG_USB_GADGET) += usb/gadget/ -obj-$(CONFIG_INPUT)+= input/ obj-$(CONFIG_GAMEPORT) += input/gameport/ +obj-$(CONFIG_INPUT)+= input/ obj-$(CONFIG_I2O) += message/ obj-$(CONFIG_I2C) += i2c/ obj-$(CONFIG_W1) += w1/ diff -Nru a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c --- a/drivers/input/gameport/gameport.c 2005-02-11 01:40:01 -05:00 +++ b/drivers/input/gameport/gameport.c 2005-02-11 01:40:01 -05:00 @@ -37,6 +37,10 @@ static LIST_HEAD(gameport_list); static LIST_HEAD(gameport_driver_list); +static struct bus_type gameport_bus = { + .name = gameport, +}; + #ifdef __i386__ #define DELTA(x,y) ((y)-(x)+((y)(x)?1193182/HZ:0)) @@ -146,6 +150,21 @@ gameport_find_driver(gameport); } +/* + * Gameport driver operations + */ + +static ssize_t gameport_driver_show_description(struct device_driver *drv, char *buf) +{ + struct gameport_driver *driver = to_gameport_driver(drv); + return sprintf(buf, %s\n, driver-description ? driver-description : (none)); +} + +static struct driver_attribute gameport_driver_attrs[] = { + __ATTR(description, S_IRUGO, gameport_driver_show_description, NULL), + __ATTR_NULL +}; + void gameport_unregister_port(struct gameport *gameport) { list_del_init(gameport-node); @@ -159,6 +178,9 @@ { struct gameport *gameport; + drv-driver.bus = gameport_bus; + driver_register(drv-driver); + list_add_tail(drv-node, gameport_driver_list); list_for_each_entry(gameport, gameport_list, node) if (!gameport-drv) @@ -175,6 +197,7 @@ drv-disconnect(gameport); gameport_find_driver(gameport); } + driver_unregister(drv-driver); } int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode) @@ -201,3 +224,19 @@ if (gameport-close) gameport-close(gameport); } + +static int __init gameport_init(void) +{ + gameport_bus.drv_attrs = gameport_driver_attrs; + bus_register(gameport_bus); + + return 0; +} + +static void __exit gameport_exit(void) +{ + bus_unregister(gameport_bus); +} + +module_init(gameport_init); +module_exit(gameport_exit); diff -Nru a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c --- a/drivers/input/joystick/a3d.c 2005-02-11 01:40:01 -05:00 +++ b/drivers/input/joystick/a3d.c 2005-02-11 01:40:01 -05:00 @@ -35,8 +35,10 @@ #include linux/gameport.h #include linux/input.h +#define DRIVER_DESCFP-Gaming Assasin 3D joystick driver + MODULE_AUTHOR(Vojtech Pavlik [EMAIL PROTECTED]); -MODULE_DESCRIPTION(FP-Gaming Assasin 3D joystick driver); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE(GPL); #define A3D_MAX_START 400 /* 400 us */ @@ -108,7 +110,9 @@ static int a3d_csum(char *data, int count) { int i, csum = 0; - for (i = 0; i count - 2; i++) csum += data[i]; + + for (i = 0; i count - 2; i++) + csum += data[i]; return (csum 0x3f) != ((data[count - 2] 3) | data[count - 1]); } @@ -138,7 +142,7 @@ a3d-buttons = ((data[3] 3) | data[4]) 0xf
[PATCH 9/10] Gameport: complete sysfs integration
=== [EMAIL PROTECTED], 2005-02-11 01:21:32-05:00, [EMAIL PROTECTED] Input: complete gameport sysfs integration, ports are now devices in driver model. Implemented similarly to serio. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/gameport/gameport.c | 586 ++ include/linux/gameport.h | 64 ++-- 2 files changed, 579 insertions(+), 71 deletions(-) === diff -Nru a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c --- a/drivers/input/gameport/gameport.c 2005-02-11 01:40:19 -05:00 +++ b/drivers/input/gameport/gameport.c 2005-02-11 01:40:19 -05:00 @@ -2,6 +2,7 @@ * Generic gameport layer * * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 2005 Dmitry Torokhov */ /* @@ -10,22 +11,27 @@ * the Free Software Foundation. */ -#include asm/io.h +#include linux/stddef.h #include linux/module.h #include linux/ioport.h #include linux/init.h #include linux/gameport.h +#include linux/wait.h +#include linux/completion.h +#include linux/sched.h +#include linux/smp_lock.h #include linux/slab.h -#include linux/stddef.h #include linux/delay.h +/*#include asm/io.h*/ + MODULE_AUTHOR(Vojtech Pavlik [EMAIL PROTECTED]); MODULE_DESCRIPTION(Generic gameport layer); MODULE_LICENSE(GPL); -EXPORT_SYMBOL(gameport_register_port); +EXPORT_SYMBOL(__gameport_register_port); EXPORT_SYMBOL(gameport_unregister_port); -EXPORT_SYMBOL(gameport_register_driver); +EXPORT_SYMBOL(__gameport_register_driver); EXPORT_SYMBOL(gameport_unregister_driver); EXPORT_SYMBOL(gameport_open); EXPORT_SYMBOL(gameport_close); @@ -34,13 +40,23 @@ EXPORT_SYMBOL(gameport_set_name); EXPORT_SYMBOL(gameport_set_phys); +/* + * gameport_sem protects entire gameport subsystem and is taken + * every time gameport port or driver registrered or unregistered. + */ +static DECLARE_MUTEX(gameport_sem); + static LIST_HEAD(gameport_list); -static LIST_HEAD(gameport_driver_list); static struct bus_type gameport_bus = { .name = gameport, }; +static void gameport_add_port(struct gameport *gameport); +static void gameport_destroy_port(struct gameport *gameport); +static void gameport_reconnect_port(struct gameport *gameport); +static void gameport_disconnect_port(struct gameport *gameport); + #ifdef __i386__ #define DELTA(x,y) ((y)-(x)+((y)(x)?1193182/HZ:0)) @@ -106,21 +122,325 @@ #endif } + +/* + * Basic gameport - driver core mappings + */ + +static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv) +{ + down_write(gameport_bus.subsys.rwsem); + + gameport-dev.driver = drv-driver; + if (drv-connect(gameport, drv)) { + gameport-dev.driver = NULL; + goto out; + } + device_bind_driver(gameport-dev); +out: + up_write(gameport_bus.subsys.rwsem); +} + +static void gameport_release_driver(struct gameport *gameport) +{ + down_write(gameport_bus.subsys.rwsem); + device_release_driver(gameport-dev); + up_write(gameport_bus.subsys.rwsem); +} + static void gameport_find_driver(struct gameport *gameport) { -struct gameport_driver *drv; + down_write(gameport_bus.subsys.rwsem); + device_attach(gameport-dev); + up_write(gameport_bus.subsys.rwsem); +} + + +/* + * Gameport event processing. + */ + +enum gameport_event_type { + GAMEPORT_RESCAN, + GAMEPORT_RECONNECT, + GAMEPORT_REGISTER_PORT, + GAMEPORT_REGISTER_DRIVER, +}; + +struct gameport_event { + enum gameport_event_type type; + void *object; + struct module *owner; + struct list_head node; +}; + +static DEFINE_SPINLOCK(gameport_event_lock); /* protects gameport_event_list */ +static LIST_HEAD(gameport_event_list); +static DECLARE_WAIT_QUEUE_HEAD(gameport_wait); +static DECLARE_COMPLETION(gameport_exited); +static int gameport_pid; + +static void gameport_queue_event(void *object, struct module *owner, + enum gameport_event_type event_type) +{ + unsigned long flags; + struct gameport_event *event; + + spin_lock_irqsave(gameport_event_lock, flags); -list_for_each_entry(drv, gameport_driver_list, node) { - if (gameport-drv) + /* +* Scan event list for the other events for the same gameport port, +* starting with the most recent one. If event is the same we +* do not need add new one. If event is of different type we +* need to add this event and should not look further because +* we need to preseve sequence of distinct events. +*/ + list_for_each_entry_reverse(event, gameport_event_list, node) { + if (event-object == object) { + if (event-type == event_type
[PATCH 10/10] Gameport: replace -private with gameport_get/set_drvdata
=== [EMAIL PROTECTED], 2005-02-11 01:23:40-05:00, [EMAIL PROTECTED] Input: remove gameport-private in favor of using driver-specific data in device structure, add gameport_get/set_drvdata to access it. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/joystick/a3d.c| 10 ++ drivers/input/joystick/adi.c|7 --- drivers/input/joystick/analog.c |7 +-- drivers/input/joystick/cobra.c | 10 ++ drivers/input/joystick/gf2k.c | 10 ++ drivers/input/joystick/grip.c | 10 ++ drivers/input/joystick/grip_mp.c|9 ++--- drivers/input/joystick/guillemot.c |9 + drivers/input/joystick/interact.c | 10 ++ drivers/input/joystick/sidewinder.c | 10 ++ drivers/input/joystick/tmdc.c | 10 ++ include/linux/gameport.h| 15 ++- 12 files changed, 76 insertions(+), 41 deletions(-) === diff -Nru a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c --- a/drivers/input/joystick/a3d.c 2005-02-11 01:41:08 -05:00 +++ b/drivers/input/joystick/a3d.c 2005-02-11 01:41:08 -05:00 @@ -277,13 +277,13 @@ if (!(a3d = kcalloc(1, sizeof(struct a3d), GFP_KERNEL))) return -ENOMEM; - gameport-private = a3d; - a3d-gameport = gameport; init_timer(a3d-timer); a3d-timer.data = (long) a3d; a3d-timer.function = a3d_timer; + gameport_set_drvdata(gameport, a3d); + err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW); if (err) goto fail1; @@ -379,13 +379,14 @@ return 0; fail2: gameport_close(gameport); -fail1: kfree(a3d); +fail1: gameport_set_drvdata(gameport, NULL); + kfree(a3d); return err; } static void a3d_disconnect(struct gameport *gameport) { - struct a3d *a3d = gameport-private; + struct a3d *a3d = gameport_get_drvdata(gameport); input_unregister_device(a3d-dev); if (a3d-adc) { @@ -393,6 +394,7 @@ a3d-adc = NULL; } gameport_close(gameport); + gameport_set_drvdata(gameport, NULL); kfree(a3d); } diff -Nru a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c --- a/drivers/input/joystick/adi.c 2005-02-11 01:41:08 -05:00 +++ b/drivers/input/joystick/adi.c 2005-02-11 01:41:08 -05:00 @@ -474,13 +474,13 @@ if (!(port = kcalloc(1, sizeof(struct adi_port), GFP_KERNEL))) return -ENOMEM; - gameport-private = port; - port-gameport = gameport; init_timer(port-timer); port-timer.data = (long) port; port-timer.function = adi_timer; + gameport_set_drvdata(gameport, port); + err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW); if (err) { kfree(port); @@ -524,12 +524,13 @@ static void adi_disconnect(struct gameport *gameport) { int i; - struct adi_port *port = gameport-private; + struct adi_port *port = gameport_get_drvdata(gameport); for (i = 0; i 2; i++) if (port-adi[i].length 0) input_unregister_device(port-adi[i].dev); gameport_close(gameport); + gameport_set_drvdata(gameport, NULL); kfree(port); } diff -Nru a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c --- a/drivers/input/joystick/analog.c 2005-02-11 01:41:08 -05:00 +++ b/drivers/input/joystick/analog.c 2005-02-11 01:41:08 -05:00 @@ -593,12 +593,13 @@ { int i, t, u, v; - gameport-private = port; port-gameport = gameport; init_timer(port-timer); port-timer.data = (long) port; port-timer.function = analog_timer; + gameport_set_drvdata(gameport, port); + if (!gameport_open(gameport, drv, GAMEPORT_MODE_RAW)) { analog_calibrate_timer(port); @@ -672,6 +673,7 @@ err = analog_init_masks(port); if (err) { gameport_close(gameport); + gameport_set_drvdata(gameport, NULL); kfree(port); return err; } @@ -686,12 +688,13 @@ static void analog_disconnect(struct gameport *gameport) { int i; - struct analog_port *port = gameport-private; + struct analog_port *port = gameport_get_drvdata(gameport); for (i = 0; i 2; i++) if (port-analog[i].mask) input_unregister_device(port-analog[i].dev); gameport_close(gameport); + gameport_set_drvdata(gameport, NULL); printk(KERN_INFO analog.c: %d out of %d reads (%d%%) on %s failed\n, port-bads, port-reads, port-reads ? (port-bads * 100 / port-reads) : 0, port-gameport-phys); diff -Nru
Re: [rfc/rft] Fujitsu B-Series Lifebook PS/2 TouchScreen driver
On Saturday 12 February 2005 12:01, Kenan Esau wrote: Second thing is that I am not shure that it is a good idea to integrate the lbtouch-support into the psmouse-driver since there is no real way of deciding if the device you are talking to is REALLY a lifebook-touchsreen or not. I think Arjan's idea about using DMI could be very effective for this particular touchscreen. I also don't think that it is useful to have two devices for the touchscreen. I assume you want to have one device for relative movements and one for the absolute ones!? But for the implementor in userspace (X, SDL,...) it will be easier if ALL events from this HW-device come via one device-node. Why? These are separate, one might want to disable touchscreen and keep quick-point or other way around. I think my driver works and is clean enough for integration into the kernel. We can talk about integrating calls to libps2 instead of doing the stuff myself (I am a big fan of preventing code-duplication) but don't you think it would be more wise to use a driver which works (since the very early 2.6-days) and build upon that instead of trying to implement your own one from the scratch and using snippets from very old and obsolete code? We need to get it integrated right away I think. There just too much stuff in psmouse that shoudl be used (rate and resolution exported through sysfs, timeout and resend handling, etc.) Plus, in your current driver: - MODULE_PARM is obsolete - data_lock spinlock is either unneeded or may cause deadlocks since it is used in interrupt handler and the other places that are using it do not disable interrupts - it is not necessary to suppress duplicate button events in the driver as the driver core will do that for you and it will make interrupt handler almost the same as Vojtech's. Btw, I don't think his handler has a problem - I would expect touchscreen to send anoter packet when finger leaves its surface so untouch will not be lost. - using interruptible_sleep_on for delays is somewhat inelegant I think. - it needs some changes to compile with the latest version of serio. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.9 2.6.10 unresponsive to keyboard upon bootup
On Saturday 12 February 2005 12:50, Roey Katz wrote: Hello again Dmitry, is there anything new about this issue? any fixes in the kernel? If you want, I can continue doing the test/debug cycle as before. Hi Roey, I have been looking over your logs one more time and it looks like there is a small change in i8042 init sequence that I have overlooked before. Could you please tell me if booting with i8042.nomux option helps your keyboard? Thanks! -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2.6.11-rc3] IBM Trackpoint support
On Sunday 13 February 2005 14:13, Stephen Evanchik wrote: On Thu, 3 Feb 2005 22:52:44 -0500, Dmitry Torokhov [EMAIL PROTECTED] wrote: OK, I have read the code once again, and saw that you have special handling within PS/2 protocol based on model constant. Please set psmouse type to PSMOUSE_TRACKPOINT instead of model and provide full protocol handler, like ALPS, Synaptics and Logitech do. Trackpoint is different and complex enough to warrant it. I'm not sure that I think a protocol handler is necessary unless I am misunderstanding what you mean. The TrackPoint is nothing more than a PS/2 mouse with 2 or 3 buttons that responds to an additional set of commands. The extra handling has to do with middle-to-scroll which could be done in userspace. If middle-to-scroll is movd to userspace and there is no trackpoint- specific handling added to the normal psmouse handler then we don't need a new handler of course. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: PATCH 2.6.11-rc4]: IBM TrackPoint configuration support
On Sunday 13 February 2005 19:32, Stephen Evanchik wrote: Here is the latest IBM TrackPoint patch. I believe I made all of the necessary changes in this release including the removal of the middle-to-scroll functionality. One item I didn't address was a comment about checking the return code of ps2_command .. I looked at other usages and it wasn't clear to me how to actually implement something that is sane. In some places an error causes a return out of the function and in others the return value is ignored. Should I check each return value or the first ? I would check all 3 ps2_command calls in trackpoint_init and leave the rest as is. One more thing - I'd like to see more descriptive names of sysfs attributes, for example I'd change ptson to press_to_select, mb to middle_btn, etc. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH][RFC]: Clean up resource allocation in i8042 driver
On Monday 14 February 2005 11:32, Prarit Bhargava wrote: I didn't see a final ACK on this patch -- just checking for one :) P. I see that resource allocation part is in Vojtech's tree now but the part changing timeout message was dropped. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RCF/RFT] Fix race timer race in gameport-based joystick drivers
Hi, There seems to be a race WRT to timer handling in all gameport-based joystick drivers. open() and close() methods are used to start and stop polling timers on demand but counter and the timer itself is not protected in any way so if several clients will try to open/close corresponding input device node they could up with timer not running at all or running while nobody has the node open. Plus it is possible that disconnect will run and free driver structure while timer is running on other CPU. I have moved timer and counter down into gameport structure (I think it is ok because on the one hand joysticks are the only users of gameport and on the other hand polling timer can be useful to other clients if ever writen), and added helper functions to manipulate it: - gameport_start_polling(gameport) - gameport_stop_polling(gameport) - gameport_set_poll_handler(gameoirt, handler) - gameport_set_poll_interval(gameport, msecs) gameport_{start|stop}_poll handler are using spinlock to guarantee that timer updated properly. Also, gameport_close deletes (synchronously) timer to make sure there is no surprises since gameport_stop_poling does del_timer and thus may leave timer scheduled. Timer routine also checks the counter and does not restart it if there are no users. Please let me know what you think. -- Dmitry === Input: fix race timer handling races in gameport-based joystick drivers by moving pollig timer down into gameport and using spinlock to protect it. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/gameport/gameport.c | 42 - drivers/input/joystick/a3d.c | 38 ++--- drivers/input/joystick/adi.c | 25 +- drivers/input/joystick/analog.c| 25 -- drivers/input/joystick/cobra.c | 28 ++-- drivers/input/joystick/gf2k.c | 30 +++--- drivers/input/joystick/grip.c | 24 +++-- drivers/input/joystick/grip_mp.c | 30 ++ drivers/input/joystick/guillemot.c | 23 +++- drivers/input/joystick/interact.c | 24 +++-- drivers/input/joystick/tmdc.c | 25 -- include/linux/gameport.h | 19 12 files changed, 165 insertions(+), 168 deletions(-) Index: dtor/drivers/input/joystick/guillemot.c === --- dtor.orig/drivers/input/joystick/guillemot.c +++ dtor/drivers/input/joystick/guillemot.c @@ -45,7 +45,6 @@ MODULE_LICENSE(GPL); #define GUILLEMOT_MAX_START600 /* 600 us */ #define GUILLEMOT_MAX_STROBE 60 /* 60 us */ #define GUILLEMOT_MAX_LENGTH 17 /* 17 bytes */ -#define GUILLEMOT_REFRESH_TIME HZ/50 /* 20 ms */ static short guillemot_abs_pad[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, -1 }; @@ -69,8 +68,6 @@ struct guillemot_type { struct guillemot { struct gameport *gameport; struct input_dev dev; - struct timer_list timer; - int used; int bads; int reads; struct guillemot_type *type; @@ -120,12 +117,12 @@ static int guillemot_read_packet(struct } /* - * guillemot_timer() reads and analyzes Guillemot joystick data. + * guillemot_poll() reads and analyzes Guillemot joystick data. */ -static void guillemot_timer(unsigned long private) +static void guillemot_poll(struct gameport *gameport) { - struct guillemot *guillemot = (struct guillemot *) private; + struct guillemot *guillemot = gameport_get_drvdata(gameport); struct input_dev *dev = guillemot-dev; u8 data[GUILLEMOT_MAX_LENGTH]; int i; @@ -150,8 +147,6 @@ static void guillemot_timer(unsigned lon } input_sync(dev); - - mod_timer(guillemot-timer, jiffies + GUILLEMOT_REFRESH_TIME); } /* @@ -162,8 +157,7 @@ static int guillemot_open(struct input_d { struct guillemot *guillemot = dev-private; - if (!guillemot-used++) - mod_timer(guillemot-timer, jiffies + GUILLEMOT_REFRESH_TIME); + gameport_start_polling(guillemot-gameport); return 0; } @@ -175,8 +169,7 @@ static void guillemot_close(struct input { struct guillemot *guillemot = dev-private; - if (!--guillemot-used) - del_timer(guillemot-timer); + gameport_stop_polling(guillemot-gameport); } /* @@ -194,9 +187,6 @@ static int guillemot_connect(struct game return -ENOMEM; guillemot-gameport = gameport; - init_timer(guillemot-timer); - guillemot-timer.data = (long) guillemot; - guillemot-timer.function = guillemot_timer; gameport_set_drvdata(gameport, guillemot); @@ -222,6 +212,9 @@ static int guillemot_connect
Re: [rfc/rft] Fujitsu B-Series Lifebook PS/2 TouchScreen driver
On Tue, 15 Feb 2005 14:43:08 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Tue, Feb 15, 2005 at 09:57:59AM +0100, Kenan Esau wrote: +static struct dmi_system_id lifebook_dmi_table[] = { + { + .ident = Fujitsu Siemens Lifebook B-Sereis, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, LIFEBOOK B Series), + }, + }, + { } +}; This might be a bit too much generic. Are you sure there are no B Series lifebooks without a touchscreen? And another concern: does this notebook (or others using this touchscreen) have an active MUX? We don't want to force LBTOUCH protocol on an external mouse. +static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_regs *regs) +{ + unsigned char *packet = psmouse-packet; + struct input_dev *dev = psmouse-dev; + +unsigned long x = 0; +unsigned long y = 0; +static uint8_t pkt_lst_touch = 0; + static uint8_t pkt_cur_touch = 0; + uint8_t pkt_lb = packet[0] LBTOUCH_LB; + uint8_t pkt_rb = packet[0] LBTOUCH_RB; We usually don't use userspace types here. unsigned char or u8 for kernel. + +psmouse-protocol_handler = lifebook_process_byte; +psmouse-disconnect = lifebook_disconnect; +psmouse-reconnect = lifebook_initialize; +psmouse-initialize = lifebook_initialize; +psmouse-pktsize = 3; + } + + return 0; +} The change to the psmouse interface I'm leaving to Dmitry to comment on. I don't think that we need a separate initialize handler simply because it is called just once, at initialization time. Here we know exactly what device (protocol) we are dealing with, no need for indirection. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RCF/RFT] Fix race timer race in gameport-based joystick drivers
On Tue, 15 Feb 2005 15:05:01 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Tue, Feb 15, 2005 at 12:42:31AM -0500, Dmitry Torokhov wrote: Hi, There seems to be a race WRT to timer handling in all gameport-based joystick drivers. open() and close() methods are used to start and stop polling timers on demand but counter and the timer itself is not protected in any way so if several clients will try to open/close corresponding input device node they could up with timer not running at all or running while nobody has the node open. Plus it is possible that disconnect will run and free driver structure while timer is running on other CPU. I have moved timer and counter down into gameport structure (I think it is ok because on the one hand joysticks are the only users of gameport and on the other hand polling timer can be useful to other clients if ever writen), and added helper functions to manipulate it: - gameport_start_polling(gameport) - gameport_stop_polling(gameport) - gameport_set_poll_handler(gameoirt, handler) - gameport_set_poll_interval(gameport, msecs) gameport_{start|stop}_poll handler are using spinlock to guarantee that timer updated properly. Also, gameport_close deletes (synchronously) timer to make sure there is no surprises since gameport_stop_poling does del_timer and thus may leave timer scheduled. Timer routine also checks the counter and does not restart it if there are no users. Please let me know what you think. I'm not really sure if I really want to move the polling into the gameport layer. It's useful, but without it, gameport is considered strictly a passive device which can't generate callbacks (other than open/close/connect/disconnect). The new polling interface isn't much simpler than what Linux timers offer, only it provides additional locking. Yes, that was the goal. I looked over the drivers and it was either writing the exactly same code 10 times or moving it down. Probably protecting open/close calls in gameport.c with a spinlock would allow to work without explicit locking in the drivers. Hmm, you got me a bit confused here - open and close in gameport are already (indirectly) serialized with gameport_sem. It is input device open and close in joystick drivers that needs treatment - these are initiated from userspace and weren't hitting gameport code at all. And they need to be protected otherwise the counter and timer will get out of whack. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [rfc/rft] Fujitsu B-Series Lifebook PS/2 TouchScreen driver
On Tue, 15 Feb 2005 18:03:28 +0100, Kenan Esau [EMAIL PROTECTED] wrote: Am Dienstag, den 15.02.2005, 09:43 -0500 schrieb Dmitry Torokhov: On Tue, 15 Feb 2005 14:43:08 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Tue, Feb 15, 2005 at 09:57:59AM +0100, Kenan Esau wrote: +static struct dmi_system_id lifebook_dmi_table[] = { + { + .ident = Fujitsu Siemens Lifebook B-Sereis, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, LIFEBOOK B Series), + }, + }, + { } +}; This might be a bit too much generic. Are you sure there are no B Series lifebooks without a touchscreen? And another concern: does this notebook (or others using this touchscreen) have an active MUX? We don't want to force LBTOUCH protocol on an external mouse. All B-Series Lifebooks have the same touchscreen-hardware. But Dmitri's concern is correct -- at the moment I would enforce the LBTOUCH-protocol on external mice... I have to fix this. I will additionally to the DMI stuff use Status Request. On a Request ID-Command the Device always answers with a 0x00 -- could this also be helpfull? +static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_regs *regs) +{ + unsigned char *packet = psmouse-packet; + struct input_dev *dev = psmouse-dev; + +unsigned long x = 0; +unsigned long y = 0; +static uint8_t pkt_lst_touch = 0; + static uint8_t pkt_cur_touch = 0; + uint8_t pkt_lb = packet[0] LBTOUCH_LB; + uint8_t pkt_rb = packet[0] LBTOUCH_RB; We usually don't use userspace types here. unsigned char or u8 for kernel. + +psmouse-protocol_handler = lifebook_process_byte; +psmouse-disconnect = lifebook_disconnect; +psmouse-reconnect = lifebook_initialize; +psmouse-initialize = lifebook_initialize; +psmouse-pktsize = 3; + } + + return 0; +} The change to the psmouse interface I'm leaving to Dmitry to comment on. I don't think that we need a separate initialize handler simply because it is called just once, at initialization time. Here we know exactly what device (protocol) we are dealing with, no need for indirection. I introduced the new initialize-handler since psmouse-initialize() is also used in psmouse-base.c. This is to prevent putting if-statements on each place where the initialization-function for a certain protocol is called in psmouse-base.c. It would be good idea if protocols were initialized in many difefrent places, but the all are called from one place - psmouse_extensions. Some protocols that can be detected without changing hardware state have 2 functions - detect and init and the others have ony detect which does initialization as well. But they all are called from the same place. psmouse_initialize has somewhat confising name, it is not initialize protocol, it is enable streaming and initialize common parameters, such as rate and resolution. Plus I think it is too late to do protocol init in psmouse_initialize as this will not allow falling back to lesser protocols if higher prtocol initialization fails. I admit since I am also using a different reconnect-function than psmouse-base it's not such a huge benefit but think of a new protocol/device which uses the same reconnect-function as psmouse-base but a different init-function. I am not sure what difference does it make - if there is no reconnect hamdler psmosue will end up calling psmouse_extensions which will re-initialize hardware with proper function for the protocol. It still does not require a handler in psmouse structure. My goal was to have no dependency from psmouse-base to the lifebook-handling (none but lifebook_detect()). Thus the indirection is IMHO needed. You can hide all of it right in lifebook_detect or acknowledge that you have 2 fucntions and call them from psmouse-base, like synaptics and alps do. I don't think it exposes lbtouch internals too much. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] add bus symlink to class/block devices
On Tue, 15 Feb 2005 23:04:06 +0100, Kay Sievers [EMAIL PROTECTED] wrote: -static int class_device_dev_link(struct class_device * class_dev) -{ - if (class_dev-dev) - return sysfs_create_link(class_dev-kobj, -class_dev-dev-kobj, device); - return 0; -} - -static void class_device_dev_unlink(struct class_device * class_dev) -{ - sysfs_remove_link(class_dev-kobj, device); -} - Hi, I can agree on dropping driver link but I think that the link to underlying real device is still needed. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] add bus symlink to class/block devices
On Tuesday 15 February 2005 18:44, Greg KH wrote: On Tue, Feb 15, 2005 at 05:25:54PM -0500, Dmitry Torokhov wrote: On Tue, 15 Feb 2005 23:04:06 +0100, Kay Sievers [EMAIL PROTECTED] wrote: -static int class_device_dev_link(struct class_device * class_dev) -{ - if (class_dev-dev) - return sysfs_create_link(class_dev-kobj, -class_dev-dev-kobj, device); - return 0; -} - -static void class_device_dev_unlink(struct class_device * class_dev) -{ - sysfs_remove_link(class_dev-kobj, device); -} - Hi, I can agree on dropping driver link but I think that the link to underlying real device is still needed. It's still there, read the patch :) Oops, missed that. Sorry. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: PATCH 2.6.11-rc4]: IBM TrackPoint configuration support
Hi, sorry, couple of more things (and I promise I will shut up ;)) /* + * Try to initialize the IBM TrackPoint + */ + if (max_proto PSMOUSE_PS2 trackpoint_init(psmouse) == 0) { + psmouse-vendor = IBM; + psmouse-name = TrackPoint; + + return PSMOUSE_PS2; + } I would like you to change the code so that psmouse structure only changed when set_properties is set. Probably moving these into trackpoint_init is a good idea since _init should not override psmouse-private unless told to do so. It is important when the device was not identified as a trackpoint but later (let's say after resume) it is - in this case generic reconnect will cause psmouse_extensions with set_properties = 0 to verify protocol and we dont' want to change anything in psmouse to give the original disconnect handler change to clean up properly. Thinking about it some more I am pretty sure that you need a special protocol number for the trackpoint, because protocol number is used by psmouse_reconnect to check whether reconnect can be done or rescan is needed. You can reuse the standard protocol handler, but you need the new number. This way if trackpad was not identified as such first time around, but is identified on reconnect psmouse-base would notice that it is a new type of device and schedule reconnect and will proper cleanup/initialization. Does this make sense? + +#define MAKE_ATTR_WRITE(_item, command) \ +static ssize_t psmouse_attr_set_##_item(struct psmouse *psmouse, const char *buf, size_t count) \ It looks like the patch got mangled on it's way, please check your mail client. +{ \ + char *rest; \ +unsigned long value; \ +struct trackpoint_data *tp = psmouse-private; \ +value = simple_strtoul(buf, rest, 10); \ Whitespace damage (tabs vs. spaces). Also there are some trailing whitespace. If you are using vi I find the following helpful to highlight the problem spots: set listchars=tab:\|- highlight WhitespaceEOL ctermbg=red guibg=red match WhitespaceEOL /\s\+$/ -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RCF/RFT] Fix race timer race in gameport-based joystick drivers
Somehow missed sidewinder driver... == Input: fix timer handling race in sidewinder joystick driver by switching to gameport's polling facilities. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] = drivers/input/joystick/sidewinder.c 1.19 vs edited = --- 1.19/drivers/input/joystick/sidewinder.c2005-02-10 19:00:00 -05:00 +++ edited/drivers/input/joystick/sidewinder.c 2005-02-14 21:36:26 -05:00 @@ -58,7 +58,6 @@ #define SW_BAD 2 /* Number of packet read errors to switch off 3d Pro optimization */ #define SW_OK 64 /* Number of packet read successes to switch optimization back on */ #define SW_LENGTH 512 /* Max number of bits in a packet */ -#define SW_REFRESH HZ/50 /* Time to wait between updates of joystick data [20 ms] */ #ifdef SW_DEBUG #define dbg(format, arg...) printk(KERN_DEBUG __FILE__ : format \n , ## arg) @@ -115,7 +114,6 @@ struct sw { struct gameport *gameport; - struct timer_list timer; struct input_dev dev[4]; char name[64]; char phys[4][32]; @@ -127,7 +125,6 @@ int ok; int reads; int bads; - int used; }; /* @@ -496,22 +493,20 @@ return -1; } -static void sw_timer(unsigned long private) +static void sw_poll(struct gameport *gameport) { - struct sw *sw = (void *) private; + struct sw *sw = gameport_get_drvdata(gameport); sw-reads++; if (sw_read(sw)) sw-bads++; - mod_timer(sw-timer, jiffies + SW_REFRESH); } static int sw_open(struct input_dev *dev) { struct sw *sw = dev-private; - if (!sw-used++) - mod_timer(sw-timer, jiffies + SW_REFRESH); + gameport_start_polling(sw-gameport); return 0; } @@ -519,8 +514,7 @@ { struct sw *sw = dev-private; - if (!--sw-used) - del_timer(sw-timer); + gameport_stop_polling(sw-gameport); } /* @@ -606,9 +600,6 @@ } sw-gameport = gameport; - init_timer(sw-timer); - sw-timer.data = (long) sw; - sw-timer.function = sw_timer; gameport_set_drvdata(gameport, sw); @@ -725,6 +716,9 @@ sw_print_packet(ID, j * 3, idbuf, 3); sw_print_packet(Data, i * m, buf, m); #endif + + gameport_set_poll_handler(gameport, sw_poll); + gameport_set_poll_interval(gameport, 20); k = i; l = j; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Swsusp, resume and kernel versions
Pavel, First of all I must say that swsusp has progressed alot and now works very reliably, at least for my configuration, and I use it a lot. Great job! But I think there is one pretty severe issue present - even if swsusp is not enabled kernel should check if there is an image in swap and erase it. Today I has somewhat unpleasant experience - after suspending I accidentially loaded a vendor kernel. I was in hurry and decided that resume just failed for some reason so I did couple of things and left the box running. In the evening I realized that I am running vendor kernel and decided to reboot into my devel. version. What I did not expect is for the kernel to find a valid suspend image and restore it. As you might imagine messed up my disk somewhat. Any chance this can be done? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Swsusp, resume and kernel versions
Hi Nigel, On Thursday 17 February 2005 00:15, Nigel Cunningham wrote: Hi Dmitry. On Thu, 2005-02-17 at 15:46, Dmitry Torokhov wrote: Pavel, First of all I must say that swsusp has progressed alot and now works very reliably, at least for my configuration, and I use it a lot. Great job! But I think there is one pretty severe issue present - even if swsusp is not enabled kernel should check if there is an image in swap and erase it. Today I has somewhat unpleasant experience - after suspending I accidentially loaded a vendor kernel. I was in hurry and decided that resume just failed for some reason so I did couple of things and left the box running. In the evening I realized that I am running vendor kernel and decided to reboot into my devel. version. What I did not expect is for the kernel to find a valid suspend image and restore it. As you might imagine messed up my disk somewhat. Any chance this can be done? One of my suspend2 users had the same thing yesterday. Unfortunately there's no easy way for us to detect that another kernel has been booted. What do you mean? I thought it already compares signatures of the booting kernel and suspend image. Just wipe it out if it does not match, or, even better, just stop if signature does not match unless one boots with nosuspend. This way even if I start booting wrong image I have a chance to select right one and avoid fsck. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.11-rc4: touch pad misidentified (ALPS instead of ImPS/2)
On Thu, 17 Feb 2005 13:37:55 +0100, Michael Brade [EMAIL PROTECTED] wrote: Hi, the new 2.6.11-rc series has another problem for me, my touchpad (Toshiba Laptop) stopped working. I guess this has to do with [PATCH] ALPS touchpad detection fix that was posted about 4 weeks ago. The kernel says while booting: newton kernel: mice: PS/2 mouse device common for all mice newton kernel: input: AT Translated Set 2 keyboard on isa0060/serio0 newton kernel: ALPS Touchpad (Glidepoint) detected newton kernel: Disabling hardware tapping newton kernel: input: AlpsPS/2 ALPS TouchPad on isa0060/serio1 and when I try to use it, the following is spit out: last message repeated 2 times kernel: psmouse.c: TouchPad at isa0060/serio1/input0 - driver resynched. kernel: psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1 last message repeated 2 times kernel: psmouse.c: TouchPad at isa0060/serio1/input0 - driver resynched. kernel: psmouse.c: TouchPad at isa0060/serio1/input0 lost sync at byte 1 Hi, Could you please boot with i8042.debug log_buf_len=131072 boot option, work touchpad a bit and send me your full dmesg (or /var/log/messages), please? I the meantime to get your touchpad working (after you send me the dmesg) add psmouse.proto=exps to your boot options (or add options psmouse proto=exps if psmouse is compiled as a module). -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Swsusp, resume and kernel versions
On Thu, 17 Feb 2005 11:28:47 -0500, John M Flinchbaugh [EMAIL PROTECTED] wrote: On Thu, Feb 17, 2005 at 12:07:31PM +0100, Pavel Machek wrote: When all the vendor's kernels have swsusp, it will magically kill the signature. Or stick mkswap /dev/XXX in your init scripts. This is what I've done in some instances. There should be no harm in sticking that mkswap into your init scripts right before the swapon -a, and then you have a nice userspace solution. It's safe to reinitialize swap on any clean boot. A resume will not get into the init scripts. Just remember you're doing the mkswap if you decide to rearrange your partitions at all, or code a script smart enough to grep your swap partitions out of your fstab. It could be a workaround. Still it will cause loss of unsaved work if I happen to load wrong kernel. Given that the code checking for swsusp image can be marked __init I don't understand the reasons gainst doing it. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Swsusp, resume and kernel versions
On Thu, 17 Feb 2005 20:56:52 +0100, Pavel Machek [EMAIL PROTECTED] wrote: Hi! Just remember you're doing the mkswap if you decide to rearrange your partitions at all, or code a script smart enough to grep your swap partitions out of your fstab. It could be a workaround. Still it will cause loss of unsaved work if I happen to load wrong kernel. Given that the code checking for swsusp image can be marked __init I don't understand the reasons gainst doing it. How do you know which partitions to check? swsusp gets it from resume= parameter, but if you do not have it compiled, you probably have wrong cmdline, too. Ok, that makes sense. I guess I should just stop pulling vendor kernels with the rest of updates since I am not using them anyway. Sorry for the noise. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6: drivers/input/power.c is never built
On Fri, 18 Feb 2005 14:26:51 +0100, Pavel Machek [EMAIL PROTECTED] wrote: Hi! CONFIG_INPUT_POWER was enabled - but it is nowhere possible to enable this option. That was written a long time ago before the new power management went in. On PDA's there is a power button and suspend button. So this was a hook so that the input layer could detect the power/suspend button being presses and then power down or turn off the device. Now that the new power management is in what should we do? Change power.c to generate power events like ACPI does, most likely. There was some recent discussion of this on linux-input. It was basically agreed that the input system should pass the request on to ACPI and/or apm and Dmitry Torokhov (cc'd) proposed a patch that did this. His patch needed to be slightly modified to work with arm apm, the final result being: http://www.rpsys.net/openzaurus/2.6.11-rc4/input_power-r1.patch I can confirm this works well on arm with apm enabled. It has quite a lot of #ifdefs for CONFIG_APM/CONFIG_ARM/CONFIG_ACPI, Yes, power.c is an aggregator that transports power events from the input system into whatever power scheme is in use, so there will always be a lot of ifdefs unless we will invent grand unified power interface with userspace. I wonder if we could use kevents. and it will not work on i386/APM, anyway. We could add fix i386 APM case but it looks like most people are concentrating on ACPI. I still believe right solution is to add input interface to ACPI. /proc/acpi/events needs to die, being replaced by input subsystem. There are many more events from ACPI that are not related to input, so we need to keep it. Still, I can see buttons converted to input devices which bind to power.c and then transmit requests to acpid through /acpi/proc/event. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6: drivers/input/power.c is never built
On Fri, 18 Feb 2005 18:00:36 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Fri, Feb 18, 2005 at 05:01:53PM +0100, Pavel Machek wrote: It has quite a lot of #ifdefs for CONFIG_APM/CONFIG_ARM/CONFIG_ACPI, and it will not work on i386/APM, anyway. I still believe right solution is to add input interface to ACPI. /proc/acpi/events needs to die, being replaced by input subsystem. But aren't there power events (battery low, etc) which are not input events? Yes, there are. They can probably stay... Or we can get battery low key. We even have an event class for that, EV_PWR in the input subsystem. I really really think this is wrong. Power management should be possible without input layer. EV_PWR is fine for telling input devices to do something, like enter lower power mode and for sending _some_ requests to the PM system. But input layer shoudl not be used as a generic transport. I mean battery low, docking requests, etc has nothing to do with input. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6: drivers/input/power.c is never built
On Fri, 18 Feb 2005 19:39:36 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Fri, Feb 18, 2005 at 01:19:08PM -0500, Dmitry Torokhov wrote: On Fri, 18 Feb 2005 18:00:36 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Fri, Feb 18, 2005 at 05:01:53PM +0100, Pavel Machek wrote: It has quite a lot of #ifdefs for CONFIG_APM/CONFIG_ARM/CONFIG_ACPI, and it will not work on i386/APM, anyway. I still believe right solution is to add input interface to ACPI. /proc/acpi/events needs to die, being replaced by input subsystem. But aren't there power events (battery low, etc) which are not input events? Yes, there are. They can probably stay... Or we can get battery low key. We even have an event class for that, EV_PWR in the input subsystem. I really really think this is wrong. Power management should be possible without input layer. EV_PWR is fine for telling input devices to do something, like enter lower power mode Definitely not for this. The request to go to low power mode should come from the other side - the bus the device lives on. Probably not. On the other hand input layer is kind of a hyper-transport allowing to send messages to several devices at one regardless of the bis they are reside on. and for sending _some_ requests to the PM system. I don't think input devices themselves should be sending any requests to the PM system at all, they should just pass the events to the userspace and have that decide what to do with it. Maybe a simple event handler like power.c for transforming key events to power change requests for embedded systems makes sense, but normally many more variables need to be taken into account, and thus userspace needs to decide. I never said it should go staringt into the core of ACPI and performing some action. That hack to power.c that I did was effectively sending message to acpid giving userspace a chance to make decision and react to the request. But input layer shoudl not be used as a generic transport. I mean battery low, docking requests, etc has nothing to do with input. Well, plugging in a power cord is a physical user action much like closing the lid is, much like pressing the power button is, much like pressing a key is. What about power dying and my UPS switing on? I think it is out of input layer, we need PM/system state messaging layer. It can be based on acpi events and acpid or maybe kevents (but I don't like the idea of needing kobjects for that). Still power.c seems like the good place to hide all the ugliness and glue between that new (or old) layer and input layer. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BK] upgrade will be needed
On Fri, 18 Feb 2005 13:34:23 -0500 (EST), Sean [EMAIL PROTECTED] wrote: On Fri, February 18, 2005 11:27 am, Theodore Ts'o said: If you truly believe that BK would be able to add the value that it does to the kernel development process by using some other SCM as the master SCM, with BK being underneath, as you proposed earlier, then you do not understand why BK is fundamentally better than the current open source SCM systems that are out there. BK already feeds patches out at the head, surely if it's as powerful as you think, it could feed a free SCM too for your non-bk friends in the community. What is bk2cvs gateway that is maintained by Larry then? Just call it your head that Linus feeds from his BK repository and you are all set. I can see that Roman and Stellian want something different, but we alerady have what you have just described. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BK] upgrade will be needed
On Fri, 18 Feb 2005 14:31:20 -0500 (EST), Sean [EMAIL PROTECTED] wrote: On Fri, February 18, 2005 2:26 pm, Dmitry Torokhov said: What is bk2cvs gateway that is maintained by Larry then? Just call it your head that Linus feeds from his BK repository and you are all set. I can see that Roman and Stellian want something different, but we alerady have what you have just described. Bitkeeper isn't motivated to raise the bar in terms of implementation, nor is cvs the best choice in terms of which free tool to use. You from cvs you can import into other SCM of your choise. Once a free SCM is actually used at the head, there are opportunities to implement updating too, not just pulling. Heh, you don't get to update the master repository even if you are using BK. And you are free to update your local tree with CVS/SVN/whatever. So I am not sure why you trying this argument. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [BK] upgrade will be needed
On Fri, 18 Feb 2005 23:18:19 +0100, Vojtech Pavlik [EMAIL PROTECTED] wrote: On Fri, Feb 18, 2005 at 09:34:47PM +, Anton Altaparmakov wrote: On Fri, 18 Feb 2005, David S. Miller wrote: On Fri, 18 Feb 2005 21:45:55 +0100 d.c [EMAIL PROTECTED] wrote: 2) And more important, *nobody* works against linus' bk head. I do, %100 exclusively, for all the networking and sparc development. I never work against the -mm tree. Dito. All my kernel development happens against Linus' bk head and I almost never work against -mm tree. Same here, I work on Linus's bk head and all the changes go to -mm for testing first, then to Linus for inclusion. I guess there is a perception that developers/maintainers are working against -mm because all maintainers trees are automatically pulled by Andrew. And when someone doing stuff on somewhat regular basis he/she tends to do it against maintainer's tree thus making patches suitable for -mm as well. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6: drivers/input/power.c is never built
On Friday 18 February 2005 18:31, Pavel Machek wrote: Hi! What is the benefit of splitting the flow of information so? It's split already. You get some from input (power and sleep keys on keyboards, sound volume keys and display brightness on some notebooks), some from ACPI events (power keys on notebooks and desktop cases, sound volume, display brightness on other notebooks), some from /proc/acpi/* (battery status, fan status), some from APM, from platform specific devices, from hotplug, from userspace daemons (UPS status). The question is how to unify it. Using power.c to simply pass power/sleep keys to the ACPI event pipe could get the input subsystem out of the loop at least. Maybe we could even pass sound keys to it. I do not think passing sound keys through acpi is good idea. acpid does not know how to handle them, and X already know how to get them from input subsystem. What X? I am not saying that sound events should go through acpid, but why bringing X here? One may not even run X... I believe power and suspend keys should definitely go through input. I'm not that sure about battery... Lid is somewhere in between... I think we need a generic way of delivering system status changes to userspace. Something like acpid but bigger than that, something not so heavily oriented on ACPI. I wonder if that kernel connector patch should be looked at. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6: drivers/input/power.c is never built
Hi Nigel, On Saturday 19 February 2005 01:28, Nigel Cunningham wrote: Hi. On Sat, 2005-02-19 at 13:58, Dmitry Torokhov wrote: On Friday 18 February 2005 18:31, Pavel Machek wrote: I believe power and suspend keys should definitely go through input. I'm not that sure about battery... Lid is somewhere in between... I think we need a generic way of delivering system status changes to userspace. Something like acpid but bigger than that, something not so heavily oriented on ACPI. I wonder if that kernel connector patch should be looked at. Absolutely. I've been thinking about this too, but haven't yet found the time to put it down on paper/email yet. I think we need a very generic system by which changes in anything remotely impacting on power management (kernelspace or userspace, including ACPI, UPS drivers, keyboard handlers, devices etc) can notify events to a userspace daemon. This daemon can act in accordance with user specified policies (changeable on the fly) to implement system level state changes (suspend to ram/disk, shutdown etc), run time power management Yep. (shutdown a USB hub that just signalled the removal of its last client), logging and so on. This last example - I don't think the daemon should micro-manage, I think USB bus should shutdown the hub automatically without involving userspace. In some cases, it might set policy but not be actively informed of the details of the application of that policy (we don't feedback loops with a process leaving C3 to notify that it's entering C3!). This implies, of course, not just a generic way of notifying changes, but a generic way of implementing policy. Sound too ambitious, or am I thinking your thoughts after you? Well, at this moment I only care about delivering the data to userspace, the rest (daemon, policies) is although interesting is out of scope for me. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Amiga joystick typo (was: Re: Input: fix open/close races in joystick drivers - add a semaphore)
On 7/13/05, Geert Uytterhoeven [EMAIL PROTECTED] wrote: On Mon, 27 Jun 2005, Linux Kernel Mailing List wrote: tree 11d80109ddc2f61de6a75a37941346100a67a0d1 parent af246041277674854383cf91b8f0b01217b521e8 author Dmitry Torokhov [EMAIL PROTECTED] Sun, 29 May 2005 12:29:52 -0500 committer Dmitry Torokhov [EMAIL PROTECTED] Sun, 29 May 2005 12:29:52 -0500 Input: fix open/close races in joystick drivers - add a semaphore to the ones that register more than one input device. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] drivers/input/joystick/amijoy.c | 29 - This patch broke compilation of amijoy. Trivial fix below. Sorry about that. Question - if I were to build a cross-compiler for amiga what arch is that? Right now I am compiling for i386 and hope that I will catch some real errors in between complaints about missing include files and definitions... -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Linux v2.6.13-rc3
On 7/13/05, Linus Torvalds [EMAIL PROTECTED] wrote: Dmitry Torokhov: [ACPI] Enable EC Burst Mode Ugh, this one is not really mine. Luming did all the work. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt
Hi, On 7/13/05, Lee Revell [EMAIL PROTECTED] wrote: On Wed, 2005-07-13 at 12:10 -0700, Linus Torvalds wrote: So we should aim for a HZ value that makes it easy to convert to and from the standard user-space interface formats. 100Hz, 250Hz and 1000Hz are all good values for that reason. 864 is not. How about 500? This might be good enough to solve the MIDI problem. I would expect number of laptop users significatly outnumber ones driving MIDI so as a default entry 250 makes more sense IMHO. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Synaptics probe problem on Acer Travelmate 3004WTMi
On 7/13/05, Thomas Sailer [EMAIL PROTECTED] wrote: Hi Vojtech, I've got a problem with my Acer Travelmate 3004WTMi Laptop: vanilla 2.6 does not detect the synaptics touchpad. The problem lies within psmouse_probe: after the PSMOUSE_CMD_GETID command, param[0] contains 0xfa, and not one of the expected values. If I just ignore this and continue, the synaptics pad is detected and everything works ok. Hi, Could you please provide us with debug dmesg - just boot with i8042.debug on kernel command line. Thanks! -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: PS/2 Keyboard is dead after resume.
On Thursday 14 July 2005 21:35, Andrew Haninger wrote: Hello. I'm using Linux Kernel 2.6.12.2 plus suspend 2.1.9.9 and acpi-20050408 with the hibernate-1.10 script. My machine is a Shuttle SK43G which has a VIA KM400 chipset with an Athlon XP CPU. Suspension seems to work well. However, when I resume, the keyboard is dead and there is a warning in dmesg before and after suspension: atkbd.c: Spurious ACK on isa0060/serio0. Some program, like XFree86, might be trying access hardware directly. Could you try doing: echo 1 /sys/modules/i8042/parameters/debug before suspending and the post your dmesg, please? Maybe we see something there. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: PS/2 Keyboard is dead after resume.
[Suspend2 was removed from CC as it appears to be subscribers-only list.] On Friday 15 July 2005 06:43, Andrew Haninger wrote: On 7/15/05, Dmitry Torokhov [EMAIL PROTECTED] wrote: Could you try doing: echo 1 /sys/modules/i8042/parameters/debug before suspending and the post your dmesg, please? Maybe we see something there. Here you go: 12) *0, disabled. Ok, so you start with IRQ 12 disabled.. You don't have a PS/2 mouse, do you? ... serio: i8042 AUX port at 0x60,0x64 irq 12 serio: i8042 KBD port at 0x60,0x64 irq 1 You did not select PNP support (but as far as keyboard controller settings go we don't trust it anyway on i386). ... ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 12 PCI: setting IRQ 12 as level-triggered ACPI: PCI Interrupt :00:0f.0[A] - Link [LNKA] - GSI 12 (level, low) - IRQ 12 PCI: Via IRQ fixup for :00:0f.0, from 255 to 12 VP_IDE: chipset revision 6 ... USB Universal Host Controller Interface driver v2.2 ACPI: PCI Interrupt :00:10.0[A] - Link [LNKA] - GSI 12 (level, low) - IRQ 12 uhci_hcd :00:10.0: VIA Technologies, Inc. VT82x UHCI USB 1.1 Controller uhci_hcd :00:10.0: new USB bus registered, assigned bus number 2 uhci_hcd :00:10.0: irq 12, io base 0xd000 hub 2-0:1.0: USB hub found hub 2-0:1.0: 2 ports detected ACPI: PCI Interrupt :00:10.1[A] - Link [LNKA] - GSI 12 (level, low) - IRQ 12 uhci_hcd :00:10.1: VIA Technologies, Inc. VT82x UHCI USB 1.1 Controller (#2) uhci_hcd :00:10.1: new USB bus registered, assigned bus number 3 uhci_hcd :00:10.1: irq 12, io base 0xd400 And here you have a bunch of hardware gets assigned to IRQ 12... Hmm, I tought ACPI would try not use 12 unless it is absolutely necessary. What appens if you use pci=routeirq boot option? drivers/input/serio/i8042.c: 60 - i8042 (command) [154857] drivers/input/serio/i8042.c: 65 - i8042 (parameter) [154857] drivers/input/serio/i8042.c: 60 - i8042 (command) [154857] drivers/input/serio/i8042.c: 65 - i8042 (parameter) [154857] drivers/input/serio/i8042.c: 60 - i8042 (command) [154857] drivers/input/serio/i8042.c: 47 - i8042 (parameter) [154857] drivers/input/serio/i8042.c: f2 - i8042 (kbd-data) [154857] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154860] drivers/input/serio/i8042.c: ab - i8042 (interrupt, KBD, 1) [154861] drivers/input/serio/i8042.c: 41 - i8042 (interrupt, KBD, 1) [154862] drivers/input/serio/i8042.c: ed - i8042 (kbd-data) [154862] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154865] drivers/input/serio/i8042.c: 00 - i8042 (kbd-data) [154865] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154867] drivers/input/serio/i8042.c: f3 - i8042 (kbd-data) [154867] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154870] drivers/input/serio/i8042.c: 00 - i8042 (kbd-data) [154870] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154873] drivers/input/serio/i8042.c: f4 - i8042 (kbd-data) [154873] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154876] drivers/input/serio/i8042.c: ed - i8042 (kbd-data) [154876] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154879] drivers/input/serio/i8042.c: 00 - i8042 (kbd-data) [154879] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [154881] Keyboard seems to be resumed just fine... 20%...40%...60%...80%...100%...done. drivers/input/serio/i8042.c: 60 - i8042 (command) [155414] drivers/input/serio/i8042.c: 47 - i8042 (parameter) [155414] drivers/input/serio/i8042.c: d4 - i8042 (command) [155414] drivers/input/serio/i8042.c: f2 - i8042 (parameter) [155414] drivers/input/serio/i8042.c: fa - i8042 (interrupt, KBD, 1) [155417] atkbd.c: Spurious ACK on isa0060/serio0. Some program, like XFree86, might be trying access hardware directly. drivers/input/serio/i8042.c: ab - i8042 (interrupt, KBD, 1) [155418] But when we try to talk to mouse port we ket response from the keyboard and something gets confused. You can try working around this with i8042.noaux kernel boot option, but we should probably teach i8042 driver to not touch AUX port on resume if it was disabled. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Synaptics and TrackPoint problems in 2.6.12
On Tuesday 19 July 2005 22:40, Stephen Evanchik wrote: Dimitry, I have been receiving a lot of complaints that TrackPoints on Synaptics pass-thru ports stopped working with 2.6.12. I retested 2.6.9 and 2.6.11-rc3 successfully, I believe 2.6.11.7 may also work but that is unconfirmed at this point. The behavior is always the same .. after sending the read secondary ID command, the TrackPoint seems to be disabled from that point forward. Any ideas? Not really... You know, I am reviewing the 2.6.12 patch and don't really see anything that might have caused the problem you are describing. I know that not all devices on pass-through ports are broken since I have one (not TrackPoint, just a simple eraser head pointer) and I make sure it works ;) When you are talking about reading secondary ID, are you talking about TP_READ_ID or something else? Are you experiencing the breakage yourself? It might be interesting to see the log with i8042 debugging turned on. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Synaptics and TrackPoint problems in 2.6.12
On 7/20/05, Sergey Vlasov [EMAIL PROTECTED] wrote: On Tue, 19 Jul 2005 23:40:18 -0400 Stephen Evanchik wrote: I have been receiving a lot of complaints that TrackPoints on Synaptics pass-thru ports stopped working with 2.6.12. I retested 2.6.9 and 2.6.11-rc3 successfully, I believe 2.6.11.7 may also work but that is unconfirmed at this point. The behavior is always the same .. after sending the read secondary ID command, the TrackPoint seems to be disabled from that point forward. Any ideas? Looks like this problem was introduced by the change from PSMOUSE_PS2 to PSMOUSE_TRACKPOINT in the TrackPoint support patch. The Synaptics driver needs to know whether the device on the pass-thru port is using 3-byte or 4-byte packets; however, instead of checking child-pktsize, it checks child-type = PSMOUSE_GENPS - and this check is now giving a wrong result. Therefore the Synaptics driver configures the pass-thru port for 4-byte packets, and all 3-byte packets from TrackPoint seem to be thrown away. Oh, yes, that would do it. The patch below is reported to fix the problem - now the 4-byte mode is used only if child-pktsize == 4. That is the correct fix. Another option is to change the PSMOUSE_TRACKPOINT value so that it is less than PSMOUSE_GENPS, No, protocol numbers should not be changed as userspace drivers/setups check them and rely on them being stable. That's why psmouse-pktsize was introduced to begin with. Unfortunately synaptics pass-through piece was missed and not adjusted. I will add the patch to my tree, thanks! In theory, someone could attach a device which uses 6-byte packets to the Synaptics pass-thru port; I'm not sure what would happen in this case, but with Synaptics confugured for 3-byte packets (as the patch below will do) this configuration even has a chance of working. I don't think it can support more than 4 byte packets. bytes 0 and 3 are protocol markers and can't be readily used for transmitting other protocols data. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch,rfc] Support for touchscreen on sharp zaurus sl-5500
Hi, On Thursday 21 July 2005 00:24, Pavel Machek wrote: +config TOUCHSCREEN_COLLIE + tristate Collie touchscreen (for Sharp SL-5500) + depends on MCP_UCB1200 INPUT I don't think you need INPUT here. obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o +obj-$(CONFIG_TOUCHSCREEN_COLLIE)+= collie_ts.o A tab would be nice. + +/* + * This is a RT kernel thread that handles the ADC accesses + * (mainly so we can use semaphores in the UCB1200 core code + * to serialise accesses to the ADC). The UCB1400 access + * functions are expected to be able to sleep as well. + */ +static int ucb1x00_thread(void *_ts) +{ + struct ucb1x00_ts *ts = _ts; + struct task_struct *tsk = current; + int valid; + + ts-rtask = tsk; + + daemonize(ktsd); + /* only want to receive SIGKILL */ + allow_signal(SIGKILL); + This should be converted to kthread interface. +static int ucb1x00_ts_open(struct input_dev *idev) +{ + struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; + int ret = 0; + + if (down_interruptible(ts-sem)) + return -EINTR; + + if (ts-use_count++ != 0) + goto out; + Please kill both ts-sem and ts-use_count - input core already serializes input_open and input_close. + if (ts-rtask) + panic(ucb1x00: rtask running?); + + sema_init(ts-irq_wait, 0); + ret = ucb1x00_hook_irq(ts-ucb, UCB_IRQ_TSPX, ucb1x00_ts_irq, ts); + if (ret 0) + goto out; + + /* + * If we do this at all, we should allow the user to + * measure and read the X and Y resistance at any time. + */ + ucb1x00_adc_enable(ts-ucb); + ts-x_res = ucb1x00_ts_read_xres(ts); + ts-y_res = ucb1x00_ts_read_yres(ts); + ucb1x00_adc_disable(ts-ucb); + + init_completion(ts-init_exit); + ret = kernel_thread(ucb1x00_thread, ts, CLONE_KERNEL); + if (ret = 0) { + wait_for_completion(ts-init_exit); + ret = 0; + } else { + ucb1x00_free_irq(ts-ucb, UCB_IRQ_TSPX, ts); + } kthread_run(ucb1x00_thread, ts, ktsd)... + +MODULE_PARM(adcsync, i); +MODULE_PARM_DESC(adcsync, Enable use of ADCSYNC signal); Die, MODULE_PARM, die! -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [linux-pm] [PATCH] Corrected Workqueue freezer support.
On Thursday 21 July 2005 00:32, Nigel Cunningham wrote: (Fixed to remove the latent mention of syncthreads). This patch implements freezer support for workqueues. The current refrigerator implementation makes all workqueues NOFREEZE, regardless of whether they need to be or not. I think kseriod and kgameportd threads can be left freezable. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: fix suspend/resume irq request free for yenta..
On Friday 22 July 2005 17:33, Dave Airlie wrote: Without this patch my laptop fails to resume from suspend to RAM... It applies against a pretty recent 2.6.13-rc3 from git.. Hi, Is it necessary to do free_irq for suspend? Shouldn't disable_irq be enough? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 2/2] Touchscreen support for sharp sl-5500
On Friday 22 July 2005 19:28, Pavel Machek wrote: This adds support for touchscreen on Sharp Zaurus sl-5500. Vojtech, please apply, I have couple more commnets... +static int ucb1x00_thread(void *_ts) +{ + struct ucb1x00_ts *ts = _ts; + struct task_struct *tsk = current; + int valid; + + ts-rtask = tsk; + allow_signal(SIGKILL); This is not needed... + + /* + * We run as a real-time thread. However, thus far + * this doesn't seem to be necessary. + */ + tsk-policy = SCHED_FIFO; + tsk-rt_priority = 1; + + complete(ts-init_exit); + Neither this one - kthread_create does not return until thread is actually created and started. + + if (signal_pending(tsk)) + break; if (kthread_should_stop(..)) break; + } + + ts-rtask = NULL; + complete_and_exit(ts-init_exit, 0); This is not needed. +static int ucb1x00_ts_open(struct input_dev *idev) +{ + struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; + int ret = 0; + struct task_struct *task; + + if (ts-rtask) + panic(ucb1x00: rtask running?); + Do you really need to panic here??? + + init_completion(ts-init_exit); + task = kthread_run(ucb1x00_thread, ts, ktsd); + if (!IS_ERR(task)) { + wait_for_completion(ts-init_exit); Just call kthread_run() and kill that init_exit completion. +static void ucb1x00_ts_close(struct input_dev *idev) +{ + struct ucb1x00_ts *ts = (struct ucb1x00_ts *)idev; + + if (ts-rtask) { + send_sig(SIGKILL, ts-rtask, 1); + wait_for_completion(ts-init_exit); kthread_stop(). -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
On Sunday 24 July 2005 23:09, Jon Smirl wrote: I just pulled from GIT to test bind/unbind. I couldn't get it to work; it isn't taking into account the CR on the end of the input value of the sysfs attribute. This patch will fix it but I'm sure there is a cleaner solution. echo -n should take care of this problem I think. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 03/24] serio: add modalias
Input: serio - add modalias attribute and environment variable to simplify hotplug scripts. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/serio/serio.c | 42 ++ 1 files changed, 26 insertions(+), 16 deletions(-) Index: work/drivers/input/serio/serio.c === --- work.orig/drivers/input/serio/serio.c +++ work/drivers/input/serio/serio.c @@ -389,6 +389,14 @@ static ssize_t serio_show_description(st return sprintf(buf, %s\n, serio-name); } +static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct serio *serio = to_serio_port(dev); + + return sprintf(buf, serio:ty%02Xpr%02Xid%02Xex%02X\n, + serio-id.type, serio-id.proto, serio-id.id, serio-id.extra); +} + static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); @@ -487,6 +495,7 @@ static ssize_t serio_set_bind_mode(struc static struct device_attribute serio_device_attrs[] = { __ATTR(description, S_IRUGO, serio_show_description, NULL), + __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL), __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), __ATTR_NULL @@ -785,36 +794,37 @@ static int serio_bus_match(struct device #ifdef CONFIG_HOTPLUG -#define PUT_ENVP(fmt, val) \ -do { \ - envp[i++] = buffer; \ - length += snprintf(buffer, buffer_size - length, fmt, val); \ - if (buffer_size - length = 0 || i = num_envp) \ - return -ENOMEM; \ - length++; \ - buffer += length; \ -} while (0) +#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \ + do {\ + int err = add_hotplug_env_var(envp, num_envp, i, \ + buffer, buffer_size, len, \ + fmt, val); \ + if (err)\ + return err; \ + } while (0) + static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct serio *serio; int i = 0; - int length = 0; + int len = 0; if (!dev) return -ENODEV; serio = to_serio_port(dev); - PUT_ENVP(SERIO_TYPE=%02x, serio-id.type); - PUT_ENVP(SERIO_PROTO=%02x, serio-id.proto); - PUT_ENVP(SERIO_ID=%02x, serio-id.id); - PUT_ENVP(SERIO_EXTRA=%02x, serio-id.extra); - + SERIO_ADD_HOTPLUG_VAR(SERIO_TYPE=%02x, serio-id.type); + SERIO_ADD_HOTPLUG_VAR(SERIO_PROTO=%02x, serio-id.proto); + SERIO_ADD_HOTPLUG_VAR(SERIO_ID=%02x, serio-id.id); + SERIO_ADD_HOTPLUG_VAR(SERIO_EXTRA=%02x, serio-id.extra); + SERIO_ADD_HOTPLUG_VAR(MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X, + serio-id.type, serio-id.proto, serio-id.id, serio-id.extra); envp[i] = NULL; return 0; } -#undef PUT_ENVP +#undef SERIO_ADD_HOTPLUG_VAR #else - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 02/24] uinput: use completions
Input: uinput - use completions instead of events and manual wakeups in force feedback code. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/misc/uinput.c | 81 +++- include/linux/uinput.h |5 +- 2 files changed, 45 insertions(+), 41 deletions(-) Index: work/drivers/input/misc/uinput.c === --- work.orig/drivers/input/misc/uinput.c +++ work/drivers/input/misc/uinput.c @@ -53,24 +53,23 @@ static int uinput_dev_event(struct input return 0; } -static int uinput_request_alloc_id(struct input_dev *dev, struct uinput_request *request) +static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_request *request) { /* Atomically allocate an ID for the given request. Returns 0 on success. */ - struct uinput_device *udev = dev-private; int id; int err = -1; - down(udev-requests_sem); + spin_lock(udev-requests_lock); for (id = 0; id UINPUT_NUM_REQUESTS; id++) if (!udev-requests[id]) { - udev-requests[id] = request; request-id = id; + udev-requests[id] = request; err = 0; break; } - up(udev-requests_sem); + spin_unlock(udev-requests_lock); return err; } @@ -79,70 +78,78 @@ static struct uinput_request* uinput_req /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ if (id = UINPUT_NUM_REQUESTS || id 0) return NULL; - if (udev-requests[id]-completed) - return NULL; return udev-requests[id]; } -static void uinput_request_init(struct input_dev *dev, struct uinput_request *request, int code) +static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct uinput_request *request) { - struct uinput_device *udev = dev-private; + /* Allocate slot. If none are available right away, wait. */ + return wait_event_interruptible(udev-requests_waitq, + !uinput_request_alloc_id(udev, request)); +} - memset(request, 0, sizeof(struct uinput_request)); - request-code = code; - init_waitqueue_head(request-waitq); +static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) +{ + complete(request-done); - /* Allocate an ID. If none are available right away, wait. */ - request-retval = wait_event_interruptible(udev-requests_waitq, - !uinput_request_alloc_id(dev, request)); + /* Mark slot as available */ + udev-requests[request-id] = NULL; + wake_up_interruptible(udev-requests_waitq); } -static void uinput_request_submit(struct input_dev *dev, struct uinput_request *request) +static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) { - struct uinput_device *udev = dev-private; int retval; /* Tell our userspace app about this new request by queueing an input event */ uinput_dev_event(dev, EV_UINPUT, request-code, request-id); /* Wait for the request to complete */ - retval = wait_event_interruptible(request-waitq, request-completed); - if (retval) - request-retval = retval; + retval = wait_for_completion_interruptible(request-done); + if (!retval) + retval = request-retval; - /* Release this request's ID, let others know it's available */ - udev-requests[request-id] = NULL; - wake_up_interruptible(udev-requests_waitq); + return retval; } static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) { struct uinput_request request; + int retval; if (!test_bit(EV_FF, dev-evbit)) return -ENOSYS; - uinput_request_init(dev, request, UI_FF_UPLOAD); - if (request.retval) - return request.retval; + request.id = -1; + init_completion(request.done); + request.code = UI_FF_UPLOAD; request.u.effect = effect; - uinput_request_submit(dev, request); - return request.retval; + + retval = uinput_request_reserve_slot(dev-private, request); + if (!retval) + retval = uinput_request_submit(dev, request); + + return retval; } static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) { struct uinput_request request; + int retval; if (!test_bit(EV_FF, dev-evbit)) return -ENOSYS; - uinput_request_init(dev, request, UI_FF_ERASE); - if (request.retval) - return request.retval; + request.id = -1; + init_completion(request.done); + request.code = UI_FF_ERASE
[patch 15/24] ALPS: Fix resume for DualPoints
From: David Moore [EMAIL PROTECTED] Input: ALPS - fix resume (for DualPoints) The driver would not reset pass-through mode when performing resume of a DualPoint touchpad causing it to stop working until next reboot. Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/mouse/alps.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: work/drivers/input/mouse/alps.c === --- work.orig/drivers/input/mouse/alps.c +++ work/drivers/input/mouse/alps.c @@ -358,7 +358,7 @@ static int alps_reconnect(struct psmouse if (!(priv-i = alps_get_model(psmouse, version))) return -1; - if (priv-i-flags ALPS_PASS alps_passthrough_mode(psmouse, 1)) + if ((priv-i-flags ALPS_PASS) alps_passthrough_mode(psmouse, 1)) return -1; if (alps_get_status(psmouse, param)) @@ -372,7 +372,7 @@ static int alps_reconnect(struct psmouse return -1; } - if (priv-i-flags == ALPS_PASS alps_passthrough_mode(psmouse, 0)) + if ((priv-i-flags ALPS_PASS) alps_passthrough_mode(psmouse, 0)) return -1; return 0; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 05/24] Add usb_to_input_id
Input: introduce usb_to_input_id() to uniformly produce struct input_id for USB input devices. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/usb/input/acecad.c |6 ++ drivers/usb/input/aiptek.c |6 ++ drivers/usb/input/ati_remote.c |8 +++- drivers/usb/input/hid-input.c |6 ++ drivers/usb/input/itmtouch.c|6 ++ drivers/usb/input/kbtab.c |6 ++ drivers/usb/input/mtouchusb.c |6 ++ drivers/usb/input/powermate.c |6 ++ drivers/usb/input/touchkitusb.c |7 ++- drivers/usb/input/usbkbd.c |6 ++ drivers/usb/input/usbmouse.c|6 ++ drivers/usb/input/wacom.c |6 ++ drivers/usb/input/xpad.c|6 ++ drivers/usb/media/konicawc.c|6 ++ include/linux/usb_input.h | 25 + 15 files changed, 54 insertions(+), 58 deletions(-) Index: work/drivers/usb/input/acecad.c === --- work.orig/drivers/usb/input/acecad.c +++ work/drivers/usb/input/acecad.c @@ -31,6 +31,7 @@ #include linux/module.h #include linux/init.h #include linux/usb.h +#include linux/usb_input.h /* * Version Information @@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_i acecad-dev.name = acecad-name; acecad-dev.phys = acecad-phys; - acecad-dev.id.bustype = BUS_USB; - acecad-dev.id.vendor = le16_to_cpu(dev-descriptor.idVendor); - acecad-dev.id.product = le16_to_cpu(dev-descriptor.idProduct); - acecad-dev.id.version = le16_to_cpu(dev-descriptor.bcdDevice); + usb_to_input_id(dev, acecad-dev.id); acecad-dev.dev = intf-dev; usb_fill_int_urb(acecad-irq, dev, pipe, Index: work/drivers/usb/input/aiptek.c === --- work.orig/drivers/usb/input/aiptek.c +++ work/drivers/usb/input/aiptek.c @@ -77,6 +77,7 @@ #include linux/module.h #include linux/init.h #include linux/usb.h +#include linux/usb_input.h #include linux/sched.h #include asm/uaccess.h #include asm/unaligned.h @@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, aiptek-inputdev.absflat[ABS_WHEEL] = 0; aiptek-inputdev.name = Aiptek; aiptek-inputdev.phys = aiptek-features.usbPath; - aiptek-inputdev.id.bustype = BUS_USB; - aiptek-inputdev.id.vendor = le16_to_cpu(usbdev-descriptor.idVendor); - aiptek-inputdev.id.product = le16_to_cpu(usbdev-descriptor.idProduct); - aiptek-inputdev.id.version = le16_to_cpu(usbdev-descriptor.bcdDevice); + usb_to_input_id(usbdev, aiptek-inputdev.id); aiptek-inputdev.dev = intf-dev; aiptek-usbdev = usbdev; Index: work/drivers/usb/input/usbkbd.c === --- work.orig/drivers/usb/input/usbkbd.c +++ work/drivers/usb/input/usbkbd.c @@ -32,6 +32,7 @@ #include linux/input.h #include linux/init.h #include linux/usb.h +#include linux/usb_input.h /* * Version Information @@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_inte kbd-dev.name = kbd-name; kbd-dev.phys = kbd-phys; - kbd-dev.id.bustype = BUS_USB; - kbd-dev.id.vendor = le16_to_cpu(dev-descriptor.idVendor); - kbd-dev.id.product = le16_to_cpu(dev-descriptor.idProduct); - kbd-dev.id.version = le16_to_cpu(dev-descriptor.bcdDevice); + usb_to_input_id(dev, kbd-dev.id); kbd-dev.dev = iface-dev; if (dev-manufacturer) Index: work/drivers/usb/input/usbmouse.c === --- work.orig/drivers/usb/input/usbmouse.c +++ work/drivers/usb/input/usbmouse.c @@ -32,6 +32,7 @@ #include linux/module.h #include linux/init.h #include linux/usb.h +#include linux/usb_input.h /* * Version Information @@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_in mouse-dev.name = mouse-name; mouse-dev.phys = mouse-phys; - mouse-dev.id.bustype = BUS_USB; - mouse-dev.id.vendor = le16_to_cpu(dev-descriptor.idVendor); - mouse-dev.id.product = le16_to_cpu(dev-descriptor.idProduct); - mouse-dev.id.version = le16_to_cpu(dev-descriptor.bcdDevice); + usb_to_input_id(dev, mouse-dev.id); mouse-dev.dev = intf-dev; if (dev-manufacturer) Index: work/drivers/usb/input/wacom.c === --- work.orig/drivers/usb/input/wacom.c +++ work/drivers/usb/input/wacom.c @@ -69,6 +69,7 @@ #include linux/module.h #include linux/init.h #include linux/usb.h +#include linux/usb_input.h #include asm/unaligned.h #include asm/byteorder.h @@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interf wacom-dev.name = wacom-features-name; wacom-dev.phys = wacom-phys; - wacom-dev.id.bustype = BUS_USB; - wacom-dev.id.vendor = le16_to_cpu
[patch 08/24] input: make name, phys and uniq const char
Input: make name, phys and uniq be 'const char *' because once set noone should attempt to change them. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/char/sonypi.c | 24 ++-- drivers/input/misc/uinput.c | 23 --- include/linux/input.h |6 +++--- 3 files changed, 17 insertions(+), 36 deletions(-) Index: work/drivers/char/sonypi.c === --- work.orig/drivers/char/sonypi.c +++ work/drivers/char/sonypi.c @@ -1228,14 +1228,7 @@ static int __devinit sonypi_probe(void) sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE); sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); - sonypi_device.input_jog_dev.name = - kmalloc(sizeof(SONYPI_JOG_INPUTNAME), GFP_KERNEL); - if (!sonypi_device.input_jog_dev.name) { - printk(KERN_ERR sonypi: kmalloc failed\n); - ret = -ENOMEM; - goto out_inkmallocinput1; - } - sprintf(sonypi_device.input_jog_dev.name, SONYPI_JOG_INPUTNAME); + sonypi_device.input_jog_dev.name = SONYPI_JOG_INPUTNAME; sonypi_device.input_jog_dev.id.bustype = BUS_ISA; sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; @@ -1249,14 +1242,7 @@ static int __devinit sonypi_probe(void) if (sonypi_inputkeys[i].inputev) set_bit(sonypi_inputkeys[i].inputev, sonypi_device.input_key_dev.keybit); - sonypi_device.input_key_dev.name = - kmalloc(sizeof(SONYPI_KEY_INPUTNAME), GFP_KERNEL); - if (!sonypi_device.input_key_dev.name) { - printk(KERN_ERR sonypi: kmalloc failed\n); - ret = -ENOMEM; - goto out_inkmallocinput2; - } - sprintf(sonypi_device.input_key_dev.name, SONYPI_KEY_INPUTNAME); + sonypi_device.input_key_dev.name = SONYPI_KEY_INPUTNAME; sonypi_device.input_key_dev.id.bustype = BUS_ISA; sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; @@ -1314,11 +1300,7 @@ out_platformdev: kfifo_free(sonypi_device.input_fifo); out_infifo: input_unregister_device(sonypi_device.input_key_dev); - kfree(sonypi_device.input_key_dev.name); -out_inkmallocinput2: input_unregister_device(sonypi_device.input_jog_dev); - kfree(sonypi_device.input_jog_dev.name); -out_inkmallocinput1: free_irq(sonypi_device.irq, sonypi_irq); out_reqirq: release_region(sonypi_device.ioport1, sonypi_device.region_size); @@ -1345,9 +1327,7 @@ static void __devexit sonypi_remove(void if (useinput) { input_unregister_device(sonypi_device.input_key_dev); - kfree(sonypi_device.input_key_dev.name); input_unregister_device(sonypi_device.input_jog_dev); - kfree(sonypi_device.input_jog_dev.name); kfifo_free(sonypi_device.input_fifo); } Index: work/include/linux/input.h === --- work.orig/include/linux/input.h +++ work/include/linux/input.h @@ -811,9 +811,9 @@ struct input_dev { void *private; - char *name; - char *phys; - char *uniq; + const char *name; + const char *phys; + const char *uniq; struct input_id id; unsigned long evbit[NBITS(EV_MAX)]; Index: work/drivers/input/misc/uinput.c === --- work.orig/drivers/input/misc/uinput.c +++ work/drivers/input/misc/uinput.c @@ -251,6 +251,7 @@ static int uinput_alloc_device(struct fi struct uinput_user_dev *user_dev; struct input_dev*dev; struct uinput_device*udev; + char*name; int size; int retval; @@ -274,13 +275,13 @@ static int uinput_alloc_device(struct fi kfree(dev-name); size = strnlen(user_dev-name, UINPUT_MAX_NAME_SIZE) + 1; - dev-name = kmalloc(size, GFP_KERNEL); - if (!dev-name) { + dev-name = name = kmalloc(size, GFP_KERNEL); + if (!name) { retval = -ENOMEM; goto exit; } + strlcpy(name, user_dev-name, size); - strlcpy(dev-name, user_dev-name, size); dev-id.bustype = user_dev-id.bustype; dev-id.vendor = user_dev-id.vendor; dev-id.product = user_dev-id.product; @@ -397,6 +398,7 @@ static int uinput_ioctl(struct inode *in struct uinput_ff_erase ff_erase; struct uinput_request *req; int
[patch 16/24] ALPS: fix enabling tapping mode
From: Peter Osterlund [EMAIL PROTECTED] Input: ALPS - unconditionally enable tapping mode The condition in alps_init() was also inverted and the driver was enabling tapping mode only if it was already enabled. Signed-off-by: Peter Osterlund [EMAIL PROTECTED] Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/mouse/alps.c | 25 +++-- 1 files changed, 7 insertions(+), 18 deletions(-) Index: work/drivers/input/mouse/alps.c === --- work.orig/drivers/input/mouse/alps.c +++ work/drivers/input/mouse/alps.c @@ -2,7 +2,7 @@ * ALPS touchpad PS/2 mouse driver * * Copyright (c) 2003 Neil Brown [EMAIL PROTECTED] - * Copyright (c) 2003 Peter Osterlund [EMAIL PROTECTED] + * Copyright (c) 2003-2005 Peter Osterlund [EMAIL PROTECTED] * Copyright (c) 2004 Dmitry Torokhov [EMAIL PROTECTED] * Copyright (c) 2005 Vojtech Pavlik [EMAIL PROTECTED] * @@ -350,7 +350,6 @@ static int alps_tap_mode(struct psmouse static int alps_reconnect(struct psmouse *psmouse) { struct alps_data *priv = psmouse-private; - unsigned char param[4]; int version; psmouse_reset(psmouse); @@ -361,14 +360,13 @@ static int alps_reconnect(struct psmouse if ((priv-i-flags ALPS_PASS) alps_passthrough_mode(psmouse, 1)) return -1; - if (alps_get_status(psmouse, param)) + if (alps_tap_mode(psmouse, 1)) { + printk(KERN_WARNING alps.c: Failed to reenable hardware tapping\n); return -1; - - if (!(param[0] 0x04)) - alps_tap_mode(psmouse, 1); + } if (alps_absolute_mode(psmouse)) { - printk(KERN_ERR alps.c: Failed to enable absolute mode\n); + printk(KERN_ERR alps.c: Failed to reenable absolute mode\n); return -1; } @@ -389,7 +387,6 @@ static void alps_disconnect(struct psmou int alps_init(struct psmouse *psmouse) { struct alps_data *priv; - unsigned char param[4]; int version; psmouse-private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); @@ -403,16 +400,8 @@ int alps_init(struct psmouse *psmouse) if ((priv-i-flags ALPS_PASS) alps_passthrough_mode(psmouse, 1)) goto init_fail; - if (alps_get_status(psmouse, param)) { - printk(KERN_ERR alps.c: touchpad status report request failed\n); - goto init_fail; - } - - if (param[0] 0x04) { - printk(KERN_INFO alps.c: Enabling hardware tapping\n); - if (alps_tap_mode(psmouse, 1)) - printk(KERN_WARNING alps.c: Failed to enable hardware tapping\n); - } + if (alps_tap_mode(psmouse, 1)) + printk(KERN_WARNING alps.c: Failed to enable hardware tapping\n); if (alps_absolute_mode(psmouse)) { printk(KERN_ERR alps.c: Failed to enable absolute mode\n); - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 12/24] i8042 - add Alienware Sentia to NOMUX blacklist
Input: i8042 - add Alienware Sentia to NOMUX blacklist. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/serio/i8042-x86ia64io.h |7 +++ 1 files changed, 7 insertions(+) Index: work/drivers/input/serio/i8042-x86ia64io.h === --- work.orig/drivers/input/serio/i8042-x86ia64io.h +++ work/drivers/input/serio/i8042-x86ia64io.h @@ -137,6 +137,13 @@ static struct dmi_system_id __initdata i DMI_MATCH(DMI_PRODUCT_NAME, Satellite P10), }, }, + { + .ident = Alienware Sentia, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, ALIENWARE), + DMI_MATCH(DMI_PRODUCT_NAME, Sentia), + }, + }, { } }; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 20/24] HID - only report events coming from interrupts to hiddev
From: Adam Kropelin [EMAIL PROTECTED] Input: HID - only report events coming from interrupts to hiddev Currently hid-core follows the same code path for input reports regardless of whether they are a result of interrupt transfers or control transfers. That leads to interrupt events erroneously being reported to hiddev for regular control transfers. Prior to 2.6.12 the problem was mitigated by the fact that reporting to hiddev is supressed if the field value has not changed, which is often the case. Said filtering was removed in 2.6.12-rc1 which means any input reports fetched via control transfers result in hiddev interrupt events. This behavior can quickly lead to a feedback loop where a userspace app, in response to interrupt events, issues control transfers which in turn create more interrupt events. This patch prevents input reports that arrive via control transfers from being reported to hiddev as interrupt events. Signed-off-by: Adam Kropelin [EMAIL PROTECTED] Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/usb/input/hid-core.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) Index: work/drivers/usb/input/hid-core.c === --- work.orig/drivers/usb/input/hid-core.c +++ work/drivers/usb/input/hid-core.c @@ -789,12 +789,12 @@ static __inline__ int search(__s32 *arra return -1; } -static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) +static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs) { hid_dump_input(usage, value); if (hid-claimed HID_CLAIMED_INPUT) hidinput_hid_event(hid, field, usage, value, regs); - if (hid-claimed HID_CLAIMED_HIDDEV) + if (hid-claimed HID_CLAIMED_HIDDEV interrupt) hiddev_hid_event(hid, field, usage, value, regs); } @@ -804,7 +804,7 @@ static void hid_process_event(struct hid * reporting to the layer). */ -static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, struct pt_regs *regs) +static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt, struct pt_regs *regs) { unsigned n; unsigned count = field-report_count; @@ -831,19 +831,19 @@ static void hid_input_field(struct hid_d for (n = 0; n count; n++) { if (HID_MAIN_ITEM_VARIABLE field-flags) { - hid_process_event(hid, field, field-usage[n], value[n], regs); + hid_process_event(hid, field, field-usage[n], value[n], interrupt, regs); continue; } if (field-value[n] = min field-value[n] = max field-usage[field-value[n] - min].hid search(value, field-value[n], count)) - hid_process_event(hid, field, field-usage[field-value[n] - min], 0, regs); + hid_process_event(hid, field, field-usage[field-value[n] - min], 0, interrupt, regs); if (value[n] = min value[n] = max field-usage[value[n] - min].hid search(field-value, value[n], count)) - hid_process_event(hid, field, field-usage[value[n] - min], 1, regs); + hid_process_event(hid, field, field-usage[value[n] - min], 1, interrupt, regs); } memcpy(field-value, value, count * sizeof(__s32)); @@ -851,7 +851,7 @@ exit: kfree(value); } -static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) +static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_regs *regs) { struct hid_device *hid = urb-context; struct hid_report_enum *report_enum = hid-report_enum + type; @@ -899,7 +899,7 @@ static int hid_input_report(int type, st hiddev_report_event(hid, report); for (n = 0; n report-maxfield; n++) - hid_input_field(hid, report-field[n], data, regs); + hid_input_field(hid, report-field[n], data, interrupt, regs); if (hid-claimed HID_CLAIMED_INPUT) hidinput_report_event(hid, report); @@ -918,7 +918,7 @@ static void hid_irq_in(struct urb *urb, switch (urb-status) { case 0: /* success */ - hid_input_report(HID_INPUT_REPORT, urb, regs); + hid_input_report(HID_INPUT_REPORT, urb, 1, regs); break; case -ECONNRESET: /* unlink */ case -ENOENT: @@ -1142,7 +1142,7 @@ static void hid_ctrl(struct urb *urb, st
[patch 13/24] i8042 - add Fujitsu T3010 to NOMUX blacklist
From: Vojtech Pavlik [EMAIL PROTECTED] Input: i8042 - add Fujitsu T3010 to NOMUX blacklist. Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/serio/i8042-x86ia64io.h |7 +++ 1 files changed, 7 insertions(+) Index: work/drivers/input/serio/i8042-x86ia64io.h === --- work.orig/drivers/input/serio/i8042-x86ia64io.h +++ work/drivers/input/serio/i8042-x86ia64io.h @@ -131,6 +131,13 @@ static struct dmi_system_id __initdata i }, }, { + .ident = Fujitsu-Siemens Lifebook T3010, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, FUJITSU SIEMENS), + DMI_MATCH(DMI_PRODUCT_NAME, LIFEBOOK T3010), + }, + }, + { .ident = Toshiba P10, .matches = { DMI_MATCH(DMI_SYS_VENDOR, TOSHIBA), - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 17/24] HID: Add a quirk for Aashima gamepad
From: Luca T. [EMAIL PROTECTED] Input: HID - add a quirk for Aashima Trust (06d6:0025) gamepad Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/usb/input/hid-core.c |4 1 files changed, 4 insertions(+) Index: work/drivers/usb/input/hid-core.c === --- work.orig/drivers/usb/input/hid-core.c +++ work/drivers/usb/input/hid-core.c @@ -1372,6 +1372,9 @@ void hid_init_reports(struct hid_device #define USB_VENDOR_ID_A4TECH 0x09da #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 +#define USB_VENDOR_ID_AASHIMA 0x06D6 +#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 + #define USB_VENDOR_ID_CYPRESS 0x04b4 #define USB_DEVICE_ID_CYPRESS_MOUSE0x0001 #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 @@ -1524,6 +1527,7 @@ static struct hid_blacklist { { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, + { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 06/24] sonypi: make sure input_work is not running when unloading
Sonypi: make sure that input_work is not running when unloading the module; submit/retrieve key release data into/from input_fifo in one shot. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/char/sonypi.c | 122 +- 1 files changed, 63 insertions(+), 59 deletions(-) Index: work/drivers/char/sonypi.c === --- work.orig/drivers/char/sonypi.c +++ work/drivers/char/sonypi.c @@ -439,6 +439,11 @@ static struct { { 0, 0 }, }; +struct sonypi_keypress { + struct input_dev *dev; + int key; +}; + static struct sonypi_device { struct pci_dev *dev; struct platform_device *pdev; @@ -710,22 +715,61 @@ static void sonypi_setbluetoothpower(u8 static void input_keyrelease(void *data) { - struct input_dev *input_dev; - int key; - - while (1) { - if (kfifo_get(sonypi_device.input_fifo, - (unsigned char *)input_dev, - sizeof(input_dev)) != sizeof(input_dev)) - return; - if (kfifo_get(sonypi_device.input_fifo, - (unsigned char *)key, - sizeof(key)) != sizeof(key)) - return; + struct sonypi_keypress kp; + while (kfifo_get(sonypi_device.input_fifo, (unsigned char *)kp, +sizeof(kp)) == sizeof(kp)) { msleep(10); - input_report_key(input_dev, key, 0); - input_sync(input_dev); + input_report_key(kp.dev, kp.key, 0); + input_sync(kp.dev); + } +} + +static void sonypi_report_input_event(u8 event) +{ + struct input_dev *jog_dev = sonypi_device.input_jog_dev; + struct input_dev *key_dev = sonypi_device.input_key_dev; + struct sonypi_keypress kp = { NULL }; + int i; + + switch (event) { + case SONYPI_EVENT_JOGDIAL_UP: + case SONYPI_EVENT_JOGDIAL_UP_PRESSED: + input_report_rel(jog_dev, REL_WHEEL, 1); + input_sync(jog_dev); + break; + + case SONYPI_EVENT_JOGDIAL_DOWN: + case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED: + input_report_rel(jog_dev, REL_WHEEL, -1); + input_sync(jog_dev); + break; + + case SONYPI_EVENT_JOGDIAL_PRESSED: + kp.key = BTN_MIDDLE; + kp.dev = jog_dev; + break; + + case SONYPI_EVENT_FNKEY_RELEASED: + /* Nothing, not all VAIOs generate this event */ + break; + + default: + for (i = 0; sonypi_inputkeys[i].sonypiev; i++) + if (event == sonypi_inputkeys[i].sonypiev) { + kp.dev = key_dev; + kp.key = sonypi_inputkeys[i].inputev; + break; + } + break; + } + + if (kp.dev) { + input_report_key(kp.dev, kp.key, 1); + input_sync(kp.dev); + kfifo_put(sonypi_device.input_fifo, + (unsigned char *)kp, sizeof(kp)); + schedule_work(sonypi_device.input_work); } } @@ -768,51 +812,8 @@ found: printk(KERN_INFO sonypi: event port1=0x%02x,port2=0x%02x\n, v1, v2); - if (useinput) { - struct input_dev *input_jog_dev = sonypi_device.input_jog_dev; - struct input_dev *input_key_dev = sonypi_device.input_key_dev; - switch (event) { - case SONYPI_EVENT_JOGDIAL_UP: - case SONYPI_EVENT_JOGDIAL_UP_PRESSED: - input_report_rel(input_jog_dev, REL_WHEEL, 1); - break; - case SONYPI_EVENT_JOGDIAL_DOWN: - case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED: - input_report_rel(input_jog_dev, REL_WHEEL, -1); - break; - case SONYPI_EVENT_JOGDIAL_PRESSED: { - int key = BTN_MIDDLE; - input_report_key(input_jog_dev, key, 1); - kfifo_put(sonypi_device.input_fifo, - (unsigned char *)input_jog_dev, - sizeof(input_jog_dev)); - kfifo_put(sonypi_device.input_fifo, - (unsigned char *)key, sizeof(key)); - break; - } - case SONYPI_EVENT_FNKEY_RELEASED: - /* Nothing, not all VAIOs generate this event */ - break; - } - input_sync(input_jog_dev); - - for (i = 0; sonypi_inputkeys[i].sonypiev; i++) { - int key
[patch 14/24] synaptics - limit rate on Toshiba Dynabooks
From: Simon Horman [EMAIL PROTECTED] Input: synaptics - limit rate to 40pps on Toshiba Dynabooks Toshiba Dynabooks require the same workaround as Satellites - Synaptics report rate should be lowered to 40pps (from 80), otherwise KBC starts losing keypresses. Signed-off-by: Simon Horman [EMAIL PROTECTED] Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/mouse/synaptics.c | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: work/drivers/input/mouse/synaptics.c === --- work.orig/drivers/input/mouse/synaptics.c +++ work/drivers/input/mouse/synaptics.c @@ -608,6 +608,13 @@ static struct dmi_system_id toshiba_dmi_ DMI_MATCH(DMI_PRODUCT_NAME , Satellite), }, }, + { + .ident = Toshiba Dynabook, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, TOSHIBA), + DMI_MATCH(DMI_PRODUCT_NAME , dynabook), + }, + }, { } }; #endif @@ -656,7 +663,8 @@ int synaptics_init(struct psmouse *psmou * thye same as rate of standard PS/2 mouse. */ if (psmouse-rate = 80 dmi_check_system(toshiba_dmi_table)) { - printk(KERN_INFO synaptics: Toshiba Satellite detected, limiting rate to 40pps.\n); + printk(KERN_INFO synaptics: Toshiba %s detected, limiting rate to 40pps.\n, + dmi_get_system_info(DMI_PRODUCT_NAME)); psmouse-rate = 40; } #endif - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 01/24] uinput: formatting, cleanup
Input: clean up uinput driver (formatting, extra braces) Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/misc/uinput.c | 81 +++- 1 files changed, 35 insertions(+), 46 deletions(-) Index: work/drivers/input/misc/uinput.c === --- work.orig/drivers/input/misc/uinput.c +++ work/drivers/input/misc/uinput.c @@ -36,16 +36,6 @@ #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; @@ -68,17 +58,20 @@ static int uinput_request_alloc_id(struc /* Atomically allocate an ID for the given request. Returns 0 on success. */ struct uinput_device *udev = dev-private; int id; + int err = -1; down(udev-requests_sem); - for (id=0; idUINPUT_NUM_REQUESTS; id++) + + for (id = 0; id UINPUT_NUM_REQUESTS; id++) if (!udev-requests[id]) { udev-requests[id] = request; request-id = id; - up(udev-requests_sem); - return 0; + err = 0; + break; } + up(udev-requests_sem); - return -1; + return err; } static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) @@ -101,7 +94,7 @@ static void uinput_request_init(struct i /* Allocate an ID. If none are available right away, wait. */ request-retval = wait_event_interruptible(udev-requests_waitq, - !uinput_request_alloc_id(dev, request)); + !uinput_request_alloc_id(dev, request)); } static void uinput_request_submit(struct input_dev *dev, struct uinput_request *request) @@ -159,32 +152,30 @@ static int uinput_create_device(struct u 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; udev-dev-private = udev; - init_waitqueue_head((udev-waitq)); + init_waitqueue_head(udev-waitq); input_register_device(udev-dev); - set_bit(UIST_CREATED, (udev-state)); + set_bit(UIST_CREATED, udev-state); return 0; } static int uinput_destroy_device(struct uinput_device *udev) { - if (!test_bit(UIST_CREATED, (udev-state))) { + if (!test_bit(UIST_CREATED, udev-state)) { printk(KERN_WARNING %s: create the device first\n, UINPUT_NAME); return -EINVAL; } input_unregister_device(udev-dev); - clear_bit(UIST_CREATED, (udev-state)); + clear_bit(UIST_CREATED, udev-state); return 0; } @@ -253,15 +244,15 @@ static int uinput_alloc_device(struct fi struct uinput_user_dev *user_dev; struct input_dev*dev; struct uinput_device*udev; - int size, - retval; + int size; + int retval; retval = count; udev = file-private_data; dev = udev-dev; - user_dev = kmalloc(sizeof(*user_dev), GFP_KERNEL); + user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); if (!user_dev) { retval = -ENOMEM; goto exit; @@ -272,7 +263,7 @@ static int uinput_alloc_device(struct fi goto exit; } - if (NULL != dev-name) + if (dev-name) kfree(dev-name); size = strnlen(user_dev-name, UINPUT_MAX_NAME_SIZE) + 1; @@ -314,14 +305,13 @@ static ssize_t uinput_write(struct file { struct uinput_device *udev = file-private_data; - if (test_bit(UIST_CREATED, (udev-state))) { + if (test_bit(UIST_CREATED, udev-state)) { 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 + } else count = uinput_alloc_device(file, buffer, count); return count; @@ -332,26 +322,24 @@ static ssize_t uinput_read(struct file * struct uinput_device *udev = file-private_data; int retval = 0; - if (!test_bit(UIST_CREATED, (udev-state))) + if (!test_bit(UIST_CREATED, udev-state)) return -ENODEV; - if ((udev-head == udev-tail) (file-f_flags O_NONBLOCK
[patch 21/24] psmouse: wheel mice always have middle button
From: Vojtech Pavlik [EMAIL PROTECTED] Input: psmouse - wheel mice (imps, exps) always have 3rd button There are wheel mice that respond to Logitech probes and report that they have only 2 buttons (such as e-Aser mouse) and this stops the wheel from being used as a middle button. Change the driver to always report BTN_MIDDLE capability if a wheel is present. Also, never reset BTN_RIGHT capability in logips2pp code - there are no Logitech mice that have only one button and if some other mice happen to respond to Logitech's query we could do the wrong thing. Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/mouse/logips2pp.c|2 -- drivers/input/mouse/psmouse-base.c |2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) Index: work/drivers/input/mouse/logips2pp.c === --- work.orig/drivers/input/mouse/logips2pp.c +++ work/drivers/input/mouse/logips2pp.c @@ -385,8 +385,6 @@ int ps2pp_init(struct psmouse *psmouse, if (buttons 3) clear_bit(BTN_MIDDLE, psmouse-dev.keybit); - if (buttons 2) - clear_bit(BTN_RIGHT, psmouse-dev.keybit); if (model_info) ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); Index: work/drivers/input/mouse/psmouse-base.c === --- work.orig/drivers/input/mouse/psmouse-base.c +++ work/drivers/input/mouse/psmouse-base.c @@ -344,6 +344,7 @@ static int intellimouse_detect(struct ps return -1; if (set_properties) { + set_bit(BTN_MIDDLE, psmouse-dev.keybit); set_bit(REL_WHEEL, psmouse-dev.relbit); if (!psmouse-vendor) psmouse-vendor = Generic; @@ -376,6 +377,7 @@ static int im_explorer_detect(struct psm return -1; if (set_properties) { + set_bit(BTN_MIDDLE, psmouse-dev.keybit); set_bit(REL_WHEEL, psmouse-dev.relbit); set_bit(BTN_SIDE, psmouse-dev.keybit); set_bit(BTN_EXTRA, psmouse-dev.keybit); - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 22/24] i8042 - dont use negation in i8042_command()
Input: i8042 - don't use negation to mark AUX data Currently i8042_command() negates data coming from the AUX port of keyboard controller; this is not a very reliable indicator. Change i8042_command() to fail if response to I8042_CMD_AUX_LOOP is not coming from AUX channel and get rid of negation. Based on patch by Vojtech Pavlik. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/serio/i8042.c | 62 +++- 1 files changed, 33 insertions(+), 29 deletions(-) Index: work/drivers/input/serio/i8042.c === --- work.orig/drivers/input/serio/i8042.c +++ work/drivers/input/serio/i8042.c @@ -100,7 +100,7 @@ struct i8042_port { static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { { .disable= I8042_CTR_KBDDIS, - .irqen = I8042_CTR_KBDINT, + .irqen = I8042_CTR_KBDINT, .mux= -1, .name = KBD, }, @@ -191,41 +191,45 @@ static int i8042_flush(void) static int i8042_command(unsigned char *param, int command) { unsigned long flags; - int retval = 0, i = 0; + int i, retval, auxerr = 0; if (i8042_noloop command == I8042_CMD_AUX_LOOP) return -1; spin_lock_irqsave(i8042_lock, flags); - retval = i8042_wait_write(); - if (!retval) { - dbg(%02x - i8042 (command), command 0xff); - i8042_write_command(command 0xff); - } + if ((retval = i8042_wait_write())) + goto out; - if (!retval) - for (i = 0; i ((command 12) 0xf); i++) { - if ((retval = i8042_wait_write())) break; - dbg(%02x - i8042 (parameter), param[i]); - i8042_write_data(param[i]); - } + dbg(%02x - i8042 (command), command 0xff); + i8042_write_command(command 0xff); - if (!retval) - for (i = 0; i ((command 8) 0xf); i++) { - if ((retval = i8042_wait_read())) break; - if (i8042_read_status() I8042_STR_AUXDATA) - param[i] = ~i8042_read_data(); - else - param[i] = i8042_read_data(); - dbg(%02x - i8042 (return), param[i]); + for (i = 0; i ((command 12) 0xf); i++) { + if ((retval = i8042_wait_write())) + goto out; + dbg(%02x - i8042 (parameter), param[i]); + i8042_write_data(param[i]); + } + + for (i = 0; i ((command 8) 0xf); i++) { + if ((retval = i8042_wait_read())) + goto out; + + if (command == I8042_CMD_AUX_LOOP + !(i8042_read_status() I8042_STR_AUXDATA)) { + retval = auxerr = -1; + goto out; } - spin_unlock_irqrestore(i8042_lock, flags); + param[i] = i8042_read_data(); + dbg(%02x - i8042 (return), param[i]); + } if (retval) - dbg( -- i8042 (timeout)); + dbg( -- i8042 (%s), auxerr ? auxerr : timeout); + out: + spin_unlock_irqrestore(i8042_lock, flags); return retval; } @@ -507,17 +511,17 @@ static int i8042_set_mux_mode(unsigned i */ param = 0xf0; - if (i8042_command(param, I8042_CMD_AUX_LOOP) || param != 0x0f) + if (i8042_command(param, I8042_CMD_AUX_LOOP) || param != 0xf0) return -1; param = mode ? 0x56 : 0xf6; - if (i8042_command(param, I8042_CMD_AUX_LOOP) || param != (mode ? 0xa9 : 0x09)) + if (i8042_command(param, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6)) return -1; param = mode ? 0xa4 : 0xa5; - if (i8042_command(param, I8042_CMD_AUX_LOOP) || param == (mode ? 0x5b : 0x5a)) + if (i8042_command(param, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5)) return -1; if (mux_version) - *mux_version = ~param; + *mux_version = param; return 0; } @@ -619,7 +623,7 @@ static int __init i8042_check_aux(void) */ param = 0x5a; - if (i8042_command(param, I8042_CMD_AUX_LOOP) || param != 0xa5) { + if (i8042_command(param, I8042_CMD_AUX_LOOP) || param != 0x5a) { /* * External connection test - filters out AT-soldered PS/2 i8042's @@ -630,7 +634,7 @@ static int __init i8042_check_aux(void) */ if (i8042_command(param, I8042_CMD_AUX_TEST) - || (param param != 0xfa param != 0xff)) + || (param param != 0xfa param != 0xff)) return -1; } - To unsubscribe from this list: send the line
[patch 07/24] input: rearrange procfs code
Input: rearrange procfs code to reduce number of #ifdefs Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/input.c | 389 +- 1 files changed, 198 insertions(+), 191 deletions(-) Index: work/drivers/input/input.c === --- work.orig/drivers/input/input.c +++ work/drivers/input/input.c @@ -48,12 +48,6 @@ static LIST_HEAD(input_handler_list); static struct input_handler *input_table[8]; -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry *proc_bus_input_dir; -static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait); -static int input_devices_state; -#endif - void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { struct input_handle *handle; @@ -312,6 +306,7 @@ static struct input_device_id *input_mat return NULL; } + /* * Input hotplugging interface - loading event handlers based on * device bitfields. @@ -428,6 +423,177 @@ static void input_call_hotplug(char *ver #endif +#ifdef CONFIG_PROC_FS + +static struct proc_dir_entry *proc_bus_input_dir; +static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait); +static int input_devices_state; + +static inline void input_wakeup_procfs_readers(void) +{ + input_devices_state++; + wake_up(input_devices_poll_wait); +} + +static unsigned int input_devices_poll(struct file *file, poll_table *wait) +{ + int state = input_devices_state; + poll_wait(file, input_devices_poll_wait, wait); + if (state != input_devices_state) + return POLLIN | POLLRDNORM; + return 0; +} + +#define SPRINTF_BIT_B(bit, name, max) \ + do { \ + len += sprintf(buf + len, B: %s, name); \ + for (i = NBITS(max) - 1; i = 0; i--) \ + if (dev-bit[i]) break; \ + for (; i = 0; i--) \ + len += sprintf(buf + len, %lx , dev-bit[i]); \ + len += sprintf(buf + len, \n); \ + } while (0) + +#define SPRINTF_BIT_B2(bit, name, max, ev) \ + do { \ + if (test_bit(ev, dev-evbit)) \ + SPRINTF_BIT_B(bit, name, max); \ + } while (0) + +static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) +{ + struct input_dev *dev; + struct input_handle *handle; + + off_t at = 0; + int i, len, cnt = 0; + + list_for_each_entry(dev, input_dev_list, node) { + + len = sprintf(buf, I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n, + dev-id.bustype, dev-id.vendor, dev-id.product, dev-id.version); + + len += sprintf(buf + len, N: Name=\%s\\n, dev-name ? dev-name : ); + len += sprintf(buf + len, P: Phys=%s\n, dev-phys ? dev-phys : ); + len += sprintf(buf + len, H: Handlers=); + + list_for_each_entry(handle, dev-h_list, d_node) + len += sprintf(buf + len, %s , handle-name); + + len += sprintf(buf + len, \n); + + SPRINTF_BIT_B(evbit, EV=, EV_MAX); + SPRINTF_BIT_B2(keybit, KEY=, KEY_MAX, EV_KEY); + SPRINTF_BIT_B2(relbit, REL=, REL_MAX, EV_REL); + SPRINTF_BIT_B2(absbit, ABS=, ABS_MAX, EV_ABS); + SPRINTF_BIT_B2(mscbit, MSC=, MSC_MAX, EV_MSC); + SPRINTF_BIT_B2(ledbit, LED=, LED_MAX, EV_LED); + SPRINTF_BIT_B2(sndbit, SND=, SND_MAX, EV_SND); + SPRINTF_BIT_B2(ffbit, FF=, FF_MAX, EV_FF); + + len += sprintf(buf + len, \n); + + at += len; + + if (at = pos) { + if (!*start) { + *start = buf + (pos - (at - len)); + cnt = at - pos; + } else cnt += len; + buf += len; + if (cnt = count) + break; + } + } + + if (dev-node == input_dev_list) + *eof = 1; + + return (count cnt) ? cnt : count; +} + +static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) +{ + struct input_handler *handler; + + off_t at = 0; + int len = 0, cnt = 0; + int i = 0; + + list_for_each_entry(handler, input_handler_list, node) { + + if (handler-fops) + len = sprintf(buf, N: Number=%d Name=%s Minor=%d\n, + i++, handler-name, handler-minor); + else + len = sprintf(buf, N: Number=%d Name=%s\n, + i++, handler-name); + + at += len; + + if (at = pos) { + if (!*start) { + *start = buf + (pos - (at - len
[patch 18/24] joydev - remove MSECS macro
From: Tobias Klauser [EMAIL PROTECTED] Input: joydev - remove custom conversion from jiffies to msecs Replace the MSECS() macro with the jiffies_to_msecs() function provided in jiffies.h Signed-off-by: Tobias Klauser [EMAIL PROTECTED] Signed-off-by: Domen Puncer [EMAIL PROTECTED] Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/joydev.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) Index: work/drivers/input/joydev.c === --- work.orig/drivers/input/joydev.c +++ work/drivers/input/joydev.c @@ -37,8 +37,6 @@ MODULE_LICENSE(GPL); #define JOYDEV_MINORS 16 #define JOYDEV_BUFFER_SIZE 64 -#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) - struct joydev { int exist; int open; @@ -117,7 +115,7 @@ static void joydev_event(struct input_ha return; } - event.time = MSECS(jiffies); + event.time = jiffies_to_msecs(jiffies); list_for_each_entry(list, joydev-list, node) { @@ -245,7 +243,7 @@ static ssize_t joydev_read(struct file * struct js_event event; - event.time = MSECS(jiffies); + event.time = jiffies_to_msecs(jiffies); if (list-startup joydev-nkey) { event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 00/24] Input patches for 2.6.13
Hi Vojtech, I have a bunch of changes for input subsystem I would like to get in. Half of the stuff is patches I picked from your quilt tree (ALPS dualpoint resume fix, ALPS tapping mode, couple HID changes, etc) plus some of my changes (usb_to_input_id, small acecad cleanup, add modalias for serio bus, couple of input cleanups). The full changelog is at the end of the mail. Could you please bless these for Linus to pull: git pull rsync://rsync.kernel.org/pub/scm/linux/kernel/git/dtor/input.git Thanks! -- Dmitry Changelog: == author Sergey Vlasov [EMAIL PROTECTED] Sun, 24 Jul 2005 10:53:32 -0500 Input: synaptics - fix setting packet size on passthrough port. Synaptics driver used child-type to select either 3-byte or 4-byte packet size for the pass-through port; this gives wrong results for the newer protocols. Change the check to use child-pktsize instead. Signed-off-by: Sergey Vlasov [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Vojtech Pavlik [EMAIL PROTECTED] Sun, 24 Jul 2005 10:50:03 -0500 Input: check keycodesize when adjusting keymaps When changing key mappings we need to make sure that the new keycode value can be stored in dev-keycodesize bytes. Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Dmitry Torokhov [EMAIL PROTECTED] Fri, 15 Jul 2005 11:51:56 -0500 Input: i8042 - don't use negation to mark AUX data Currently i8042_command() negates data coming from the AUX port of keyboard controller; this is not a very reliable indicator. Change i8042_command() to fail if response to I8042_CMD_AUX_LOOP is not coming from AUX channel and get rid of negation. Based on patch by Vojtech Pavlik. Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Vojtech Pavlik [EMAIL PROTECTED] Fri, 15 Jul 2005 11:50:08 -0500 Input: psmouse - wheel mice (imps, exps) always have 3rd button There are wheel mice that respond to Logitech probes and report that they have only 2 buttons (such as e-Aser mouse) and this stops the wheel from being used as a middle button. Change the driver to always report BTN_MIDDLE capability if a wheel is present. Also, never reset BTN_RIGHT capability in logips2pp code - there are no Logitech mice that have only one button and if some other mice happen to respond to Logitech's query we could do the wrong thing. Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Adam Kropelin [EMAIL PROTECTED] Mon, 11 Jul 2005 11:09:32 -0500 Input: HID - only report events coming from interrupts to hiddev Currently hid-core follows the same code path for input reports regardless of whether they are a result of interrupt transfers or control transfers. That leads to interrupt events erroneously being reported to hiddev for regular control transfers. Prior to 2.6.12 the problem was mitigated by the fact that reporting to hiddev is supressed if the field value has not changed, which is often the case. Said filtering was removed in 2.6.12-rc1 which means any input reports fetched via control transfers result in hiddev interrupt events. This behavior can quickly lead to a feedback loop where a userspace app, in response to interrupt events, issues control transfers which in turn create more interrupt events. This patch prevents input reports that arrive via control transfers from being reported to hiddev as interrupt events. Signed-off-by: Adam Kropelin [EMAIL PROTECTED] Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Michael Prokop [EMAIL PROTECTED] Mon, 11 Jul 2005 11:09:10 -0500 Input: elo - fix help in Kconfig (wrong module name) Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Tobias Klauser [EMAIL PROTECTED] Mon, 11 Jul 2005 11:08:56 -0500 Input: joydev - remove custom conversion from jiffies to msecs Replace the MSECS() macro with the jiffies_to_msecs() function provided in jiffies.h Signed-off-by: Tobias Klauser [EMAIL PROTECTED] Signed-off-by: Domen Puncer [EMAIL PROTECTED] Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Luca T [EMAIL PROTECTED] Mon, 11 Jul 2005 11:08:40 -0500 Input: HID - add a quirk for Aashima Trust (06d6:0025) gamepad Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] -- author Peter Osterlund [EMAIL PROTECTED] Mon, 11 Jul 2005 11:08:04 -0500 Input: ALPS - unconditionally enable tapping mode The condition in alps_init() was also inverted and the driver was enabling tapping mode only if it was already enabled. Signed-off-by: Peter Osterlund [EMAIL PROTECTED] Signed-off
[patch 24/24] Synaptics - fix setting packet size on passthrough port
From: Sergey Vlasov [EMAIL PROTECTED] Input: synaptics - fix setting packet size on passthrough port. Synaptics driver used child-type to select either 3-byte or 4-byte packet size for the pass-through port; this gives wrong results for the newer protocols. Change the check to use child-pktsize instead. Signed-off-by: Sergey Vlasov [EMAIL PROTECTED] Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED] --- drivers/input/mouse/synaptics.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: work/drivers/input/mouse/synaptics.c === --- work.orig/drivers/input/mouse/synaptics.c +++ work/drivers/input/mouse/synaptics.c @@ -219,7 +219,7 @@ static void synaptics_pass_pt_packet(str serio_interrupt(ptport, packet[1], 0, NULL); serio_interrupt(ptport, packet[4], 0, NULL); serio_interrupt(ptport, packet[5], 0, NULL); - if (child-type = PSMOUSE_GENPS) + if (child-pktsize == 4) serio_interrupt(ptport, packet[2], 0, NULL); } else serio_interrupt(ptport, packet[1], 0, NULL); @@ -233,7 +233,7 @@ static void synaptics_pt_activate(struct /* adjust the touchpad to child's choice of protocol */ if (child) { - if (child-type = PSMOUSE_GENPS) + if (child-pktsize == 4) priv-mode |= SYN_BIT_FOUR_BYTE_CLIENT; else priv-mode = ~SYN_BIT_FOUR_BYTE_CLIENT; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
On 7/25/05, Jon Smirl [EMAIL PROTECTED] wrote: On 7/25/05, Dmitry Torokhov [EMAIL PROTECTED] wrote: On Sunday 24 July 2005 23:09, Jon Smirl wrote: I just pulled from GIT to test bind/unbind. I couldn't get it to work; it isn't taking into account the CR on the end of the input value of the sysfs attribute. This patch will fix it but I'm sure there is a cleaner solution. echo -n should take care of this problem I think. That will work around it but I think we should fix it. Changing to strncmp() fixes most cases. - if (strcmp(name, dev-bus_id) == 0) + if (strncmp(name, dev-bus_id, strlen(dev-bus_id)) == 0) This will produce interesting results if you have both blah-1 and blah-10 devices on the bus. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/2] Touchscreen support for sharp sl-5500
Hi Pavel, On 7/24/05, Pavel Machek [EMAIL PROTECTED] wrote: I have made quite a lot of cleanups to touchscreen part, and it seems to be acceptable by input people. I think it should go into drivers/input/touchscreen/collie_ts.c... Also it looks to me like mcp.h should go into asm/arch-sa1100, so that other drivers can use it... I have couple of nitpicks (below) and one bigger concern - I am surprised that a driver for a physical device is implemented as an interface to a class device. This precludes implementing any kind of power management in the driver and pushes it into the parent and is generally speaking is a wrong thing to do (IMHO). If the problem is that you have a single piece of hardware you need to bind several drivers to - I guess you will have to create a new sub-device bus for that. Or just register sub-devices on the same bus the parent device is registered on - I am not sure what is best in this particular case - I am not familiar with the arch. It is my understanding that the purpose of interfaces to to present different views to userspace and therefore they are not quie suited for what you are trying to do... +static int ucb1x00_thread(void *_ts) +{ + struct ucb1x00_ts *ts = _ts; + struct task_struct *tsk = current; + int valid; + + ts-rtask = tsk; Just move that assignment into ucb1x00_input_open and kill all this current stuff. + + /* +* We run as a real-time thread. However, thus far +* this doesn't seem to be necessary. +*/ + tsk-policy = SCHED_FIFO; + tsk-rt_priority = 1; + + valid = 0; + for (;;) { Can we change this to while (!kthread_should_stop()) to make me completely happy? Thanks! -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/2] Touchscreen support for sharp sl-5500
On 7/25/05, Russell King [EMAIL PROTECTED] wrote: On Mon, Jul 25, 2005 at 10:16:05AM -0500, Dmitry Torokhov wrote: If the problem is that you have a single piece of hardware you need to bind several drivers to - I guess you will have to create a new sub-device bus for that. Or just register sub-devices on the same bus the parent device is registered on - I am not sure what is best in this particular case - I am not familiar with the arch. That is exactly the problem - these kinds of devices do _not_ fit well into the device model. A struct device for every different possible sub-unit is completely overkill. For instance, you may logically use one ADC and some GPIO lines on the device for X and something else for Y and they logically end up in different drivers. The problem is that the parent doesn't actually know how many devices to create nor what to call them, and they're logically indistinguishable from each other so there's no logical naming system. Then we should probably not try to force them into driver model. Have parent device register struct device and when sub-drivers register they could attach class devices (like input devices) directly to the main device thus hiding presence of sub-sections of the chip from sysfs completely. My point is that we should not be using class_interface here - its purpose is diferent. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/2] Touchscreen support for sharp sl-5500
On 7/25/05, Russell King [EMAIL PROTECTED] wrote: On Mon, Jul 25, 2005 at 11:02:43AM -0500, Dmitry Torokhov wrote: On 7/25/05, Russell King [EMAIL PROTECTED] wrote: On Mon, Jul 25, 2005 at 10:16:05AM -0500, Dmitry Torokhov wrote: If the problem is that you have a single piece of hardware you need to bind several drivers to - I guess you will have to create a new sub-device bus for that. Or just register sub-devices on the same bus the parent device is registered on - I am not sure what is best in this particular case - I am not familiar with the arch. That is exactly the problem - these kinds of devices do _not_ fit well into the device model. A struct device for every different possible sub-unit is completely overkill. For instance, you may logically use one ADC and some GPIO lines on the device for X and something else for Y and they logically end up in different drivers. The problem is that the parent doesn't actually know how many devices to create nor what to call them, and they're logically indistinguishable from each other so there's no logical naming system. Then we should probably not try to force them into driver model. Have parent device register struct device and when sub-drivers register they could attach class devices (like input devices) directly to the main device thus hiding presence of sub-sections of the chip from sysfs completely. My point is that we should not be using class_interface here - its purpose is diferent. If you look at _my_ version, you'll notice that it doesn't use the class interface stuff. A previous version of it did, and this seems to be what the collie stuff is based upon. I was only commenting on something that was posted on LKML for inclusion into input subtree that I am interested in. I don't track ARM development that closely. Where can we see your version, please? What I suggest is that the collie folk need to update their driver to my version so that we don't have two different forks of the same driver in existance. Then we can start discussing whether things should be using kthreads or not. Do you have any reason why, generally speaking, threads should not be used? They seem to clean up code in drivers quite a bit. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Problem with Asus P4C800-DX and P4 -Northwood-
On 7/25/05, Andreas Baer [EMAIL PROTECTED] wrote: Here I have /dev/hda: 26.91 MB/sec /dev/hda1: 26.90 MB/sec(Windows FAT32) /dev/hda7: 17.89 MB/sec(Linux EXT3) Could you give me a reason how this is possible? a reason for what ? the fact that the notebook performs faster than the desktop while slower on I/O ? No, a reason why the partition with Linux (ReiserFS or Ext3) is always slower than the Windows partition? Because of geometry issues hard drive can't not deliver constant data rate off the plates. Your windows partition is on faster part of the drive. -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace
On Monday 25 July 2005 22:15, Jon Smirl wrote: + while( isspace(*x) (x - buffer-page count)) + x++; + + /* locate trailng white space */ + z = y = x; + while (y - buffer-page count) { + y++; + z = y; + while( isspace(*y) (y - buffer-page count)) { + y++; Can we have consistent space vs. paren placement, pretty please? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: kernel guide to space (updated)
On 7/28/05, Michael S. Tsirkin [EMAIL PROTECTED] wrote: 9. The following is helpful with VIM set cinoptions=(0:0 And this will highlight whitespace damage: highlight RedundantSpaces ctermbg=red guibg=red match RedundantSpaces /\s\+$\| \+\ze\t/ -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: alsa es1371's joystick functionality broken in 2.6.11-mm4
On Wednesday 20 April 2005 20:42, Patrick McFarland wrote: On Wednesday 20 April 2005 12:47 am, Patrick McFarland wrote: I just tested 2.6.6, it seems to be broken too. I wonder if this actually is a kernel issue, I should have found a working kernel by now. I'll continue to 2.6.5. I just tried 2.6.5 and 2.6.4. No go. Only 3 kernels left. Are you testing with sidewinder? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: alsa es1371's joystick functionality broken in 2.6.11-mm4
On Wednesday 20 April 2005 21:21, Patrick McFarland wrote: On Wednesday 20 April 2005 10:12 pm, Dmitry Torokhov wrote: On Wednesday 20 April 2005 20:42, Patrick McFarland wrote: On Wednesday 20 April 2005 12:47 am, Patrick McFarland wrote: I just tested 2.6.6, it seems to be broken too. I wonder if this actually is a kernel issue, I should have found a working kernel by now. I'll continue to 2.6.5. I just tried 2.6.5 and 2.6.4. No go. Only 3 kernels left. Are you testing with sidewinder? I test both my analog and sidewinders. Not that it matters, my analog is the one I had first, I only got the sidewinder recently. Ok... I know that sidewinder needs its timeouts increased to about 6ms to work with 2.6. Have you tried OSS driver - to make sure that layer above the soundcard works? -- Dmitry - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/