···11151115 See Documentation/ramdisk.txt.1116111611171117 psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to11181118- probe for (bare|imps|exps).11181118+ probe for (bare|imps|exps|lifebook|any).11191119 psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports11201120 per second.11211121 psmouse.resetafter=
+337-90
drivers/input/evdev.c
···2121#include <linux/smp_lock.h>2222#include <linux/device.h>2323#include <linux/devfs_fs_kernel.h>2424+#include <linux/compat.h>24252526struct evdev {2627 int exist;···146145 return 0;147146}148147148148+#ifdef CONFIG_COMPAT149149+struct input_event_compat {150150+ struct compat_timeval time;151151+ __u16 type;152152+ __u16 code;153153+ __s32 value;154154+};155155+156156+#ifdef CONFIG_X86_64157157+# define COMPAT_TEST test_thread_flag(TIF_IA32)158158+#elif defined(CONFIG_IA64)159159+# define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current))160160+#elif defined(CONFIG_ARCH_S390)161161+# define COMPAT_TEST test_thread_flag(TIF_31BIT)162162+#else163163+# define COMPAT_TEST test_thread_flag(TIF_32BIT)164164+#endif165165+166166+static ssize_t evdev_write_compat(struct file * file, const char __user * buffer, size_t count, loff_t *ppos)167167+{168168+ struct evdev_list *list = file->private_data;169169+ struct input_event_compat event;170170+ int retval = 0;171171+172172+ while (retval < count) {173173+ if (copy_from_user(&event, buffer + retval, sizeof(struct input_event_compat)))174174+ return -EFAULT;175175+ input_event(list->evdev->handle.dev, event.type, event.code, event.value);176176+ retval += sizeof(struct input_event_compat);177177+ }178178+179179+ return retval;180180+}181181+#endif182182+149183static ssize_t evdev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos)150184{151185 struct evdev_list *list = file->private_data;···188152 int retval = 0;189153190154 if (!list->evdev->exist) return -ENODEV;155155+156156+#ifdef CONFIG_COMPAT157157+ if (COMPAT_TEST)158158+ return evdev_write_compat(file, buffer, count, ppos);159159+#endif191160192161 while (retval < count) {193162···205164 return retval;206165}207166167167+#ifdef CONFIG_COMPAT168168+static ssize_t evdev_read_compat(struct file * file, char __user * buffer, size_t count, loff_t *ppos)169169+{170170+ struct evdev_list *list = file->private_data;171171+ int retval;172172+173173+ if (count < sizeof(struct input_event_compat))174174+ return -EINVAL;175175+176176+ if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK))177177+ return -EAGAIN;178178+179179+ retval = wait_event_interruptible(list->evdev->wait,180180+ list->head != list->tail || (!list->evdev->exist));181181+182182+ if (retval)183183+ return retval;184184+185185+ if (!list->evdev->exist)186186+ return -ENODEV;187187+188188+ while (list->head != list->tail && retval + sizeof(struct input_event_compat) <= count) {189189+ struct input_event *event = (struct input_event *) list->buffer + list->tail;190190+ struct input_event_compat event_compat;191191+ event_compat.time.tv_sec = event->time.tv_sec;192192+ event_compat.time.tv_usec = event->time.tv_usec;193193+ event_compat.type = event->type;194194+ event_compat.code = event->code;195195+ event_compat.value = event->value;196196+197197+ if (copy_to_user(buffer + retval, &event_compat,198198+ sizeof(struct input_event_compat))) return -EFAULT;199199+ list->tail = (list->tail + 1) & (EVDEV_BUFFER_SIZE - 1);200200+ retval += sizeof(struct input_event_compat);201201+ }202202+203203+ return retval;204204+}205205+#endif206206+208207static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos)209208{210209 struct evdev_list *list = file->private_data;211210 int retval;211211+212212+#ifdef CONFIG_COMPAT213213+ if (COMPAT_TEST)214214+ return evdev_read_compat(file, buffer, count, ppos);215215+#endif212216213217 if (count < sizeof(struct input_event))214218 return -EINVAL;···272186273187 while (list->head != list->tail && retval + sizeof(struct input_event) <= count) {274188 if (copy_to_user(buffer + retval, list->buffer + list->tail,275275- sizeof(struct input_event))) return -EFAULT;189189+ sizeof(struct input_event))) return -EFAULT;276190 list->tail = (list->tail + 1) & (EVDEV_BUFFER_SIZE - 1);277191 retval += sizeof(struct input_event);278192 }···289203 (list->evdev->exist ? 0 : (POLLHUP | POLLERR));290204}291205292292-static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)206206+static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)293207{294208 struct evdev_list *list = file->private_data;295209 struct evdev *evdev = list->evdev;···371285372286 default:373287374374- if (_IOC_TYPE(cmd) != 'E' || _IOC_DIR(cmd) != _IOC_READ)288288+ if (_IOC_TYPE(cmd) != 'E')375289 return -EINVAL;376290377377- if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0,0))) {291291+ if (_IOC_DIR(cmd) == _IOC_READ) {378292379379- long *bits;380380- int len;293293+ if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0,0))) {381294382382- switch (_IOC_NR(cmd) & EV_MAX) {383383- case 0: bits = dev->evbit; len = EV_MAX; break;384384- case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;385385- case EV_REL: bits = dev->relbit; len = REL_MAX; break;386386- case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;387387- case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break;388388- case EV_LED: bits = dev->ledbit; len = LED_MAX; break;389389- case EV_SND: bits = dev->sndbit; len = SND_MAX; break;390390- case EV_FF: bits = dev->ffbit; len = FF_MAX; break;391391- default: return -EINVAL;295295+ long *bits;296296+ int len;297297+298298+ switch (_IOC_NR(cmd) & EV_MAX) {299299+ case 0: bits = dev->evbit; len = EV_MAX; break;300300+ case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;301301+ case EV_REL: bits = dev->relbit; len = REL_MAX; break;302302+ case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;303303+ case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break;304304+ case EV_LED: bits = dev->ledbit; len = LED_MAX; break;305305+ case EV_SND: bits = dev->sndbit; len = SND_MAX; break;306306+ case EV_FF: bits = dev->ffbit; len = FF_MAX; break;307307+ default: return -EINVAL;308308+ }309309+ len = NBITS(len) * sizeof(long);310310+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);311311+ return copy_to_user(p, bits, len) ? -EFAULT : len;392312 }393393- len = NBITS(len) * sizeof(long);394394- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);395395- return copy_to_user(p, bits, len) ? -EFAULT : len;313313+314314+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0))) {315315+ int len;316316+ len = NBITS(KEY_MAX) * sizeof(long);317317+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);318318+ return copy_to_user(p, dev->key, len) ? -EFAULT : len;319319+ }320320+321321+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGLED(0))) {322322+ int len;323323+ len = NBITS(LED_MAX) * sizeof(long);324324+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);325325+ return copy_to_user(p, dev->led, len) ? -EFAULT : len;326326+ }327327+328328+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSND(0))) {329329+ int len;330330+ len = NBITS(SND_MAX) * sizeof(long);331331+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);332332+ return copy_to_user(p, dev->snd, len) ? -EFAULT : len;333333+ }334334+335335+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) {336336+ int len;337337+ if (!dev->name) return -ENOENT;338338+ len = strlen(dev->name) + 1;339339+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);340340+ return copy_to_user(p, dev->name, len) ? -EFAULT : len;341341+ }342342+343343+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0))) {344344+ int len;345345+ if (!dev->phys) return -ENOENT;346346+ len = strlen(dev->phys) + 1;347347+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);348348+ return copy_to_user(p, dev->phys, len) ? -EFAULT : len;349349+ }350350+351351+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGUNIQ(0))) {352352+ int len;353353+ if (!dev->uniq) return -ENOENT;354354+ len = strlen(dev->uniq) + 1;355355+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);356356+ return copy_to_user(p, dev->uniq, len) ? -EFAULT : len;357357+ }358358+359359+ if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {360360+361361+ int t = _IOC_NR(cmd) & ABS_MAX;362362+363363+ abs.value = dev->abs[t];364364+ abs.minimum = dev->absmin[t];365365+ abs.maximum = dev->absmax[t];366366+ abs.fuzz = dev->absfuzz[t];367367+ abs.flat = dev->absflat[t];368368+369369+ if (copy_to_user(p, &abs, sizeof(struct input_absinfo)))370370+ return -EFAULT;371371+372372+ return 0;373373+ }374374+396375 }397376398398- if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0))) {399399- int len;400400- len = NBITS(KEY_MAX) * sizeof(long);401401- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);402402- return copy_to_user(p, dev->key, len) ? -EFAULT : len;403403- }377377+ if (_IOC_DIR(cmd) == _IOC_WRITE) {404378405405- if (_IOC_NR(cmd) == _IOC_NR(EVIOCGLED(0))) {406406- int len;407407- len = NBITS(LED_MAX) * sizeof(long);408408- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);409409- return copy_to_user(p, dev->led, len) ? -EFAULT : len;410410- }379379+ if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {411380412412- if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSND(0))) {413413- int len;414414- len = NBITS(SND_MAX) * sizeof(long);415415- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);416416- return copy_to_user(p, dev->snd, len) ? -EFAULT : len;417417- }381381+ int t = _IOC_NR(cmd) & ABS_MAX;418382419419- if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) {420420- int len;421421- if (!dev->name) return -ENOENT;422422- len = strlen(dev->name) + 1;423423- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);424424- return copy_to_user(p, dev->name, len) ? -EFAULT : len;425425- }383383+ if (copy_from_user(&abs, p, sizeof(struct input_absinfo)))384384+ return -EFAULT;426385427427- if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0))) {428428- int len;429429- if (!dev->phys) return -ENOENT;430430- len = strlen(dev->phys) + 1;431431- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);432432- return copy_to_user(p, dev->phys, len) ? -EFAULT : len;433433- }386386+ dev->abs[t] = abs.value;387387+ dev->absmin[t] = abs.minimum;388388+ dev->absmax[t] = abs.maximum;389389+ dev->absfuzz[t] = abs.fuzz;390390+ dev->absflat[t] = abs.flat;434391435435- if (_IOC_NR(cmd) == _IOC_NR(EVIOCGUNIQ(0))) {436436- int len;437437- if (!dev->uniq) return -ENOENT;438438- len = strlen(dev->uniq) + 1;439439- if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);440440- return copy_to_user(p, dev->uniq, len) ? -EFAULT : len;441441- }442442-443443- if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {444444-445445- int t = _IOC_NR(cmd) & ABS_MAX;446446-447447- abs.value = dev->abs[t];448448- abs.minimum = dev->absmin[t];449449- abs.maximum = dev->absmax[t];450450- abs.fuzz = dev->absfuzz[t];451451- abs.flat = dev->absflat[t];452452-453453- if (copy_to_user(p, &abs, sizeof(struct input_absinfo)))454454- return -EFAULT;455455-456456- return 0;457457- }458458-459459- if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {460460-461461- int t = _IOC_NR(cmd) & ABS_MAX;462462-463463- if (copy_from_user(&abs, p, sizeof(struct input_absinfo)))464464- return -EFAULT;465465-466466- dev->abs[t] = abs.value;467467- dev->absmin[t] = abs.minimum;468468- dev->absmax[t] = abs.maximum;469469- dev->absfuzz[t] = abs.fuzz;470470- dev->absflat[t] = abs.flat;471471-472472- return 0;392392+ return 0;393393+ }473394 }474395 }475396 return -EINVAL;476397}398398+399399+#ifdef CONFIG_COMPAT400400+401401+#define BITS_PER_LONG_COMPAT (sizeof(compat_long_t) * 8)402402+#define NBITS_COMPAT(x) ((((x)-1)/BITS_PER_LONG_COMPAT)+1)403403+#define OFF_COMPAT(x) ((x)%BITS_PER_LONG_COMPAT)404404+#define BIT_COMPAT(x) (1UL<<OFF_COMPAT(x))405405+#define LONG_COMPAT(x) ((x)/BITS_PER_LONG_COMPAT)406406+#define test_bit_compat(bit, array) ((array[LONG_COMPAT(bit)] >> OFF_COMPAT(bit)) & 1)407407+408408+#ifdef __BIG_ENDIAN409409+#define bit_to_user(bit, max) \410410+do { \411411+ int i; \412412+ int len = NBITS_COMPAT((max)) * sizeof(compat_long_t); \413413+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); \414414+ for (i = 0; i < len / sizeof(compat_long_t); i++) \415415+ if (copy_to_user((compat_long_t*) p + i, \416416+ (compat_long_t*) (bit) + i + 1 - ((i % 2) << 1), \417417+ sizeof(compat_long_t))) \418418+ return -EFAULT; \419419+ return len; \420420+} while (0)421421+#else422422+#define bit_to_user(bit, max) \423423+do { \424424+ int len = NBITS_COMPAT((max)) * sizeof(compat_long_t); \425425+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); \426426+ return copy_to_user(p, (bit), len) ? -EFAULT : len; \427427+} while (0)428428+#endif429429+430430+static long evdev_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)431431+{432432+ struct evdev_list *list = file->private_data;433433+ struct evdev *evdev = list->evdev;434434+ struct input_dev *dev = evdev->handle.dev;435435+ struct input_absinfo abs;436436+ void __user *p = compat_ptr(arg);437437+438438+ if (!evdev->exist) return -ENODEV;439439+440440+ switch (cmd) {441441+442442+ case EVIOCGVERSION:443443+ case EVIOCGID:444444+ case EVIOCGKEYCODE:445445+ case EVIOCSKEYCODE:446446+ case EVIOCSFF:447447+ case EVIOCRMFF:448448+ case EVIOCGEFFECTS:449449+ case EVIOCGRAB:450450+ return evdev_ioctl(file, cmd, (unsigned long) p);451451+452452+ default:453453+454454+ if (_IOC_TYPE(cmd) != 'E')455455+ return -EINVAL;456456+457457+ if (_IOC_DIR(cmd) == _IOC_READ) {458458+459459+ if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0,0))) {460460+ long *bits;461461+ int max;462462+463463+ switch (_IOC_NR(cmd) & EV_MAX) {464464+ case 0: bits = dev->evbit; max = EV_MAX; break;465465+ case EV_KEY: bits = dev->keybit; max = KEY_MAX; break;466466+ case EV_REL: bits = dev->relbit; max = REL_MAX; break;467467+ case EV_ABS: bits = dev->absbit; max = ABS_MAX; break;468468+ case EV_MSC: bits = dev->mscbit; max = MSC_MAX; break;469469+ case EV_LED: bits = dev->ledbit; max = LED_MAX; break;470470+ case EV_SND: bits = dev->sndbit; max = SND_MAX; break;471471+ case EV_FF: bits = dev->ffbit; max = FF_MAX; break;472472+ default: return -EINVAL;473473+ }474474+ bit_to_user(bits, max);475475+ }476476+477477+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0)))478478+ bit_to_user(dev->key, KEY_MAX);479479+480480+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGLED(0)))481481+ bit_to_user(dev->led, LED_MAX);482482+483483+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSND(0)))484484+ bit_to_user(dev->snd, SND_MAX);485485+486486+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) {487487+ int len;488488+ if (!dev->name) return -ENOENT;489489+ len = strlen(dev->name) + 1;490490+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);491491+ return copy_to_user(p, dev->name, len) ? -EFAULT : len;492492+ }493493+494494+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0))) {495495+ int len;496496+ if (!dev->phys) return -ENOENT;497497+ len = strlen(dev->phys) + 1;498498+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);499499+ return copy_to_user(p, dev->phys, len) ? -EFAULT : len;500500+ }501501+502502+ if (_IOC_NR(cmd) == _IOC_NR(EVIOCGUNIQ(0))) {503503+ int len;504504+ if (!dev->uniq) return -ENOENT;505505+ len = strlen(dev->uniq) + 1;506506+ if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);507507+ return copy_to_user(p, dev->uniq, len) ? -EFAULT : len;508508+ }509509+510510+ if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {511511+512512+ int t = _IOC_NR(cmd) & ABS_MAX;513513+514514+ abs.value = dev->abs[t];515515+ abs.minimum = dev->absmin[t];516516+ abs.maximum = dev->absmax[t];517517+ abs.fuzz = dev->absfuzz[t];518518+ abs.flat = dev->absflat[t];519519+520520+ if (copy_to_user(p, &abs, sizeof(struct input_absinfo)))521521+ return -EFAULT;522522+523523+ return 0;524524+ }525525+ }526526+527527+ if (_IOC_DIR(cmd) == _IOC_WRITE) {528528+529529+ if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {530530+531531+ int t = _IOC_NR(cmd) & ABS_MAX;532532+533533+ if (copy_from_user(&abs, p, sizeof(struct input_absinfo)))534534+ return -EFAULT;535535+536536+ dev->abs[t] = abs.value;537537+ dev->absmin[t] = abs.minimum;538538+ dev->absmax[t] = abs.maximum;539539+ dev->absfuzz[t] = abs.fuzz;540540+ dev->absflat[t] = abs.flat;541541+542542+ return 0;543543+ }544544+ }545545+ }546546+ return -EINVAL;547547+}548548+#endif477549478550static struct file_operations evdev_fops = {479551 .owner = THIS_MODULE,···640396 .poll = evdev_poll,641397 .open = evdev_open,642398 .release = evdev_release,643643- .ioctl = evdev_ioctl,399399+ .unlocked_ioctl = evdev_ioctl,400400+#ifdef CONFIG_COMPAT401401+ .compat_ioctl = evdev_ioctl_compat,402402+#endif644403 .fasync = evdev_fasync,645404 .flush = evdev_flush646405};
-14
drivers/input/gameport/Kconfig
···4949 To compile this driver as a module, choose M here: the5050 module will be called emu10k1-gp.51515252-config GAMEPORT_VORTEX5353- tristate "Aureal Vortex, Vortex 2 gameport support"5454- depends on PCI5555- help5656- Say Y here if you have an Aureal Vortex 1 or 2 card and want5757- to use its gameport.5858-5959- To compile this driver as a module, choose M here: the6060- module will be called vortex.6161-6252config GAMEPORT_FM8016353 tristate "ForteMedia FM801 gameport support"6464- depends on PCI6565-6666-config GAMEPORT_CS461X6767- tristate "Crystal SoundFusion gameport support"6854 depends on PCI69557056endif
-2
drivers/input/gameport/Makefile
···55# Each configuration option enables a list of files.6677obj-$(CONFIG_GAMEPORT) += gameport.o88-obj-$(CONFIG_GAMEPORT_CS461X) += cs461x.o98obj-$(CONFIG_GAMEPORT_EMU10K1) += emu10k1-gp.o109obj-$(CONFIG_GAMEPORT_FM801) += fm801-gp.o1110obj-$(CONFIG_GAMEPORT_L4) += lightning.o1211obj-$(CONFIG_GAMEPORT_NS558) += ns558.o1313-obj-$(CONFIG_GAMEPORT_VORTEX) += vortex.o
-322
drivers/input/gameport/cs461x.c
···11-/*22- The all defines and part of code (such as cs461x_*) are33- contributed from ALSA 0.5.8 sources.44- See http://www.alsa-project.org/ for sources55-66- Tested on Linux 686 2.4.0-test9, ALSA 0.5.8a and CS461077-*/88-99-#include <asm/io.h>1010-1111-#include <linux/module.h>1212-#include <linux/ioport.h>1313-#include <linux/config.h>1414-#include <linux/init.h>1515-#include <linux/gameport.h>1616-#include <linux/slab.h>1717-#include <linux/pci.h>1818-1919-MODULE_AUTHOR("Victor Krapivin");2020-MODULE_LICENSE("GPL");2121-2222-/*2323- These options are experimental2424-2525-#define CS461X_FULL_MAP2626-*/2727-2828-2929-#ifndef PCI_VENDOR_ID_CIRRUS3030-#define PCI_VENDOR_ID_CIRRUS 0x10133131-#endif3232-#ifndef PCI_DEVICE_ID_CIRRUS_46103333-#define PCI_DEVICE_ID_CIRRUS_4610 0x60013434-#endif3535-#ifndef PCI_DEVICE_ID_CIRRUS_46123636-#define PCI_DEVICE_ID_CIRRUS_4612 0x60033737-#endif3838-#ifndef PCI_DEVICE_ID_CIRRUS_46153939-#define PCI_DEVICE_ID_CIRRUS_4615 0x60044040-#endif4141-4242-/* Registers */4343-4444-#define BA0_JSPT 0x000004804545-#define BA0_JSCTL 0x000004844646-#define BA0_JSC1 0x000004884747-#define BA0_JSC2 0x0000048C4848-#define BA0_JSIO 0x000004A04949-5050-/* Bits for JSPT */5151-5252-#define JSPT_CAX 0x000000015353-#define JSPT_CAY 0x000000025454-#define JSPT_CBX 0x000000045555-#define JSPT_CBY 0x000000085656-#define JSPT_BA1 0x000000105757-#define JSPT_BA2 0x000000205858-#define JSPT_BB1 0x000000405959-#define JSPT_BB2 0x000000806060-6161-/* Bits for JSCTL */6262-6363-#define JSCTL_SP_MASK 0x000000036464-#define JSCTL_SP_SLOW 0x000000006565-#define JSCTL_SP_MEDIUM_SLOW 0x000000016666-#define JSCTL_SP_MEDIUM_FAST 0x000000026767-#define JSCTL_SP_FAST 0x000000036868-#define JSCTL_ARE 0x000000046969-7070-/* Data register pairs masks */7171-7272-#define JSC1_Y1V_MASK 0x0000FFFF7373-#define JSC1_X1V_MASK 0xFFFF00007474-#define JSC1_Y1V_SHIFT 07575-#define JSC1_X1V_SHIFT 167676-#define JSC2_Y2V_MASK 0x0000FFFF7777-#define JSC2_X2V_MASK 0xFFFF00007878-#define JSC2_Y2V_SHIFT 07979-#define JSC2_X2V_SHIFT 168080-8181-/* JS GPIO */8282-8383-#define JSIO_DAX 0x000000018484-#define JSIO_DAY 0x000000028585-#define JSIO_DBX 0x000000048686-#define JSIO_DBY 0x000000088787-#define JSIO_AXOE 0x000000108888-#define JSIO_AYOE 0x000000208989-#define JSIO_BXOE 0x000000409090-#define JSIO_BYOE 0x000000809191-9292-/*9393- The card initialization code is obfuscated; the module cs461x9494- need to be loaded after ALSA modules initialized and something9595- played on the CS 4610 chip (see sources for details of CS46109696- initialization code from ALSA)9797-*/9898-9999-/* Card specific definitions */100100-101101-#define CS461X_BA0_SIZE 0x2000102102-#define CS461X_BA1_DATA0_SIZE 0x3000103103-#define CS461X_BA1_DATA1_SIZE 0x3800104104-#define CS461X_BA1_PRG_SIZE 0x7000105105-#define CS461X_BA1_REG_SIZE 0x0100106106-107107-#define BA1_SP_DMEM0 0x00000000108108-#define BA1_SP_DMEM1 0x00010000109109-#define BA1_SP_PMEM 0x00020000110110-#define BA1_SP_REG 0x00030000111111-112112-#define BA1_DWORD_SIZE (13 * 1024 + 512)113113-#define BA1_MEMORY_COUNT 3114114-115115-/*116116- Only one CS461x card is still suppoted; the code requires117117- redesign to avoid this limitatuion.118118-*/119119-120120-static unsigned long ba0_addr;121121-static unsigned int __iomem *ba0;122122-123123-#ifdef CS461X_FULL_MAP124124-static unsigned long ba1_addr;125125-static union ba1_t {126126- struct {127127- unsigned int __iomem *data0;128128- unsigned int __iomem *data1;129129- unsigned int __iomem *pmem;130130- unsigned int __iomem *reg;131131- } name;132132- unsigned int __iomem *idx[4];133133-} ba1;134134-135135-static void cs461x_poke(unsigned long reg, unsigned int val)136136-{137137- writel(val, &ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff]);138138-}139139-140140-static unsigned int cs461x_peek(unsigned long reg)141141-{142142- return readl(&ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff]);143143-}144144-145145-#endif146146-147147-static void cs461x_pokeBA0(unsigned long reg, unsigned int val)148148-{149149- writel(val, &ba0[reg >> 2]);150150-}151151-152152-static unsigned int cs461x_peekBA0(unsigned long reg)153153-{154154- return readl(&ba0[reg >> 2]);155155-}156156-157157-static int cs461x_free(struct pci_dev *pdev)158158-{159159- struct gameport *port = pci_get_drvdata(pdev);160160-161161- if (port)162162- gameport_unregister_port(port);163163-164164- if (ba0) iounmap(ba0);165165-#ifdef CS461X_FULL_MAP166166- if (ba1.name.data0) iounmap(ba1.name.data0);167167- if (ba1.name.data1) iounmap(ba1.name.data1);168168- if (ba1.name.pmem) iounmap(ba1.name.pmem);169169- if (ba1.name.reg) iounmap(ba1.name.reg);170170-#endif171171- return 0;172172-}173173-174174-static void cs461x_gameport_trigger(struct gameport *gameport)175175-{176176- cs461x_pokeBA0(BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF);177177-}178178-179179-static unsigned char cs461x_gameport_read(struct gameport *gameport)180180-{181181- return cs461x_peekBA0(BA0_JSPT); //inb(gameport->io);182182-}183183-184184-static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)185185-{186186- unsigned js1, js2, jst;187187-188188- js1 = cs461x_peekBA0(BA0_JSC1);189189- js2 = cs461x_peekBA0(BA0_JSC2);190190- jst = cs461x_peekBA0(BA0_JSPT);191191-192192- *buttons = (~jst >> 4) & 0x0F;193193-194194- axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF;195195- axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF;196196- axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF;197197- axes[3] = ((js2 & JSC2_X2V_MASK) >> JSC2_X2V_SHIFT) & 0xFFFF;198198-199199- for(jst=0;jst<4;++jst)200200- if(axes[jst]==0xFFFF) axes[jst] = -1;201201- return 0;202202-}203203-204204-static int cs461x_gameport_open(struct gameport *gameport, int mode)205205-{206206- switch (mode) {207207- case GAMEPORT_MODE_COOKED:208208- case GAMEPORT_MODE_RAW:209209- return 0;210210- default:211211- return -1;212212- }213213- return 0;214214-}215215-216216-static struct pci_device_id cs461x_pci_tbl[] = {217217- { PCI_VENDOR_ID_CIRRUS, 0x6001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Cirrus CS4610 */218218- { PCI_VENDOR_ID_CIRRUS, 0x6003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Cirrus CS4612 */219219- { PCI_VENDOR_ID_CIRRUS, 0x6005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Cirrus CS4615 */220220- { 0, }221221-};222222-MODULE_DEVICE_TABLE(pci, cs461x_pci_tbl);223223-224224-static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)225225-{226226- int rc;227227- struct gameport* port;228228-229229- rc = pci_enable_device(pdev);230230- if (rc) {231231- printk(KERN_ERR "cs461x: Cannot enable PCI gameport (bus %d, devfn %d) error=%d\n",232232- pdev->bus->number, pdev->devfn, rc);233233- return rc;234234- }235235-236236- ba0_addr = pci_resource_start(pdev, 0);237237-#ifdef CS461X_FULL_MAP238238- ba1_addr = pci_resource_start(pdev, 1);239239-#endif240240- if (ba0_addr == 0 || ba0_addr == ~0241241-#ifdef CS461X_FULL_MAP242242- || ba1_addr == 0 || ba1_addr == ~0243243-#endif244244- ) {245245- printk(KERN_ERR "cs461x: wrong address - ba0 = 0x%lx\n", ba0_addr);246246-#ifdef CS461X_FULL_MAP247247- printk(KERN_ERR "cs461x: wrong address - ba1 = 0x%lx\n", ba1_addr);248248-#endif249249- cs461x_free(pdev);250250- return -ENOMEM;251251- }252252-253253- ba0 = ioremap(ba0_addr, CS461X_BA0_SIZE);254254-#ifdef CS461X_FULL_MAP255255- ba1.name.data0 = ioremap(ba1_addr + BA1_SP_DMEM0, CS461X_BA1_DATA0_SIZE);256256- ba1.name.data1 = ioremap(ba1_addr + BA1_SP_DMEM1, CS461X_BA1_DATA1_SIZE);257257- ba1.name.pmem = ioremap(ba1_addr + BA1_SP_PMEM, CS461X_BA1_PRG_SIZE);258258- ba1.name.reg = ioremap(ba1_addr + BA1_SP_REG, CS461X_BA1_REG_SIZE);259259-260260- if (ba0 == NULL || ba1.name.data0 == NULL ||261261- ba1.name.data1 == NULL || ba1.name.pmem == NULL ||262262- ba1.name.reg == NULL) {263263- cs461x_free(pdev);264264- return -ENOMEM;265265- }266266-#else267267- if (ba0 == NULL) {268268- cs461x_free(pdev);269269- return -ENOMEM;270270- }271271-#endif272272-273273- if (!(port = gameport_allocate_port())) {274274- printk(KERN_ERR "cs461x: Memory allocation failed\n");275275- cs461x_free(pdev);276276- return -ENOMEM;277277- }278278-279279- pci_set_drvdata(pdev, port);280280-281281- port->open = cs461x_gameport_open;282282- port->trigger = cs461x_gameport_trigger;283283- port->read = cs461x_gameport_read;284284- port->cooked_read = cs461x_gameport_cooked_read;285285-286286- gameport_set_name(port, "CS416x");287287- gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev));288288- port->dev.parent = &pdev->dev;289289-290290- cs461x_pokeBA0(BA0_JSIO, 0xFF); // ?291291- cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW);292292-293293- gameport_register_port(port);294294-295295- return 0;296296-}297297-298298-static void __devexit cs461x_pci_remove(struct pci_dev *pdev)299299-{300300- cs461x_free(pdev);301301-}302302-303303-static struct pci_driver cs461x_pci_driver = {304304- .name = "CS461x_gameport",305305- .id_table = cs461x_pci_tbl,306306- .probe = cs461x_pci_probe,307307- .remove = __devexit_p(cs461x_pci_remove),308308-};309309-310310-static int __init cs461x_init(void)311311-{312312- return pci_register_driver(&cs461x_pci_driver);313313-}314314-315315-static void __exit cs461x_exit(void)316316-{317317- pci_unregister_driver(&cs461x_pci_driver);318318-}319319-320320-module_init(cs461x_init);321321-module_exit(cs461x_exit);322322-
+6-6
drivers/input/gameport/ns558.c
···258258{259259 int i = 0;260260261261+ if (pnp_register_driver(&ns558_pnp_driver) >= 0)262262+ pnp_registered = 1;263263+261264/*262262- * Probe ISA ports first so that PnP gets to choose free port addresses263263- * not occupied by the ISA ports.265265+ * Probe ISA ports after PnP, so that PnP ports that are already266266+ * enabled get detected as PnP. This may be suboptimal in multi-device267267+ * configurations, but saves hassle with simple setups.264268 */265269266270 while (ns558_isa_portlist[i])267271 ns558_isa_probe(ns558_isa_portlist[i++]);268268-269269- if (pnp_register_driver(&ns558_pnp_driver) >= 0)270270- pnp_registered = 1;271271-272272273273 return (list_empty(&ns558_list) && !pnp_registered) ? -ENODEV : 0;274274}
-186
drivers/input/gameport/vortex.c
···11-/*22- * $Id: vortex.c,v 1.5 2002/07/01 15:39:30 vojtech Exp $33- *44- * Copyright (c) 2000-2001 Vojtech Pavlik55- *66- * Based on the work of:77- * Raymond Ingles88- */99-1010-/*1111- * Trident 4DWave and Aureal Vortex gameport driver for Linux1212- */1313-1414-/*1515- * This program is free software; you can redistribute it and/or modify1616- * it under the terms of the GNU General Public License as published by1717- * the Free Software Foundation; either version 2 of the License, or1818- * (at your option) any later version.1919- *2020- * This program is distributed in the hope that it will be useful,2121- * but WITHOUT ANY WARRANTY; without even the implied warranty of2222- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2323- * GNU General Public License for more details.2424- *2525- * You should have received a copy of the GNU General Public License2626- * along with this program; if not, write to the Free Software2727- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2828- *2929- * Should you need to contact me, the author, you can do so either by3030- * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:3131- * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic3232- */3333-3434-#include <asm/io.h>3535-#include <linux/delay.h>3636-#include <linux/errno.h>3737-#include <linux/ioport.h>3838-#include <linux/kernel.h>3939-#include <linux/module.h>4040-#include <linux/pci.h>4141-#include <linux/init.h>4242-#include <linux/slab.h>4343-#include <linux/delay.h>4444-#include <linux/gameport.h>4545-4646-MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");4747-MODULE_DESCRIPTION("Aureal Vortex and Vortex2 gameport driver");4848-MODULE_LICENSE("GPL");4949-5050-#define VORTEX_GCR 0x0c /* Gameport control register */5151-#define VORTEX_LEG 0x08 /* Legacy port location */5252-#define VORTEX_AXD 0x10 /* Axes start */5353-#define VORTEX_DATA_WAIT 20 /* 20 ms */5454-5555-struct vortex {5656- struct gameport *gameport;5757- struct pci_dev *dev;5858- unsigned char __iomem *base;5959- unsigned char __iomem *io;6060-};6161-6262-static unsigned char vortex_read(struct gameport *gameport)6363-{6464- struct vortex *vortex = gameport->port_data;6565- return readb(vortex->io + VORTEX_LEG);6666-}6767-6868-static void vortex_trigger(struct gameport *gameport)6969-{7070- struct vortex *vortex = gameport->port_data;7171- writeb(0xff, vortex->io + VORTEX_LEG);7272-}7373-7474-static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons)7575-{7676- struct vortex *vortex = gameport->port_data;7777- int i;7878-7979- *buttons = (~readb(vortex->base + VORTEX_LEG) >> 4) & 0xf;8080-8181- for (i = 0; i < 4; i++) {8282- axes[i] = readw(vortex->io + VORTEX_AXD + i * sizeof(u32));8383- if (axes[i] == 0x1fff) axes[i] = -1;8484- }8585-8686- return 0;8787-}8888-8989-static int vortex_open(struct gameport *gameport, int mode)9090-{9191- struct vortex *vortex = gameport->port_data;9292-9393- switch (mode) {9494- case GAMEPORT_MODE_COOKED:9595- writeb(0x40, vortex->io + VORTEX_GCR);9696- msleep(VORTEX_DATA_WAIT);9797- return 0;9898- case GAMEPORT_MODE_RAW:9999- writeb(0x00, vortex->io + VORTEX_GCR);100100- return 0;101101- default:102102- return -1;103103- }104104-105105- return 0;106106-}107107-108108-static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_id *id)109109-{110110- struct vortex *vortex;111111- struct gameport *port;112112- int i;113113-114114- vortex = kcalloc(1, sizeof(struct vortex), GFP_KERNEL);115115- port = gameport_allocate_port();116116- if (!vortex || !port) {117117- printk(KERN_ERR "vortex: Memory allocation failed.\n");118118- kfree(vortex);119119- gameport_free_port(port);120120- return -ENOMEM;121121- }122122-123123- for (i = 0; i < 6; i++)124124- if (~pci_resource_flags(dev, i) & IORESOURCE_IO)125125- break;126126-127127- pci_enable_device(dev);128128-129129- vortex->dev = dev;130130- vortex->gameport = port;131131- vortex->base = ioremap(pci_resource_start(vortex->dev, i),132132- pci_resource_len(vortex->dev, i));133133- vortex->io = vortex->base + id->driver_data;134134-135135- pci_set_drvdata(dev, vortex);136136-137137- port->port_data = vortex;138138- port->fuzz = 64;139139-140140- gameport_set_name(port, "AU88x0");141141- gameport_set_phys(port, "pci%s/gameport0", pci_name(dev));142142- port->dev.parent = &dev->dev;143143- port->read = vortex_read;144144- port->trigger = vortex_trigger;145145- port->cooked_read = vortex_cooked_read;146146- port->open = vortex_open;147147-148148- gameport_register_port(port);149149-150150- return 0;151151-}152152-153153-static void __devexit vortex_remove(struct pci_dev *dev)154154-{155155- struct vortex *vortex = pci_get_drvdata(dev);156156-157157- gameport_unregister_port(vortex->gameport);158158- iounmap(vortex->base);159159- kfree(vortex);160160-}161161-162162-static struct pci_device_id vortex_id_table[] = {163163- { 0x12eb, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x11000 },164164- { 0x12eb, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x28800 },165165- { 0 }166166-};167167-168168-static struct pci_driver vortex_driver = {169169- .name = "vortex_gameport",170170- .id_table = vortex_id_table,171171- .probe = vortex_probe,172172- .remove = __devexit_p(vortex_remove),173173-};174174-175175-static int __init vortex_init(void)176176-{177177- return pci_register_driver(&vortex_driver);178178-}179179-180180-static void __exit vortex_exit(void)181181-{182182- pci_unregister_driver(&vortex_driver);183183-}184184-185185-module_init(vortex_init);186186-module_exit(vortex_exit);
+32-5
drivers/input/input.c
···219219220220int input_open_device(struct input_handle *handle)221221{222222+ struct input_dev *dev = handle->dev;223223+ int err;224224+225225+ err = down_interruptible(&dev->sem);226226+ if (err)227227+ return err;228228+222229 handle->open++;223223- if (handle->dev->open)224224- return handle->dev->open(handle->dev);225225- return 0;230230+231231+ if (!dev->users++ && dev->open)232232+ err = dev->open(dev);233233+234234+ if (err)235235+ handle->open--;236236+237237+ up(&dev->sem);238238+239239+ return err;226240}227241228242int input_flush_device(struct input_handle* handle, struct file* file)···249235250236void input_close_device(struct input_handle *handle)251237{238238+ struct input_dev *dev = handle->dev;239239+252240 input_release_device(handle);253253- if (handle->dev->close)254254- handle->dev->close(handle->dev);241241+242242+ down(&dev->sem);243243+244244+ if (!--dev->users && dev->close)245245+ dev->close(dev);255246 handle->open--;247247+248248+ up(&dev->sem);256249}257250258251static void input_link_handle(struct input_handle *handle)···435414 struct input_device_id *id;436415437416 set_bit(EV_SYN, dev->evbit);417417+418418+ init_MUTEX(&dev->sem);438419439420 /*440421 * If delay and period are pre-set by the driver, then autorepeating···697674 return (count > cnt) ? cnt : count;698675}699676677677+static struct file_operations input_fileops;678678+700679static int __init input_proc_init(void)701680{702681 struct proc_dir_entry *entry;···713688 return -ENOMEM;714689 }715690 entry->owner = THIS_MODULE;691691+ input_fileops = *entry->proc_fops;692692+ entry->proc_fops = &input_fileops;716693 entry->proc_fops->poll = input_devices_poll;717694 entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL);718695 if (entry == NULL) {
···229229 { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */230230 { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */231231 { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */232232+ { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */232233 { } /* Terminating entry */233234};234235
+2-2
drivers/input/joystick/spaceball.c
···44 * Copyright (c) 1999-2001 Vojtech Pavlik55 *66 * Based on the work of:77- * David Thompson88- * Joseph Krahn77+ * David Thompson88+ * Joseph Krahn99 */10101111/*
+1-1
drivers/input/joystick/spaceorb.c
···44 * Copyright (c) 1999-2001 Vojtech Pavlik55 *66 * Based on the work of:77- * David Thompson77+ * David Thompson88 */991010/*
···3333MODULE_DESCRIPTION("Amiga mouse driver");3434MODULE_LICENSE("GPL");35353636-static int amimouse_used = 0;3736static int amimouse_lastx, amimouse_lasty;3837static struct input_dev amimouse_dev;3938···8081{8182 unsigned short joy0dat;82838383- if (amimouse_used++)8484- return 0;8585-8684 joy0dat = custom.joy0dat;87858886 amimouse_lastx = joy0dat & 0xff;8987 amimouse_lasty = joy0dat >> 8;90889189 if (request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", amimouse_interrupt)) {9292- amimouse_used--;9390 printk(KERN_ERR "amimouse.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB);9491 return -EBUSY;9592 }···9510096101static void amimouse_close(struct input_dev *dev)97102{9898- if (!--amimouse_used)9999- free_irq(IRQ_AMIGA_VERTB, amimouse_interrupt);103103+ free_irq(IRQ_AMIGA_VERTB, amimouse_interrupt);100104}101105102106static int __init amimouse_init(void)
+16-22
drivers/input/mouse/inport.c
···1717/*1818 * This program is free software; you can redistribute it and/or modify1919 * it under the terms of the GNU General Public License as published by2020- * the Free Software Foundation; either version 2 of the License, or 2020+ * the Free Software Foundation; either version 2 of the License, or2121 * (at your option) any later version.2222- * 2222+ *2323 * This program is distributed in the hope that it will be useful,2424 * but WITHOUT ANY WARRANTY; without even the implied warranty of2525 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2626 * GNU General Public License for more details.2727- * 2727+ *2828 * You should have received a copy of the GNU General Public License2929 * along with this program; if not, write to the Free Software3030 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA3131- * 3131+ *3232 * Should you need to contact me, the author, you can do so either by3333 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:3434 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic···87878888__obsolete_setup("inport_irq=");89899090-static int inport_used;9191-9290static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs);93919492static int inport_open(struct input_dev *dev)9593{9696- if (!inport_used++) {9797- if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL))9898- return -EBUSY;9999- outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);100100- outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);101101- }9494+ if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL))9595+ return -EBUSY;9696+ outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);9797+ outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);1029810399 return 0;104100}105101106102static void inport_close(struct input_dev *dev)107103{108108- if (!--inport_used) {109109- outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);110110- outb(INPORT_MODE_BASE, INPORT_DATA_PORT);111111- free_irq(inport_irq, NULL);112112- }104104+ outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);105105+ outb(INPORT_MODE_BASE, INPORT_DATA_PORT);106106+ free_irq(inport_irq, NULL);113107}114108115109static struct input_dev inport_dev = {···114120 .close = inport_close,115121 .name = INPORT_NAME,116122 .phys = "isa023c/input0",117117- .id = { 118118- .bustype = BUS_ISA,119119- .vendor = INPORT_VENDOR,120120- .product = 0x0001,121121- .version = 0x0100,123123+ .id = {124124+ .bustype = BUS_ISA,125125+ .vendor = INPORT_VENDOR,126126+ .product = 0x0001,127127+ .version = 0x0100,122128 },123129};124130
+134
drivers/input/mouse/lifebook.c
···11+/*22+ * Fujitsu B-series Lifebook PS/2 TouchScreen driver33+ *44+ * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz>55+ * Copyright (c) 2005 Kenan Esau <kenan.esau@conan.de>66+ *77+ * TouchScreen detection, absolute mode setting and packet layout is taken from88+ * Harald Hoyer's description of the device.99+ *1010+ * This program is free software; you can redistribute it and/or modify it1111+ * under the terms of the GNU General Public License version 2 as published by1212+ * the Free Software Foundation.1313+ */1414+1515+#include <linux/input.h>1616+#include <linux/serio.h>1717+#include <linux/libps2.h>1818+#include <linux/dmi.h>1919+2020+#include "psmouse.h"2121+#include "lifebook.h"2222+2323+static struct dmi_system_id lifebook_dmi_table[] = {2424+ {2525+ .ident = "Lifebook B",2626+ .matches = {2727+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),2828+ },2929+ },3030+ { }3131+};3232+3333+3434+static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_regs *regs)3535+{3636+ unsigned char *packet = psmouse->packet;3737+ struct input_dev *dev = &psmouse->dev;3838+3939+ if (psmouse->pktcnt != 3)4040+ return PSMOUSE_GOOD_DATA;4141+4242+ input_regs(dev, regs);4343+4444+ /* calculate X and Y */4545+ if ((packet[0] & 0x08) == 0x00) {4646+ input_report_abs(dev, ABS_X,4747+ (packet[1] | ((packet[0] & 0x30) << 4)));4848+ input_report_abs(dev, ABS_Y,4949+ 1024 - (packet[2] | ((packet[0] & 0xC0) << 2)));5050+ } else {5151+ input_report_rel(dev, REL_X,5252+ ((packet[0] & 0x10) ? packet[1] - 256 : packet[1]));5353+ input_report_rel(dev, REL_Y,5454+ -(int)((packet[0] & 0x20) ? packet[2] - 256 : packet[2]));5555+ }5656+5757+ input_report_key(dev, BTN_LEFT, packet[0] & 0x01);5858+ input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);5959+ input_report_key(dev, BTN_TOUCH, packet[0] & 0x04);6060+6161+ input_sync(dev);6262+6363+ return PSMOUSE_FULL_PACKET;6464+}6565+6666+static int lifebook_absolute_mode(struct psmouse *psmouse)6767+{6868+ struct ps2dev *ps2dev = &psmouse->ps2dev;6969+ unsigned char param;7070+7171+ if (psmouse_reset(psmouse))7272+ return -1;7373+7474+ /*7575+ Enable absolute output -- ps2_command fails always but if7676+ you leave this call out the touchsreen will never send7777+ absolute coordinates7878+ */7979+ param = 0x07;8080+ ps2_command(ps2dev, ¶m, PSMOUSE_CMD_SETRES);8181+8282+ return 0;8383+}8484+8585+static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution)8686+{8787+ unsigned char params[] = { 0, 1, 2, 2, 3 };8888+8989+ if (resolution == 0 || resolution > 400)9090+ resolution = 400;9191+9292+ ps2_command(&psmouse->ps2dev, ¶ms[resolution / 100], PSMOUSE_CMD_SETRES);9393+ psmouse->resolution = 50 << params[resolution / 100];9494+}9595+9696+static void lifebook_disconnect(struct psmouse *psmouse)9797+{9898+ psmouse_reset(psmouse);9999+}100100+101101+int lifebook_detect(struct psmouse *psmouse, int set_properties)102102+{103103+ if (!dmi_check_system(lifebook_dmi_table))104104+ return -1;105105+106106+ if (set_properties) {107107+ psmouse->vendor = "Fujitsu";108108+ psmouse->name = "Lifebook TouchScreen";109109+ }110110+111111+ return 0;112112+}113113+114114+int lifebook_init(struct psmouse *psmouse)115115+{116116+ if (lifebook_absolute_mode(psmouse))117117+ return -1;118118+119119+ psmouse->dev.evbit[0] = BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL);120120+ psmouse->dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);121121+ psmouse->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);122122+ psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);123123+ input_set_abs_params(&psmouse->dev, ABS_X, 0, 1024, 0, 0);124124+ input_set_abs_params(&psmouse->dev, ABS_Y, 0, 1024, 0, 0);125125+126126+ psmouse->protocol_handler = lifebook_process_byte;127127+ psmouse->set_resolution = lifebook_set_resolution;128128+ psmouse->disconnect = lifebook_disconnect;129129+ psmouse->reconnect = lifebook_absolute_mode;130130+ psmouse->pktsize = 3;131131+132132+ return 0;133133+}134134+
+17
drivers/input/mouse/lifebook.h
···11+/*22+ * Fujitsu B-series Lifebook PS/2 TouchScreen driver33+ *44+ * Copyright (c) 2005 Vojtech Pavlik55+ *66+ * This program is free software; you can redistribute it and/or modify it77+ * under the terms of the GNU General Public License version 2 as published by88+ * the Free Software Foundation.99+ */1010+1111+#ifndef _LIFEBOOK_H1212+#define _LIFEBOOK_H1313+1414+int lifebook_detect(struct psmouse *psmouse, int set_properties);1515+int lifebook_init(struct psmouse *psmouse);1616+1717+#endif
+5-12
drivers/input/mouse/logibm.c
···1818/*1919 * This program is free software; you can redistribute it and/or modify2020 * it under the terms of the GNU General Public License as published by2121- * the Free Software Foundation; either version 2 of the License, or 2121+ * the Free Software Foundation; either version 2 of the License, or2222 * (at your option) any later version.2323- * 2323+ *2424 * This program is distributed in the hope that it will be useful,2525 * but WITHOUT ANY WARRANTY; without even the implied warranty of2626 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2727 * GNU General Public License for more details.2828- * 2828+ *2929 * You should have received a copy of the GNU General Public License3030 * along with this program; if not, write to the Free Software3131 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA3232- * 3232+ *3333 * Should you need to contact me, the author, you can do so either by3434 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:3535 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic···77777878__obsolete_setup("logibm_irq=");79798080-static int logibm_used = 0;8181-8280static irqreturn_t logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs);83818482static int logibm_open(struct input_dev *dev)8583{8686- if (logibm_used++)8787- return 0;8884 if (request_irq(logibm_irq, logibm_interrupt, 0, "logibm", NULL)) {8989- logibm_used--;9085 printk(KERN_ERR "logibm.c: Can't allocate irq %d\n", logibm_irq);9186 return -EBUSY;9287 }···91969297static void logibm_close(struct input_dev *dev)9398{9494- if (--logibm_used)9595- return;9699 outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT);97100 free_irq(logibm_irq, NULL);98101}···160167 outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT);161168162169 input_register_device(&logibm_dev);163163-170170+164171 printk(KERN_INFO "input: Logitech bus mouse at %#x irq %d\n", LOGIBM_BASE, logibm_irq);165172166173 return 0;
···44 * Copyright (c) 2000-2001 Vojtech Pavlik55 *66 * Based on the work of:77- * Alan Cox Robin O'Leary 77+ * Alan Cox Robin O'Leary88 */991010/*···5656static struct input_dev pc110pad_dev;5757static int pc110pad_data[3];5858static int pc110pad_count;5959-static int pc110pad_used;60596160static char *pc110pad_name = "IBM PC110 TouchPad";6261static char *pc110pad_phys = "isa15e0/input0";···73747475 if (pc110pad_count < 3)7576 return IRQ_HANDLED;7676-7777+7778 input_regs(&pc110pad_dev, regs);7879 input_report_key(&pc110pad_dev, BTN_TOUCH,7980 pc110pad_data[0] & 0x01);···89909091static void pc110pad_close(struct input_dev *dev)9192{9292- if (!--pc110pad_used)9393- outb(PC110PAD_OFF, pc110pad_io + 2);9393+ outb(PC110PAD_OFF, pc110pad_io + 2);9494}95959696static int pc110pad_open(struct input_dev *dev)9797{9898- if (pc110pad_used++)9999- return 0;100100-10198 pc110pad_interrupt(0,NULL,NULL);10299 pc110pad_interrupt(0,NULL,NULL);103100 pc110pad_interrupt(0,NULL,NULL);···140145141146 pc110pad_dev.absmax[ABS_X] = 0x1ff;142147 pc110pad_dev.absmax[ABS_Y] = 0x0ff;143143-148148+144149 pc110pad_dev.open = pc110pad_open;145150 pc110pad_dev.close = pc110pad_close;146151···151156 pc110pad_dev.id.product = 0x0001;152157 pc110pad_dev.id.version = 0x0100;153158154154- input_register_device(&pc110pad_dev); 159159+ input_register_device(&pc110pad_dev);155160156161 printk(KERN_INFO "input: %s at %#x irq %d\n",157162 pc110pad_name, pc110pad_io, pc110pad_irq);158158-163163+159164 return 0;160165}161161-166166+162167static void __exit pc110pad_exit(void)163168{164164- input_unregister_device(&pc110pad_dev); 169169+ input_unregister_device(&pc110pad_dev);165170166171 outb(PC110PAD_OFF, pc110pad_io + 2);167172
+297-54
drivers/input/mouse/psmouse-base.c
···2424#include "synaptics.h"2525#include "logips2pp.h"2626#include "alps.h"2727+#include "lifebook.h"27282829#define DRIVER_DESC "PS/2 mouse driver"2930···3231MODULE_DESCRIPTION(DRIVER_DESC);3332MODULE_LICENSE("GPL");34333535-static unsigned int psmouse_max_proto = -1U;3434+static unsigned int psmouse_max_proto = PSMOUSE_AUTO;3635static int psmouse_set_maxproto(const char *val, struct kernel_param *kp);3736static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp);3838-static char *psmouse_proto_abbrev[] = { NULL, "bare", NULL, NULL, NULL, "imps", "exps", NULL, NULL, NULL };3937#define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int)4038#define param_set_proto_abbrev psmouse_set_maxproto4139#define param_get_proto_abbrev psmouse_get_maxproto···5757module_param_named(resetafter, psmouse_resetafter, uint, 0644);5858MODULE_PARM_DESC(resetafter, "Reset device after so many bad packets (0 = never).");59596060+PSMOUSE_DEFINE_ATTR(protocol);6061PSMOUSE_DEFINE_ATTR(rate);6162PSMOUSE_DEFINE_ATTR(resolution);6263PSMOUSE_DEFINE_ATTR(resetafter);···6867__obsolete_setup("psmouse_resetafter=");6968__obsolete_setup("psmouse_rate=");70697171-static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "ThinkPS/2", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2", "AlpsPS/2" };7070+/*7171+ * psmouse_sem protects all operations changing state of mouse7272+ * (connecting, disconnecting, changing rate or resolution via7373+ * sysfs). We could use a per-device semaphore but since there7474+ * rarely more than one PS/2 mouse connected and since semaphore7575+ * is taken in "slow" paths it is not worth it.7676+ */7777+static DECLARE_MUTEX(psmouse_sem);7878+7979+struct psmouse_protocol {8080+ enum psmouse_type type;8181+ char *name;8282+ char *alias;8383+ int maxproto;8484+ int (*detect)(struct psmouse *, int);8585+ int (*init)(struct psmouse *);8686+};72877388/*7489 * psmouse_process_byte() analyzes the PS/2 data stream and reports···424407 */425408static int ps2bare_detect(struct psmouse *psmouse, int set_properties)426409{427427- if (!psmouse->vendor) psmouse->vendor = "Generic";428428- if (!psmouse->name) psmouse->name = "Mouse";410410+ if (set_properties) {411411+ if (!psmouse->vendor) psmouse->vendor = "Generic";412412+ if (!psmouse->name) psmouse->name = "Mouse";413413+ }429414430415 return 0;431416}417417+432418433419/*434420 * psmouse_extensions() probes for any extensions to the basic PS/2 protocol···442422 unsigned int max_proto, int set_properties)443423{444424 int synaptics_hardware = 0;425425+426426+/*427427+ * We always check for lifebook because it does not disturb mouse428428+ * (it only checks DMI information).429429+ */430430+ if (lifebook_detect(psmouse, set_properties) == 0) {431431+ if (max_proto > PSMOUSE_IMEX) {432432+ if (!set_properties || lifebook_init(psmouse) == 0)433433+ return PSMOUSE_LIFEBOOK;434434+ }435435+ }445436446437/*447438 * Try Kensington ThinkingMouse (we try first, because synaptics probe···536505537506 return PSMOUSE_PS2;538507}508508+509509+static struct psmouse_protocol psmouse_protocols[] = {510510+ {511511+ .type = PSMOUSE_PS2,512512+ .name = "PS/2",513513+ .alias = "bare",514514+ .maxproto = 1,515515+ .detect = ps2bare_detect,516516+ },517517+ {518518+ .type = PSMOUSE_PS2PP,519519+ .name = "PS2++",520520+ .alias = "logitech",521521+ .detect = ps2pp_init,522522+ },523523+ {524524+ .type = PSMOUSE_THINKPS,525525+ .name = "ThinkPS/2",526526+ .alias = "thinkps",527527+ .detect = thinking_detect,528528+ },529529+ {530530+ .type = PSMOUSE_GENPS,531531+ .name = "GenPS/2",532532+ .alias = "genius",533533+ .detect = genius_detect,534534+ },535535+ {536536+ .type = PSMOUSE_IMPS,537537+ .name = "ImPS/2",538538+ .alias = "imps",539539+ .maxproto = 1,540540+ .detect = intellimouse_detect,541541+ },542542+ {543543+ .type = PSMOUSE_IMEX,544544+ .name = "ImExPS/2",545545+ .alias = "exps",546546+ .maxproto = 1,547547+ .detect = im_explorer_detect,548548+ },549549+ {550550+ .type = PSMOUSE_SYNAPTICS,551551+ .name = "SynPS/2",552552+ .alias = "synaptics",553553+ .detect = synaptics_detect,554554+ .init = synaptics_init,555555+ },556556+ {557557+ .type = PSMOUSE_ALPS,558558+ .name = "AlpsPS/2",559559+ .alias = "alps",560560+ .detect = alps_detect,561561+ .init = alps_init,562562+ },563563+ {564564+ .type = PSMOUSE_LIFEBOOK,565565+ .name = "LBPS/2",566566+ .alias = "lifebook",567567+ .init = lifebook_init,568568+ },569569+ {570570+ .type = PSMOUSE_AUTO,571571+ .name = "auto",572572+ .alias = "any",573573+ .maxproto = 1,574574+ },575575+};576576+577577+static struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type)578578+{579579+ int i;580580+581581+ for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++)582582+ if (psmouse_protocols[i].type == type)583583+ return &psmouse_protocols[i];584584+585585+ WARN_ON(1);586586+ return &psmouse_protocols[0];587587+}588588+589589+static struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len)590590+{591591+ struct psmouse_protocol *p;592592+ int i;593593+594594+ for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) {595595+ p = &psmouse_protocols[i];596596+597597+ if ((strlen(p->name) == len && !strncmp(p->name, name, len)) ||598598+ (strlen(p->alias) == len && !strncmp(p->alias, name, len)))599599+ return &psmouse_protocols[i];600600+ }601601+602602+ return NULL;603603+}604604+539605540606/*541607 * psmouse_probe() probes for a PS/2 mouse.···781653782654static void psmouse_disconnect(struct serio *serio)783655{784784- struct psmouse *psmouse, *parent;656656+ struct psmouse *psmouse, *parent = NULL;785657658658+ psmouse = serio_get_drvdata(serio);659659+660660+ device_remove_file(&serio->dev, &psmouse_attr_protocol);786661 device_remove_file(&serio->dev, &psmouse_attr_rate);787662 device_remove_file(&serio->dev, &psmouse_attr_resolution);788663 device_remove_file(&serio->dev, &psmouse_attr_resetafter);789664790790- psmouse = serio_get_drvdata(serio);665665+ down(&psmouse_sem);666666+791667 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);792668793669 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {794670 parent = serio_get_drvdata(serio->parent);795795- if (parent->pt_deactivate)796796- parent->pt_deactivate(parent);671671+ psmouse_deactivate(parent);797672 }798673799674 if (psmouse->disconnect)800675 psmouse->disconnect(psmouse);676676+677677+ if (parent && parent->pt_deactivate)678678+ parent->pt_deactivate(parent);801679802680 psmouse_set_state(psmouse, PSMOUSE_IGNORE);803681···811677 serio_close(serio);812678 serio_set_drvdata(serio, NULL);813679 kfree(psmouse);680680+681681+ if (parent)682682+ psmouse_activate(parent);683683+684684+ up(&psmouse_sem);685685+}686686+687687+static int psmouse_switch_protocol(struct psmouse *psmouse, struct psmouse_protocol *proto)688688+{689689+ memset(&psmouse->dev, 0, sizeof(struct input_dev));690690+691691+ init_input_dev(&psmouse->dev);692692+693693+ psmouse->dev.private = psmouse;694694+ psmouse->dev.dev = &psmouse->ps2dev.serio->dev;695695+696696+ psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);697697+ psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);698698+ psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);699699+700700+ psmouse->set_rate = psmouse_set_rate;701701+ psmouse->set_resolution = psmouse_set_resolution;702702+ psmouse->protocol_handler = psmouse_process_byte;703703+ psmouse->pktsize = 3;704704+705705+ if (proto && (proto->detect || proto->init)) {706706+ if (proto->detect && proto->detect(psmouse, 1) < 0)707707+ return -1;708708+709709+ if (proto->init && proto->init(psmouse) < 0)710710+ return -1;711711+712712+ psmouse->type = proto->type;713713+ }714714+ else715715+ psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1);716716+717717+ sprintf(psmouse->devname, "%s %s %s",718718+ psmouse_protocol_by_type(psmouse->type)->name, psmouse->vendor, psmouse->name);719719+720720+ psmouse->dev.name = psmouse->devname;721721+ psmouse->dev.phys = psmouse->phys;722722+ psmouse->dev.id.bustype = BUS_I8042;723723+ psmouse->dev.id.vendor = 0x0002;724724+ psmouse->dev.id.product = psmouse->type;725725+ psmouse->dev.id.version = psmouse->model;726726+727727+ return 0;814728}815729816730/*···870688 struct psmouse *psmouse, *parent = NULL;871689 int retval;872690691691+ down(&psmouse_sem);692692+873693 /*874694 * If this is a pass-through port deactivate parent so the device875695 * connected to this port can be successfully identified···881697 psmouse_deactivate(parent);882698 }883699884884- if (!(psmouse = kmalloc(sizeof(struct psmouse), GFP_KERNEL))) {700700+ if (!(psmouse = kcalloc(1, sizeof(struct psmouse), GFP_KERNEL))) {885701 retval = -ENOMEM;886702 goto out;887703 }888704889889- memset(psmouse, 0, sizeof(struct psmouse));890890-891705 ps2_init(&psmouse->ps2dev, serio);892706 sprintf(psmouse->phys, "%s/input0", serio->phys);893893- psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);894894- psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);895895- psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);896896- psmouse->dev.private = psmouse;897897- psmouse->dev.dev = &serio->dev;707707+898708 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);899709900710 serio_set_drvdata(serio, psmouse);···912734 psmouse->resolution = psmouse_resolution;913735 psmouse->resetafter = psmouse_resetafter;914736 psmouse->smartscroll = psmouse_smartscroll;915915- psmouse->set_rate = psmouse_set_rate;916916- psmouse->set_resolution = psmouse_set_resolution;917917- psmouse->protocol_handler = psmouse_process_byte;918918- psmouse->pktsize = 3;919737920920- psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1);921921-922922- sprintf(psmouse->devname, "%s %s %s",923923- psmouse_protocols[psmouse->type], psmouse->vendor, psmouse->name);924924-925925- psmouse->dev.name = psmouse->devname;926926- psmouse->dev.phys = psmouse->phys;927927- psmouse->dev.id.bustype = BUS_I8042;928928- psmouse->dev.id.vendor = 0x0002;929929- psmouse->dev.id.product = psmouse->type;930930- psmouse->dev.id.version = psmouse->model;738738+ psmouse_switch_protocol(psmouse, NULL);931739932740 input_register_device(&psmouse->dev);933933-934741 printk(KERN_INFO "input: %s on %s\n", psmouse->devname, serio->phys);935742936743 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);···925762 if (parent && parent->pt_activate)926763 parent->pt_activate(parent);927764765765+ device_create_file(&serio->dev, &psmouse_attr_protocol);928766 device_create_file(&serio->dev, &psmouse_attr_rate);929767 device_create_file(&serio->dev, &psmouse_attr_resolution);930768 device_create_file(&serio->dev, &psmouse_attr_resetafter);···935771 retval = 0;936772937773out:938938- /* If this is a pass-through port the parent awaits to be activated */774774+ /* If this is a pass-through port the parent needs to be re-activated */939775 if (parent)940776 psmouse_activate(parent);941777778778+ up(&psmouse_sem);942779 return retval;943780}944781···955790 printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n");956791 return -1;957792 }793793+794794+ down(&psmouse_sem);958795959796 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {960797 parent = serio_get_drvdata(serio->parent);···990823 if (parent)991824 psmouse_activate(parent);992825826826+ up(&psmouse_sem);993827 return rc;994828}995829···10618931062894 if (serio->drv != &psmouse_drv) {1063895 retval = -ENODEV;10641064- goto out;896896+ goto out_unpin;897897+ }898898+899899+ retval = down_interruptible(&psmouse_sem);900900+ if (retval)901901+ goto out_unpin;902902+903903+ if (psmouse->state == PSMOUSE_IGNORE) {904904+ retval = -ENODEV;905905+ goto out_up;1065906 }10669071067908 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {1068909 parent = serio_get_drvdata(serio->parent);1069910 psmouse_deactivate(parent);1070911 }912912+1071913 psmouse_deactivate(psmouse);10729141073915 retval = handler(psmouse, buf, count);107491610751075- psmouse_activate(psmouse);917917+ if (retval != -ENODEV)918918+ psmouse_activate(psmouse);919919+1076920 if (parent)1077921 psmouse_activate(parent);107892210791079-out:923923+ out_up:924924+ up(&psmouse_sem);925925+ out_unpin:1080926 serio_unpin_driver(serio);1081927 return retval;928928+}929929+930930+static ssize_t psmouse_attr_show_protocol(struct psmouse *psmouse, char *buf)931931+{932932+ return sprintf(buf, "%s\n", psmouse_protocol_by_type(psmouse->type)->name);933933+}934934+935935+static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, const char *buf, size_t count)936936+{937937+ struct serio *serio = psmouse->ps2dev.serio;938938+ struct psmouse *parent = NULL;939939+ struct psmouse_protocol *proto;940940+ int retry = 0;941941+942942+ if (!(proto = psmouse_protocol_by_name(buf, count)))943943+ return -EINVAL;944944+945945+ if (psmouse->type == proto->type)946946+ return count;947947+948948+ while (serio->child) {949949+ if (++retry > 3) {950950+ printk(KERN_WARNING "psmouse: failed to destroy child port, protocol change aborted.\n");951951+ return -EIO;952952+ }953953+954954+ up(&psmouse_sem);955955+ serio_unpin_driver(serio);956956+ serio_unregister_child_port(serio);957957+ serio_pin_driver_uninterruptible(serio);958958+ down(&psmouse_sem);959959+960960+ if (serio->drv != &psmouse_drv)961961+ return -ENODEV;962962+963963+ if (psmouse->type == proto->type)964964+ return count; /* switched by other thread */965965+ }966966+967967+ if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {968968+ parent = serio_get_drvdata(serio->parent);969969+ if (parent->pt_deactivate)970970+ parent->pt_deactivate(parent);971971+ }972972+973973+ if (psmouse->disconnect)974974+ psmouse->disconnect(psmouse);975975+976976+ psmouse_set_state(psmouse, PSMOUSE_IGNORE);977977+ input_unregister_device(&psmouse->dev);978978+979979+ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);980980+981981+ if (psmouse_switch_protocol(psmouse, proto) < 0) {982982+ psmouse_reset(psmouse);983983+ /* default to PSMOUSE_PS2 */984984+ psmouse_switch_protocol(psmouse, &psmouse_protocols[0]);985985+ }986986+987987+ psmouse_initialize(psmouse);988988+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);989989+990990+ input_register_device(&psmouse->dev);991991+ printk(KERN_INFO "input: %s on %s\n", psmouse->devname, serio->phys);992992+993993+ if (parent && parent->pt_activate)994994+ parent->pt_activate(parent);995995+996996+ return count;1082997}10839981084999static ssize_t psmouse_attr_show_rate(struct psmouse *psmouse, char *buf)···12209691221970static int psmouse_set_maxproto(const char *val, struct kernel_param *kp)1222971{12231223- int i;972972+ struct psmouse_protocol *proto;12249731225974 if (!val)1226975 return -EINVAL;122797612281228- if (!strncmp(val, "any", 3)) {12291229- *((unsigned int *)kp->arg) = -1U;12301230- return 0;12311231- }977977+ proto = psmouse_protocol_by_name(val, strlen(val));123297812331233- for (i = 0; i < ARRAY_SIZE(psmouse_proto_abbrev); i++) {12341234- if (!psmouse_proto_abbrev[i])12351235- continue;979979+ if (!proto || !proto->maxproto)980980+ return -EINVAL;123698112371237- if (!strncmp(val, psmouse_proto_abbrev[i], strlen(psmouse_proto_abbrev[i]))) {12381238- *((unsigned int *)kp->arg) = i;12391239- return 0;12401240- }12411241- }982982+ *((unsigned int *)kp->arg) = proto->type;124298312431243- return -EINVAL; \984984+ return 0; \1244985}12459861246987static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)1247988{12481248- return sprintf(buffer, "%s\n",12491249- psmouse_max_proto < ARRAY_SIZE(psmouse_proto_abbrev) ?12501250- psmouse_proto_abbrev[psmouse_max_proto] : "any");989989+ int type = *((unsigned int *)kp->arg);990990+991991+ return sprintf(buffer, "%s\n", psmouse_protocol_by_type(type)->name);1251992}12529931253994static int __init psmouse_init(void)
+3-1
drivers/input/mouse/psmouse.h
···7777 PSMOUSE_IMEX,7878 PSMOUSE_SYNAPTICS,7979 PSMOUSE_ALPS,8080+ PSMOUSE_LIFEBOOK,8181+ PSMOUSE_AUTO /* This one should always be last */8082};81838284int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);···10199{ \102100 return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \103101} \104104-static struct device_attribute psmouse_attr_##_name = \102102+static struct device_attribute psmouse_attr_##_name = \105103 __ATTR(_name, S_IWUSR | S_IRUGO, \106104 psmouse_do_show_##_name, psmouse_do_set_##_name);107105
+1-1
drivers/input/mouse/rpcmouse.c
···5959 b = (short) (__raw_readl(0xe0310000) ^ 0x70);60606161 dx = x - rpcmouse_lastx;6262- dy = y - rpcmouse_lasty; 6262+ dy = y - rpcmouse_lasty;63636464 rpcmouse_lastx = x;6565 rpcmouse_lasty = y;
+2-2
drivers/input/mouse/vsxxxaa.c
···11/*22 * Driver for DEC VSXXX-AA mouse (hockey-puck mouse, ball or two rollers)33- * DEC VSXXX-GA mouse (rectangular mouse, with ball)44- * DEC VSXXX-AB tablet (digitizer with hair cross or stylus)33+ * DEC VSXXX-GA mouse (rectangular mouse, with ball)44+ * DEC VSXXX-AB tablet (digitizer with hair cross or stylus)55 *66 * Copyright (C) 2003-2004 by Jan-Benedict Glaw <jbglaw@lug-owl.de>77 *
+6-2
drivers/input/mousedev.c
···220220 struct mousedev_list *list;221221 struct mousedev_motion *p;222222 unsigned long flags;223223+ int wake_readers = 0;223224224225 list_for_each_entry(list, &mousedev->list, node) {225226 spin_lock_irqsave(&list->packet_lock, flags);···256255257256 spin_unlock_irqrestore(&list->packet_lock, flags);258257259259- if (list->ready)258258+ if (list->ready) {260259 kill_fasync(&list->fasync, SIGIO, POLL_IN);260260+ wake_readers = 1;261261+ }261262 }262263263263- wake_up_interruptible(&mousedev->wait);264264+ if (wake_readers)265265+ wake_up_interruptible(&mousedev->wait);264266}265267266268static void mousedev_touchpad_touch(struct mousedev *mousedev, int value)
+100-36
drivers/input/serio/libps2.c
···29293030EXPORT_SYMBOL(ps2_init);3131EXPORT_SYMBOL(ps2_sendbyte);3232+EXPORT_SYMBOL(ps2_drain);3233EXPORT_SYMBOL(ps2_command);3334EXPORT_SYMBOL(ps2_schedule_command);3435EXPORT_SYMBOL(ps2_handle_ack);···464547464847/*4949- * ps2_sendbyte() sends a byte to the mouse, and waits for acknowledge.5050- * It doesn't handle retransmission, though it could - because when there would5151- * be need for retransmissions, the mouse has to be replaced anyway.4848+ * ps2_sendbyte() sends a byte to the device and waits for acknowledge.4949+ * It doesn't handle retransmission, though it could - because if there5050+ * is a need for retransmissions device has to be replaced anyway.5251 *5353- * ps2_sendbyte() can only be called from a process context5252+ * ps2_sendbyte() can only be called from a process context.5453 */55545655int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout)···7372}74737574/*7575+ * ps2_drain() waits for device to transmit requested number of bytes7676+ * and discards them.7777+ */7878+7979+void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout)8080+{8181+ if (maxbytes > sizeof(ps2dev->cmdbuf)) {8282+ WARN_ON(1);8383+ maxbytes = sizeof(ps2dev->cmdbuf);8484+ }8585+8686+ down(&ps2dev->cmd_sem);8787+8888+ serio_pause_rx(ps2dev->serio);8989+ ps2dev->flags = PS2_FLAG_CMD;9090+ ps2dev->cmdcnt = maxbytes;9191+ serio_continue_rx(ps2dev->serio);9292+9393+ wait_event_timeout(ps2dev->wait,9494+ !(ps2dev->flags & PS2_FLAG_CMD),9595+ msecs_to_jiffies(timeout));9696+ up(&ps2dev->cmd_sem);9797+}9898+9999+/*100100+ * ps2_is_keyboard_id() checks received ID byte against the list of101101+ * known keyboard IDs.102102+ */103103+104104+static inline int ps2_is_keyboard_id(char id_byte)105105+{106106+ static char keyboard_ids[] = {107107+ 0xab, /* Regular keyboards */108108+ 0xac, /* NCD Sun keyboard */109109+ 0x2b, /* Trust keyboard, translated */110110+ 0x5d, /* Trust keyboard */111111+ 0x60, /* NMB SGI keyboard, translated */112112+ 0x47, /* NMB SGI keyboard */113113+ };114114+115115+ return memchr(keyboard_ids, id_byte, sizeof(keyboard_ids)) != NULL;116116+}117117+118118+/*119119+ * ps2_adjust_timeout() is called after receiving 1st byte of command120120+ * response and tries to reduce remaining timeout to speed up command121121+ * completion.122122+ */123123+124124+static int ps2_adjust_timeout(struct ps2dev *ps2dev, int command, int timeout)125125+{126126+ switch (command) {127127+ case PS2_CMD_RESET_BAT:128128+ /*129129+ * Device has sent the first response byte after130130+ * reset command, reset is thus done, so we can131131+ * shorten the timeout.132132+ * The next byte will come soon (keyboard) or not133133+ * at all (mouse).134134+ */135135+ if (timeout > msecs_to_jiffies(100))136136+ timeout = msecs_to_jiffies(100);137137+ break;138138+139139+ case PS2_CMD_GETID:140140+ /*141141+ * If device behind the port is not a keyboard there142142+ * won't be 2nd byte of ID response.143143+ */144144+ if (!ps2_is_keyboard_id(ps2dev->cmdbuf[1])) {145145+ serio_pause_rx(ps2dev->serio);146146+ ps2dev->flags = ps2dev->cmdcnt = 0;147147+ serio_continue_rx(ps2dev->serio);148148+ timeout = 0;149149+ }150150+ break;151151+152152+ default:153153+ break;154154+ }155155+156156+ return timeout;157157+}158158+159159+/*76160 * ps2_command() sends a command and its parameters to the mouse,77161 * then waits for the response and puts it in the param array.78162 *···17185 int receive = (command >> 8) & 0xf;17286 int rc = -1;17387 int i;8888+8989+ if (receive > sizeof(ps2dev->cmdbuf)) {9090+ WARN_ON(1);9191+ return -1;9292+ }1749317594 down(&ps2dev->cmd_sem);17695···192101 * ACKing the reset command, and so it can take a long193102 * time before the ACK arrrives.194103 */195195- if (command & 0xff)196196- if (ps2_sendbyte(ps2dev, command & 0xff,197197- command == PS2_CMD_RESET_BAT ? 1000 : 200))198198- goto out;104104+ if (ps2_sendbyte(ps2dev, command & 0xff,105105+ command == PS2_CMD_RESET_BAT ? 1000 : 200))106106+ goto out;199107200108 for (i = 0; i < send; i++)201109 if (ps2_sendbyte(ps2dev, param[i], 200))···210120211121 if (ps2dev->cmdcnt && timeout > 0) {212122213213- if (command == PS2_CMD_RESET_BAT && timeout > msecs_to_jiffies(100)) {214214- /*215215- * Device has sent the first response byte216216- * after a reset command, reset is thus done,217217- * shorten the timeout. The next byte will come218218- * soon (keyboard) or not at all (mouse).219219- */220220- timeout = msecs_to_jiffies(100);221221- }222222-223223- if (command == PS2_CMD_GETID &&224224- ps2dev->cmdbuf[receive - 1] != 0xab && /* Regular keyboards */225225- ps2dev->cmdbuf[receive - 1] != 0xac && /* NCD Sun keyboard */226226- ps2dev->cmdbuf[receive - 1] != 0x2b && /* Trust keyboard, translated */227227- ps2dev->cmdbuf[receive - 1] != 0x5d && /* Trust keyboard */228228- ps2dev->cmdbuf[receive - 1] != 0x60 && /* NMB SGI keyboard, translated */229229- ps2dev->cmdbuf[receive - 1] != 0x47) { /* NMB SGI keyboard */230230- /*231231- * Device behind the port is not a keyboard232232- * so we don't need to wait for the 2nd byte233233- * of ID response.234234- */235235- serio_pause_rx(ps2dev->serio);236236- ps2dev->flags = ps2dev->cmdcnt = 0;237237- serio_continue_rx(ps2dev->serio);238238- }239239-123123+ timeout = ps2_adjust_timeout(ps2dev, command, timeout);240124 wait_event_timeout(ps2dev->wait,241125 !(ps2dev->flags & PS2_FLAG_CMD), timeout);242126 }···224160225161 rc = 0;226162227227-out:163163+ out:228164 serio_pause_rx(ps2dev->serio);229165 ps2dev->flags = 0;230166 serio_continue_rx(ps2dev->serio);
···151151 To compile this driver as a module, choose M here: the152152 module will be called wacom.153153154154+config USB_ACECAD155155+ tristate "Acecad Flair tablet support"156156+ depends on USB && INPUT157157+ help158158+ Say Y here if you want to use the USB version of the Acecad Flair159159+ tablet. Make sure to say Y to "Mouse support"160160+ (CONFIG_INPUT_MOUSEDEV) and/or "Event interface support"161161+ (CONFIG_INPUT_EVDEV) as well.162162+163163+ To compile this driver as a module, choose M here: the164164+ module will be called acecad.165165+154166config USB_KBTAB155167 tristate "KB Gear JamStudio tablet support"156168 depends on USB && INPUT···201189202190 To compile this driver as a module, choose M here: the203191 module will be called mtouchusb.192192+193193+config USB_ITMTOUCH194194+ tristate "ITM Touch USB Touchscreen Driver"195195+ depends on USB && INPUT196196+ ---help---197197+ Say Y here if you want to use a ITM Touch USB198198+ Touchscreen controller.199199+200200+ This touchscreen is used in LG 1510SF monitors.201201+202202+ To compile this driver as a module, choose M here: the203203+ module will be called itmtouch.204204205205config USB_EGALAX206206 tristate "eGalax TouchKit USB Touchscreen Driver"
···11+/*22+ * Copyright (c) 2001-2005 Edouard TISSERANT <edouard.tisserant@wanadoo.fr>33+ * Copyright (c) 2004-2005 Stephane VOLTZ <svoltz@numericable.fr>44+ *55+ * USB Acecad "Acecad Flair" tablet support66+ *77+ * Changelog:88+ * v3.2 - Added sysfs support99+ */1010+1111+/*1212+ * This program is free software; you can redistribute it and/or modify1313+ * it under the terms of the GNU General Public License as published by1414+ * the Free Software Foundation; either version 2 of the License, or1515+ * (at your option) any later version.1616+ *1717+ * This program is distributed in the hope that it will be useful,1818+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1919+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2020+ * GNU General Public License for more details.2121+ *2222+ * You should have received a copy of the GNU General Public License2323+ * along with this program; if not, write to the Free Software2424+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2525+ *2626+ */2727+2828+#include <linux/kernel.h>2929+#include <linux/slab.h>3030+#include <linux/input.h>3131+#include <linux/module.h>3232+#include <linux/init.h>3333+#include <linux/usb.h>3434+3535+/*3636+ * Version Information3737+ */3838+#define DRIVER_VERSION "v3.2"3939+#define DRIVER_DESC "USB Acecad Flair tablet driver"4040+#define DRIVER_LICENSE "GPL"4141+#define DRIVER_AUTHOR "Edouard TISSERANT <edouard.tisserant@wanadoo.fr>"4242+4343+MODULE_AUTHOR(DRIVER_AUTHOR);4444+MODULE_DESCRIPTION(DRIVER_DESC);4545+MODULE_LICENSE(DRIVER_LICENSE);4646+4747+#define USB_VENDOR_ID_ACECAD 0x04604848+#define USB_DEVICE_ID_FLAIR 0x00044949+#define USB_DEVICE_ID_302 0x00085050+5151+struct usb_acecad {5252+ char name[128];5353+ char phys[64];5454+ struct usb_device *usbdev;5555+ struct input_dev dev;5656+ struct urb *irq;5757+5858+ signed char *data;5959+ dma_addr_t data_dma;6060+};6161+6262+static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs)6363+{6464+ struct usb_acecad *acecad = urb->context;6565+ unsigned char *data = acecad->data;6666+ struct input_dev *dev = &acecad->dev;6767+ int prox, status;6868+6969+ switch (urb->status) {7070+ case 0:7171+ /* success */7272+ break;7373+ case -ECONNRESET:7474+ case -ENOENT:7575+ case -ESHUTDOWN:7676+ /* this urb is terminated, clean up */7777+ dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);7878+ return;7979+ default:8080+ dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);8181+ goto resubmit;8282+ }8383+8484+ prox = (data[0] & 0x04) >> 2;8585+ input_report_key(dev, BTN_TOOL_PEN, prox);8686+8787+ if (prox) {8888+ int x = data[1] | (data[2] << 8);8989+ int y = data[3] | (data[4] << 8);9090+ /*Pressure should compute the same way for flair and 302*/9191+ int pressure = data[5] | ((int)data[6] << 8);9292+ int touch = data[0] & 0x01;9393+ int stylus = (data[0] & 0x10) >> 4;9494+ int stylus2 = (data[0] & 0x20) >> 5;9595+ input_report_abs(dev, ABS_X, x);9696+ input_report_abs(dev, ABS_Y, y);9797+ input_report_abs(dev, ABS_PRESSURE, pressure);9898+ input_report_key(dev, BTN_TOUCH, touch);9999+ input_report_key(dev, BTN_STYLUS, stylus);100100+ input_report_key(dev, BTN_STYLUS2, stylus2);101101+ }102102+103103+ /* event termination */104104+ input_sync(dev);105105+106106+resubmit:107107+ status = usb_submit_urb (urb, GFP_ATOMIC);108108+ if (status)109109+ err ("can't resubmit intr, %s-%s/input0, status %d",110110+ acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status);111111+}112112+113113+static int usb_acecad_open(struct input_dev *dev)114114+{115115+ struct usb_acecad *acecad = dev->private;116116+117117+ acecad->irq->dev = acecad->usbdev;118118+ if (usb_submit_urb(acecad->irq, GFP_KERNEL))119119+ return -EIO;120120+121121+ return 0;122122+}123123+124124+static void usb_acecad_close(struct input_dev *dev)125125+{126126+ struct usb_acecad *acecad = dev->private;127127+128128+ usb_kill_urb(acecad->irq);129129+}130130+131131+static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_id *id)132132+{133133+ struct usb_device *dev = interface_to_usbdev(intf);134134+ struct usb_host_interface *interface = intf->cur_altsetting;135135+ struct usb_endpoint_descriptor *endpoint;136136+ struct usb_acecad *acecad;137137+ int pipe, maxp;138138+ char path[64];139139+140140+ if (interface->desc.bNumEndpoints != 1)141141+ return -ENODEV;142142+143143+ endpoint = &interface->endpoint[0].desc;144144+145145+ if (!(endpoint->bEndpointAddress & 0x80))146146+ return -ENODEV;147147+148148+ if ((endpoint->bmAttributes & 3) != 3)149149+ return -ENODEV;150150+151151+ pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);152152+ maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));153153+154154+ acecad = kcalloc(1, sizeof(struct usb_acecad), GFP_KERNEL);155155+ if (!acecad)156156+ return -ENOMEM;157157+158158+ acecad->data = usb_buffer_alloc(dev, 8, SLAB_KERNEL, &acecad->data_dma);159159+ if (!acecad->data)160160+ goto fail1;161161+162162+ acecad->irq = usb_alloc_urb(0, GFP_KERNEL);163163+ if (!acecad->irq)164164+ goto fail2;165165+166166+ if (dev->manufacturer)167167+ strlcpy(acecad->name, dev->manufacturer, sizeof(acecad->name));168168+169169+ if (dev->product) {170170+ if (dev->manufacturer)171171+ strlcat(acecad->name, " ", sizeof(acecad->name));172172+ strlcat(acecad->name, dev->product, sizeof(acecad->name));173173+ }174174+175175+ usb_make_path(dev, path, sizeof(path));176176+ snprintf(acecad->phys, sizeof(acecad->phys), "%s/input0", path);177177+178178+ acecad->usbdev = dev;179179+180180+ acecad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);181181+ acecad->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);182182+ acecad->dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);183183+ acecad->dev.keybit[LONG(BTN_DIGI)] = BIT(BTN_TOOL_PEN) |BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2);184184+185185+ switch (id->driver_info) {186186+ case 0:187187+ acecad->dev.absmax[ABS_X] = 5000;188188+ acecad->dev.absmax[ABS_Y] = 3750;189189+ acecad->dev.absmax[ABS_PRESSURE] = 512;190190+ if (!strlen(acecad->name))191191+ snprintf(acecad->name, sizeof(acecad->name),192192+ "USB Acecad Flair Tablet %04x:%04x",193193+ dev->descriptor.idVendor, dev->descriptor.idProduct);194194+ break;195195+ case 1:196196+ acecad->dev.absmax[ABS_X] = 3000;197197+ acecad->dev.absmax[ABS_Y] = 2250;198198+ acecad->dev.absmax[ABS_PRESSURE] = 1024;199199+ if (!strlen(acecad->name))200200+ snprintf(acecad->name, sizeof(acecad->name),201201+ "USB Acecad 302 Tablet %04x:%04x",202202+ dev->descriptor.idVendor, dev->descriptor.idProduct);203203+ break;204204+ }205205+206206+ acecad->dev.absfuzz[ABS_X] = 4;207207+ acecad->dev.absfuzz[ABS_Y] = 4;208208+209209+ acecad->dev.private = acecad;210210+ acecad->dev.open = usb_acecad_open;211211+ acecad->dev.close = usb_acecad_close;212212+213213+ acecad->dev.name = acecad->name;214214+ acecad->dev.phys = acecad->phys;215215+ acecad->dev.id.bustype = BUS_USB;216216+ acecad->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);217217+ acecad->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);218218+ acecad->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);219219+ acecad->dev.dev = &intf->dev;220220+221221+ usb_fill_int_urb(acecad->irq, dev, pipe,222222+ acecad->data, maxp > 8 ? 8 : maxp,223223+ usb_acecad_irq, acecad, endpoint->bInterval);224224+ acecad->irq->transfer_dma = acecad->data_dma;225225+ acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;226226+227227+ input_register_device(&acecad->dev);228228+229229+ printk(KERN_INFO "input: %s with packet size %d on %s\n",230230+ acecad->name, maxp, path);231231+232232+ usb_set_intfdata(intf, acecad);233233+234234+ return 0;235235+236236+ fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma);237237+ fail1: kfree(acecad);238238+ return -ENOMEM;239239+}240240+241241+static void usb_acecad_disconnect(struct usb_interface *intf)242242+{243243+ struct usb_acecad *acecad = usb_get_intfdata(intf);244244+245245+ usb_set_intfdata(intf, NULL);246246+ if (acecad) {247247+ usb_kill_urb(acecad->irq);248248+ input_unregister_device(&acecad->dev);249249+ usb_free_urb(acecad->irq);250250+ usb_buffer_free(interface_to_usbdev(intf), 10, acecad->data, acecad->data_dma);251251+ kfree(acecad);252252+ }253253+}254254+255255+static struct usb_device_id usb_acecad_id_table [] = {256256+ { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_FLAIR), .driver_info = 0 },257257+ { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_302), .driver_info = 1 },258258+ { }259259+};260260+261261+MODULE_DEVICE_TABLE(usb, usb_acecad_id_table);262262+263263+static struct usb_driver usb_acecad_driver = {264264+ .owner = THIS_MODULE,265265+ .name = "usb_acecad",266266+ .probe = usb_acecad_probe,267267+ .disconnect = usb_acecad_disconnect,268268+ .id_table = usb_acecad_id_table,269269+};270270+271271+static int __init usb_acecad_init(void)272272+{273273+ int result = usb_register(&usb_acecad_driver);274274+ if (result == 0)275275+ info(DRIVER_VERSION ":" DRIVER_DESC);276276+ return result;277277+}278278+279279+static void __exit usb_acecad_exit(void)280280+{281281+ usb_deregister(&usb_acecad_driver);282282+}283283+284284+module_init(usb_acecad_init);285285+module_exit(usb_acecad_exit);
+11-21
drivers/usb/input/aiptek.c
···11/*22 * Native support for the Aiptek HyperPen USB Tablets33 * (4000U/5000U/6000U/8000U/12000U)44- * 44+ *55 * Copyright (c) 2001 Chris Atenasio <chris@crud.net>66 * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net>77 *···3131 * - Added support for the sysfs interface, deprecating the3232 * procfs interface for 2.5.x kernel. Also added support for3333 * Wheel command. Bryan W. Headley July-15-2003.3434- * v1.2 - Reworked jitter timer as a kernel thread. 3434+ * v1.2 - Reworked jitter timer as a kernel thread.3535 * Bryan W. Headley November-28-2003/Jan-10-2004.3636 * v1.3 - Repaired issue of kernel thread going nuts on single-processor3737 * machines, introduced programmableDelay as a command line···4949 * NOTE:5050 * This kernel driver is augmented by the "Aiptek" XFree86 input5151 * driver for your X server, as well as the Gaiptek GUI Front-end5252- * "Tablet Manager". 5353- * These three products are highly interactive with one another, 5252+ * "Tablet Manager".5353+ * These three products are highly interactive with one another,5454 * so therefore it's easier to document them all as one subsystem.5555- * Please visit the project's "home page", located at, 5555+ * Please visit the project's "home page", located at,5656 * http://aiptektablet.sourceforge.net.5757 *5858 * This program is free software; you can redistribute it and/or modify···156156 * Command/Data Description Return Bytes Return Value157157 * 0x10/0x00 SwitchToMouse 0158158 * 0x10/0x01 SwitchToTablet 0159159- * 0x18/0x04 SetResolution 0 159159+ * 0x18/0x04 SetResolution 0160160 * 0x12/0xFF AutoGainOn 0161161 * 0x17/0x00 FilterOn 0162162 * 0x01/0x00 GetXExtension 2 MaxX···247247#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2248248#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3249249250250- /* Time to wait (in ms) to help mask hand jittering 250250+ /* Time to wait (in ms) to help mask hand jittering251251 * when pressing the stylus buttons.252252 */253253#define AIPTEK_JITTER_DELAY_DEFAULT 50···324324 struct aiptek_settings curSetting; /* tablet's current programmable */325325 struct aiptek_settings newSetting; /* ... and new param settings */326326 unsigned int ifnum; /* interface number for IO */327327- int openCount; /* module use counter */328327 int diagnostic; /* tablet diagnostic codes */329328 unsigned long eventCount; /* event count */330329 int inDelay; /* jitter: in jitter delay? */···790791 * specific Aiptek model numbers, because there has been overlaps,791792 * use, and reuse of id's in existing models. Certain models have792793 * been known to use more than one ID, indicative perhaps of793793- * manufacturing revisions. In any event, we consider these 794794+ * manufacturing revisions. In any event, we consider these794795 * IDs to not be model-specific nor unique.795796 */796797static const struct usb_device_id aiptek_ids[] = {···813814{814815 struct aiptek *aiptek = inputdev->private;815816816816- if (aiptek->openCount++ > 0) {817817- return 0;818818- }819819-820817 aiptek->urb->dev = aiptek->usbdev;821821- if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) {822822- aiptek->openCount--;818818+ if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)823819 return -EIO;824824- }825820826821 return 0;827822}···827834{828835 struct aiptek *aiptek = inputdev->private;829836830830- if (--aiptek->openCount == 0) {831831- usb_kill_urb(aiptek->urb);832832- }837837+ usb_kill_urb(aiptek->urb);833838}834839835840/***********************************************************************836836- * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, 841841+ * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x,837842 * where they were known as usb_set_report and usb_get_report.838843 */839844static int···22432252 AIPTEK_PACKET_LENGTH,22442253 aiptek->data, aiptek->data_dma);22452254 kfree(aiptek);22462246- aiptek = NULL;22472255 }22482256}22492257
+114-133
drivers/usb/input/ati_remote.c
···11-/* 11+/*22 * USB ATI Remote support33 *44 * Version 2.2.0 Copyright (c) 2004 Torrey Hoffman <thoffman@arnor.net>55 * Version 2.1.1 Copyright (c) 2002 Vladimir Dergachev66 *77 * This 2.2.0 version is a rewrite / cleanup of the 2.1.1 driver, including88- * porting to the 2.6 kernel interfaces, along with other modification 88+ * porting to the 2.6 kernel interfaces, along with other modification99 * to better match the style of the existing usb/input drivers. However, the1010 * protocol and hardware handling is essentially unchanged from 2.1.1.1111- * 1212- * The 2.1.1 driver was derived from the usbati_remote and usbkbd drivers by 1111+ *1212+ * The 2.1.1 driver was derived from the usbati_remote and usbkbd drivers by1313 * Vojtech Pavlik.1414 *1515 * Changes:···2323 * Added support for the "Lola" remote contributed by:2424 * Seth Cohn <sethcohn@yahoo.com>2525 *2626- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2626+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *2727 *2828 * This program is free software; you can redistribute it and/or modify2929 * it under the terms of the GNU General Public License as published by3030- * the Free Software Foundation; either version 2 of the License, or 3030+ * the Free Software Foundation; either version 2 of the License, or3131 * (at your option) any later version.3232- * 3232+ *3333 * This program is distributed in the hope that it will be useful,3434 * but WITHOUT ANY WARRANTY; without even the implied warranty of3535 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3636 * GNU General Public License for more details.3737- * 3737+ *3838 * You should have received a copy of the GNU General Public License3939 * along with this program; if not, write to the Free Software4040 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA4141- * 4242- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 4141+ *4242+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *4343 *4444 * Hardware & software notes4545 *4646- * These remote controls are distributed by ATI as part of their 4747- * "All-In-Wonder" video card packages. The receiver self-identifies as a 4646+ * These remote controls are distributed by ATI as part of their4747+ * "All-In-Wonder" video card packages. The receiver self-identifies as a4848 * "USB Receiver" with manufacturer "X10 Wireless Technology Inc".4949 *5050- * The "Lola" remote is available from X10. See: 5050+ * The "Lola" remote is available from X10. See:5151 * http://www.x10.com/products/lola_sg1.htm5252 * The Lola is similar to the ATI remote but has no mouse support, and slightly5353 * different keys.5454 *5555- * It is possible to use multiple receivers and remotes on multiple computers 5555+ * It is possible to use multiple receivers and remotes on multiple computers5656 * simultaneously by configuring them to use specific channels.5757- * 5858- * The RF protocol used by the remote supports 16 distinct channels, 1 to 16. 5959- * Actually, it may even support more, at least in some revisions of the 5757+ *5858+ * The RF protocol used by the remote supports 16 distinct channels, 1 to 16.5959+ * Actually, it may even support more, at least in some revisions of the6060 * hardware.6161 *6262 * Each remote can be configured to transmit on one channel as follows:6363- * - Press and hold the "hand icon" button. 6464- * - When the red LED starts to blink, let go of the "hand icon" button. 6565- * - When it stops blinking, input the channel code as two digits, from 01 6363+ * - Press and hold the "hand icon" button.6464+ * - When the red LED starts to blink, let go of the "hand icon" button.6565+ * - When it stops blinking, input the channel code as two digits, from 016666 * to 16, and press the hand icon again.6767- * 6767+ *6868 * The timing can be a little tricky. Try loading the module with debug=16969 * to have the kernel print out messages about the remote control number7070 * and mask. Note: debugging prints remote numbers as zero-based hexadecimal.7171 *7272 * The driver has a "channel_mask" parameter. This bitmask specifies which7373- * channels will be ignored by the module. To mask out channels, just add 7373+ * channels will be ignored by the module. To mask out channels, just add7474 * all the 2^channel_number values together.7575 *7676 * For instance, set channel_mask = 2^4 = 16 (binary 10000) to make ati_remote7777- * ignore signals coming from remote controls transmitting on channel 4, but 7777+ * ignore signals coming from remote controls transmitting on channel 4, but7878 * accept all other channels.7979 *8080- * Or, set channel_mask = 65533, (0xFFFD), and all channels except 1 will be 8080+ * Or, set channel_mask = 65533, (0xFFFD), and all channels except 1 will be8181 * ignored.8282 *8383- * The default is 0 (respond to all channels). Bit 0 and bits 17-32 of this 8383+ * The default is 0 (respond to all channels). Bit 0 and bits 17-32 of this8484 * parameter are unused.8585 *8686 */···9999/*100100 * Module and Version Information, Module Parameters101101 */102102-103103-#define ATI_REMOTE_VENDOR_ID 0x0bc7104104-#define ATI_REMOTE_PRODUCT_ID 0x004105105-#define LOLA_REMOTE_PRODUCT_ID 0x002102102+103103+#define ATI_REMOTE_VENDOR_ID 0x0bc7104104+#define ATI_REMOTE_PRODUCT_ID 0x004105105+#define LOLA_REMOTE_PRODUCT_ID 0x002106106#define MEDION_REMOTE_PRODUCT_ID 0x006107107108108-#define DRIVER_VERSION "2.2.1"108108+#define DRIVER_VERSION "2.2.1"109109#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>"110110#define DRIVER_DESC "ATI/X10 RF USB Remote Control"111111···113113#define DATA_BUFSIZE 63 /* size of URB data buffers */114114#define ATI_INPUTNUM 1 /* Which input device to register as */115115116116-static unsigned long channel_mask = 0;116116+static unsigned long channel_mask;117117module_param(channel_mask, ulong, 0444);118118MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore");119119120120-static int debug = 0;120120+static int debug;121121module_param(debug, int, 0444);122122MODULE_PARM_DESC(debug, "Enable extra debug messages and information");123123124124#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)125125#undef err126126#define err(format, arg...) printk(KERN_ERR format , ## arg)127127-127127+128128static struct usb_device_id ati_remote_table[] = {129129 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },130130 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) },···148148/* Acceleration curve for directional control pad */149149static char accel[] = { 1, 2, 4, 6, 9, 13, 20 };150150151151-/* Duplicate event filtering time. 151151+/* Duplicate event filtering time.152152 * Sequential, identical KIND_FILTERED inputs with less than153153 * FILTER_TIME jiffies between them are considered as repeat154154 * events. The hardware generates 5 events for the first keypress···161161static DECLARE_MUTEX(disconnect_sem);162162163163struct ati_remote {164164- struct input_dev idev; 164164+ struct input_dev idev;165165 struct usb_device *udev;166166 struct usb_interface *interface;167167-167167+168168 struct urb *irq_urb;169169 struct urb *out_urb;170170 struct usb_endpoint_descriptor *endpoint_in;···174174 dma_addr_t inbuf_dma;175175 dma_addr_t outbuf_dma;176176177177- int open; /* open counter */178178-179177 unsigned char old_data[2]; /* Detect duplicate events */180178 unsigned long old_jiffies;181179 unsigned long acc_jiffies; /* handle acceleration */182180 unsigned int repeat_count;183183-181181+184182 char name[NAME_BUFSIZE];185183 char phys[NAME_BUFSIZE];186184···204206 int type;205207 unsigned int code;206208 int value;207207-} ati_remote_tbl[] = 209209+} ati_remote_tbl[] =208210{209211 /* Directional control pad axes */210212 {KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */211213 {KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */212214 {KIND_ACCEL, 0x37, 0x72, EV_REL, REL_Y, -1}, /* up */213215 {KIND_ACCEL, 0x38, 0x73, EV_REL, REL_Y, 1}, /* down */214214- /* Directional control pad diagonals */ 216216+ /* Directional control pad diagonals */215217 {KIND_LU, 0x39, 0x74, EV_REL, 0, 0}, /* left up */216218 {KIND_RU, 0x3a, 0x75, EV_REL, 0, 0}, /* right up */217219 {KIND_LD, 0x3c, 0x77, EV_REL, 0, 0}, /* left down */···223225 {KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */224226 {KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */225227226226- /* Artificial "doubleclick" events are generated by the hardware. 228228+ /* Artificial "doubleclick" events are generated by the hardware.227229 * They are mapped to the "side" and "extra" mouse buttons here. */228230 {KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */229231 {KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */···271273 {KIND_FILTERED, 0xea, 0x25, EV_KEY, KEY_PLAY, 1}, /* ( >) */272274 {KIND_FILTERED, 0xe9, 0x24, EV_KEY, KEY_REWIND, 1}, /* (<<) */273275 {KIND_FILTERED, 0xeb, 0x26, EV_KEY, KEY_FORWARD, 1}, /* (>>) */274274- {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */ 276276+ {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */275277 {KIND_FILTERED, 0xee, 0x29, EV_KEY, KEY_PAUSE, 1}, /* ('') */276278 {KIND_FILTERED, 0xf0, 0x2b, EV_KEY, KEY_PREVIOUS, 1}, /* (<-) */277279 {KIND_FILTERED, 0xef, 0x2a, EV_KEY, KEY_NEXT, 1}, /* (>+) */278280 {KIND_FILTERED, 0xf2, 0x2D, EV_KEY, KEY_INFO, 1}, /* PLAYING */279281 {KIND_FILTERED, 0xf3, 0x2E, EV_KEY, KEY_HOME, 1}, /* TOP */280282 {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1}, /* END */281281- {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */ 282282-283283+ {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */284284+283285 {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0}284286};285287···313315 if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00))314316 warn("Weird byte 0x%02x", data[0]);315317 else if (len == 4)316316- warn("Weird key %02x %02x %02x %02x", 318318+ warn("Weird key %02x %02x %02x %02x",317319 data[0], data[1], data[2], data[3]);318320 else319321 warn("Weird data, len=%d %02x %02x %02x %02x %02x %02x ...",···326328static int ati_remote_open(struct input_dev *inputdev)327329{328330 struct ati_remote *ati_remote = inputdev->private;329329- int retval = 0;330330-331331- down(&disconnect_sem);332332-333333- if (ati_remote->open++)334334- goto exit;335331336332 /* On first open, submit the read urb which was set up previously. */337333 ati_remote->irq_urb->dev = ati_remote->udev;338334 if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) {339339- dev_err(&ati_remote->interface->dev, 335335+ dev_err(&ati_remote->interface->dev,340336 "%s: usb_submit_urb failed!\n", __FUNCTION__);341341- ati_remote->open--;342342- retval = -EIO;337337+ return -EIO;343338 }344339345345-exit:346346- up(&disconnect_sem);347347- return retval;340340+ return 0;348341}349342350343/*···344355static void ati_remote_close(struct input_dev *inputdev)345356{346357 struct ati_remote *ati_remote = inputdev->private;347347-348348- if (!--ati_remote->open)349349- usb_kill_urb(ati_remote->irq_urb);358358+359359+ usb_kill_urb(ati_remote->irq_urb);350360}351361352362/*···354366static void ati_remote_irq_out(struct urb *urb, struct pt_regs *regs)355367{356368 struct ati_remote *ati_remote = urb->context;357357-369369+358370 if (urb->status) {359371 dev_dbg(&ati_remote->interface->dev, "%s: status %d\n",360372 __FUNCTION__, urb->status);361373 return;362374 }363363-375375+364376 ati_remote->send_flags |= SEND_FLAG_COMPLETE;365377 wmb();366378 wake_up(&ati_remote->wait);···368380369381/*370382 * ati_remote_sendpacket371371- * 383383+ *372384 * Used to send device initialization strings373385 */374386static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data)375387{376388 int retval = 0;377377-389389+378390 /* Set up out_urb */379391 memcpy(ati_remote->out_urb->transfer_buffer + 1, data, LO(cmd));380380- ((char *) ati_remote->out_urb->transfer_buffer)[0] = HI(cmd); 392392+ ((char *) ati_remote->out_urb->transfer_buffer)[0] = HI(cmd);381393382394 ati_remote->out_urb->transfer_buffer_length = LO(cmd) + 1;383395 ati_remote->out_urb->dev = ati_remote->udev;···385397386398 retval = usb_submit_urb(ati_remote->out_urb, GFP_ATOMIC);387399 if (retval) {388388- dev_dbg(&ati_remote->interface->dev, 400400+ dev_dbg(&ati_remote->interface->dev,389401 "sendpacket: usb_submit_urb failed: %d\n", retval);390402 return retval;391403 }392404393405 wait_event_timeout(ati_remote->wait,394406 ((ati_remote->out_urb->status != -EINPROGRESS) ||395395- (ati_remote->send_flags & SEND_FLAG_COMPLETE)),407407+ (ati_remote->send_flags & SEND_FLAG_COMPLETE)),396408 HZ);397409 usb_kill_urb(ati_remote->out_urb);398398-410410+399411 return retval;400412}401413···407419 int i;408420409421 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {410410- /* 411411- * Decide if the table entry matches the remote input. 422422+ /*423423+ * Decide if the table entry matches the remote input.412424 */413425 if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) &&414414- ((((ati_remote_tbl[i].data1 >> 4) - 415415- (d1 >> 4) + rem) & 0x0f) == 0x0f) && 426426+ ((((ati_remote_tbl[i].data1 >> 4) -427427+ (d1 >> 4) + rem) & 0x0f) == 0x0f) &&416428 (ati_remote_tbl[i].data2 == d2))417429 return i;418418-430430+419431 }420432 return -1;421433}···423435/*424436 * ati_remote_report_input425437 */426426-static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) 438438+static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)427439{428440 struct ati_remote *ati_remote = urb->context;429441 unsigned char *data= ati_remote->inbuf;430430- struct input_dev *dev = &ati_remote->idev; 442442+ struct input_dev *dev = &ati_remote->idev;431443 int index, acc;432444 int remote_num;433433-445445+434446 /* Deal with strange looking inputs */435435- if ( (urb->actual_length != 4) || (data[0] != 0x14) || 447447+ if ( (urb->actual_length != 4) || (data[0] != 0x14) ||436448 ((data[3] & 0x0f) != 0x00) ) {437449 ati_remote_dump(data, urb->actual_length);438450 return;···441453 /* Mask unwanted remote channels. */442454 /* note: remote_num is 0-based, channel 1 on remote == 0 here */443455 remote_num = (data[3] >> 4) & 0x0f;444444- if (channel_mask & (1 << (remote_num + 1))) { 456456+ if (channel_mask & (1 << (remote_num + 1))) {445457 dbginfo(&ati_remote->interface->dev,446458 "Masked input from channel 0x%02x: data %02x,%02x, mask= 0x%02lx\n",447459 remote_num, data[1], data[2], channel_mask);···451463 /* Look up event code index in translation table */452464 index = ati_remote_event_lookup(remote_num, data[1], data[2]);453465 if (index < 0) {454454- dev_warn(&ati_remote->interface->dev, 455455- "Unknown input from channel 0x%02x: data %02x,%02x\n", 466466+ dev_warn(&ati_remote->interface->dev,467467+ "Unknown input from channel 0x%02x: data %02x,%02x\n",456468 remote_num, data[1], data[2]);457469 return;458458- } 459459- dbginfo(&ati_remote->interface->dev, 470470+ }471471+ dbginfo(&ati_remote->interface->dev,460472 "channel 0x%02x; data %02x,%02x; index %d; keycode %d\n",461473 remote_num, data[1], data[2], index, ati_remote_tbl[index].code);462462-474474+463475 if (ati_remote_tbl[index].kind == KIND_LITERAL) {464476 input_regs(dev, regs);465477 input_event(dev, ati_remote_tbl[index].type,466478 ati_remote_tbl[index].code,467479 ati_remote_tbl[index].value);468480 input_sync(dev);469469-481481+470482 ati_remote->old_jiffies = jiffies;471483 return;472484 }473473-485485+474486 if (ati_remote_tbl[index].kind == KIND_FILTERED) {475487 /* Filter duplicate events which happen "too close" together. */476476- if ((ati_remote->old_data[0] == data[1]) && 477477- (ati_remote->old_data[1] == data[2]) && 478478- ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) {488488+ if ((ati_remote->old_data[0] == data[1]) &&489489+ (ati_remote->old_data[1] == data[2]) &&490490+ ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) {479491 ati_remote->repeat_count++;480480- } 481481- else {492492+ } else {482493 ati_remote->repeat_count = 0;483494 }484484-495495+485496 ati_remote->old_data[0] = data[1];486497 ati_remote->old_data[1] = data[2];487498 ati_remote->old_jiffies = jiffies;···488501 if ((ati_remote->repeat_count > 0)489502 && (ati_remote->repeat_count < 5))490503 return;491491-504504+492505493506 input_regs(dev, regs);494507 input_event(dev, ati_remote_tbl[index].type,···498511 input_sync(dev);499512500513 return;501501- } 502502-503503- /* 514514+ }515515+516516+ /*504517 * Other event kinds are from the directional control pad, and have an505518 * acceleration factor applied to them. Without this acceleration, the506519 * control pad is mostly unusable.507507- * 520520+ *508521 * If elapsed time since last event is > 1/4 second, user "stopped",509522 * so reset acceleration. Otherwise, user is probably holding the control510523 * pad down, so we increase acceleration, ramping up over two seconds to···546559 input_report_rel(dev, REL_Y, acc);547560 break;548561 default:549549- dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", 562562+ dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n",550563 ati_remote_tbl[index].kind);551564 }552565 input_sync(dev);···573586 case -ESHUTDOWN:574587 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n",575588 __FUNCTION__);576576- return; 589589+ return;577590 default: /* error */578578- dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", 591591+ dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n",579592 __FUNCTION__, urb->status);580593 }581581-594594+582595 retval = usb_submit_urb(urb, SLAB_ATOMIC);583596 if (retval)584597 dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n",···590603 */591604static void ati_remote_delete(struct ati_remote *ati_remote)592605{593593- if (!ati_remote) return;594594-595606 if (ati_remote->irq_urb)596607 usb_kill_urb(ati_remote->irq_urb);597608···599614 input_unregister_device(&ati_remote->idev);600615601616 if (ati_remote->inbuf)602602- usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, 617617+ usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,603618 ati_remote->inbuf, ati_remote->inbuf_dma);604604-619619+605620 if (ati_remote->outbuf)606606- usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, 621621+ usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,607622 ati_remote->outbuf, ati_remote->outbuf_dma);608608-623623+609624 if (ati_remote->irq_urb)610625 usb_free_urb(ati_remote->irq_urb);611611-626626+612627 if (ati_remote->out_urb)613628 usb_free_urb(ati_remote->out_urb);614629···621636 int i;622637623638 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);624624- idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) | 639639+ idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) |625640 BIT(BTN_SIDE) | BIT(BTN_EXTRA) );626641 idev->relbit[0] = BIT(REL_X) | BIT(REL_Y);627642 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++)628643 if (ati_remote_tbl[i].type == EV_KEY)629644 set_bit(ati_remote_tbl[i].code, idev->keybit);630630-645645+631646 idev->private = ati_remote;632647 idev->open = ati_remote_open;633648 idev->close = ati_remote_close;634634-649649+635650 idev->name = ati_remote->name;636651 idev->phys = ati_remote->phys;637637-638638- idev->id.bustype = BUS_USB; 652652+653653+ idev->id.bustype = BUS_USB;639654 idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor);640655 idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct);641656 idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice);···645660{646661 struct usb_device *udev = ati_remote->udev;647662 int pipe, maxp;648648-663663+649664 init_waitqueue_head(&ati_remote->wait);650665651666 /* Set up irq_urb */652667 pipe = usb_rcvintpipe(udev, ati_remote->endpoint_in->bEndpointAddress);653668 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));654669 maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;655655-656656- usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf, 657657- maxp, ati_remote_irq_in, ati_remote, 670670+671671+ usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf,672672+ maxp, ati_remote_irq_in, ati_remote,658673 ati_remote->endpoint_in->bInterval);659674 ati_remote->irq_urb->transfer_dma = ati_remote->inbuf_dma;660675 ati_remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;661661-676676+662677 /* Set up out_urb */663678 pipe = usb_sndintpipe(udev, ati_remote->endpoint_out->bEndpointAddress);664679 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));665680 maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;666681667667- usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf, 668668- maxp, ati_remote_irq_out, ati_remote, 682682+ usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf,683683+ maxp, ati_remote_irq_out, ati_remote,669684 ati_remote->endpoint_out->bInterval);670685 ati_remote->out_urb->transfer_dma = ati_remote->outbuf_dma;671686 ati_remote->out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;···673688 /* send initialization strings */674689 if ((ati_remote_sendpacket(ati_remote, 0x8004, init1)) ||675690 (ati_remote_sendpacket(ati_remote, 0x8007, init2))) {676676- dev_err(&ati_remote->interface->dev, 691691+ dev_err(&ati_remote->interface->dev,677692 "Initializing ati_remote hardware failed.\n");678693 return 1;679694 }680680-695695+681696 return 0;682697}683698···754769755770 if (!strlen(ati_remote->name))756771 sprintf(ati_remote->name, DRIVER_DESC "(%04x,%04x)",757757- le16_to_cpu(ati_remote->udev->descriptor.idVendor), 772772+ le16_to_cpu(ati_remote->udev->descriptor.idVendor),758773 le16_to_cpu(ati_remote->udev->descriptor.idProduct));759774760775 /* Device Hardware Initialization - fills in ati_remote->idev from udev. */···766781 ati_remote_input_init(ati_remote);767782 input_register_device(&ati_remote->idev);768783769769- dev_info(&ati_remote->interface->dev, "Input registered: %s on %s\n", 784784+ dev_info(&ati_remote->interface->dev, "Input registered: %s on %s\n",770785 ati_remote->name, path);771786772787 usb_set_intfdata(interface, ati_remote);773773-788788+774789error:775790 if (retval)776791 ati_remote_delete(ati_remote);···785800{786801 struct ati_remote *ati_remote;787802788788- down(&disconnect_sem);789789-790803 ati_remote = usb_get_intfdata(interface);791804 usb_set_intfdata(interface, NULL);792805 if (!ati_remote) {793806 warn("%s - null device?\n", __FUNCTION__);794807 return;795808 }796796-797797- ati_remote_delete(ati_remote);798809799799- up(&disconnect_sem);810810+ ati_remote_delete(ati_remote);800811}801812802813/*···801820static int __init ati_remote_init(void)802821{803822 int result;804804-823823+805824 result = usb_register(&ati_remote_driver);806825 if (result)807826 err("usb_register error #%d\n", result);···819838 usb_deregister(&ati_remote_driver);820839}821840822822-/* 823823- * module specification 841841+/*842842+ * module specification824843 */825844826845module_init(ati_remote_init);
···164164 case HID_GD_X: case HID_GD_Y: case HID_GD_Z:165165 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:166166 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL:167167- if (field->flags & HID_MAIN_ITEM_RELATIVE) 167167+ if (field->flags & HID_MAIN_ITEM_RELATIVE)168168 map_rel(usage->hid & 0xf);169169 else170170 map_abs(usage->hid & 0xf);···297297 case HID_UP_MSVENDOR:298298299299 goto ignore;300300-300300+301301 case HID_UP_PID:302302303303 set_bit(EV_FF, input->evbit);···349349 goto ignore;350350351351 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) &&352352- (usage->type == EV_REL) && (usage->code == REL_WHEEL)) 352352+ (usage->type == EV_REL) && (usage->code == REL_WHEEL))353353 set_bit(REL_HWHEEL, bit);354354355355 if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005))···365365 a = field->logical_minimum = 0;366366 b = field->logical_maximum = 255;367367 }368368-368368+369369 if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK)370370 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4);371371 else input_set_abs_params(input, usage->code, a, b, 0, 0);372372-372372+373373 }374374375375 if (usage->hat_min < usage->hat_max || usage->hat_dir) {···420420 return;421421 }422422423423- if (usage->hat_min < usage->hat_max || usage->hat_dir) { 423423+ if (usage->hat_min < usage->hat_max || usage->hat_dir) {424424 int hat_dir = usage->hat_dir;425425 if (!hat_dir)426426 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1;···551551 for (i = 0; i < hid->maxcollection; i++)552552 if (hid->collection[i].type == HID_COLLECTION_APPLICATION ||553553 hid->collection[i].type == HID_COLLECTION_PHYSICAL)554554- if (IS_INPUT_APPLICATION(hid->collection[i].usage))554554+ if (IS_INPUT_APPLICATION(hid->collection[i].usage))555555 break;556556557557 if (i == hid->maxcollection)···592592 for (j = 0; j < report->field[i]->maxusage; j++)593593 hidinput_configure_usage(hidinput, report->field[i],594594 report->field[i]->usage + j);595595-595595+596596 if (hid->quirks & HID_QUIRK_MULTI_INPUT) {597597 /* This will leave hidinput NULL, so that it598598 * allocates another one if we have more inputs on
+9-9
drivers/usb/input/hid-lgff.c
···9494 isn't really necessary */95959696 unsigned long flags[1]; /* Contains various information about the9797- state of the driver for this device */ 9797+ state of the driver for this device */98989999 struct timer_list timer;100100};···234234 kfree(ret);235235 return NULL;236236 }237237- memset(ret->field[0]->value, 0, sizeof(s32[8])); 237237+ memset(ret->field[0]->value, 0, sizeof(s32[8]));238238239239 return ret;240240}···295295 unsigned long flags;296296297297 if (type != EV_FF) return -EINVAL;298298- if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES;298298+ if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES;299299 if (value < 0) return -EINVAL;300300301301 spin_lock_irqsave(&lgff->lock, flags);302302-302302+303303 if (value > 0) {304304 if (test_bit(EFFECT_STARTED, effect->flags)) {305305 spin_unlock_irqrestore(&lgff->lock, flags);···345345 and perform ioctls on the same fd all at the same time */346346 if ( current->pid == lgff->effects[i].owner347347 && test_bit(EFFECT_USED, lgff->effects[i].flags)) {348348-348348+349349 if (hid_lgff_erase(dev, i))350350 warn("erase effect %d failed", i);351351 }···378378 struct lgff_effect new;379379 int id;380380 unsigned long flags;381381-381381+382382 dbg("ioctl rumble");383383384384 if (!test_bit(effect->type, input->ffbit)) return -EINVAL;···441441442442 spin_lock_irqsave(&lgff->lock, flags);443443444444- for (i=0; i<LGFF_EFFECTS; ++i) {444444+ for (i=0; i<LGFF_EFFECTS; ++i) {445445 struct lgff_effect* effect = lgff->effects +i;446446447447 if (test_bit(EFFECT_PLAYING, effect->flags)) {···491491 set_bit(EFFECT_PLAYING, lgff->effects[i].flags);492492 }493493 }494494- }494494+ }495495496496#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff497497···524524 add_timer(&lgff->timer);525525 }526526527527- spin_unlock_irqrestore(&lgff->lock, flags);527527+ spin_unlock_irqrestore(&lgff->lock, flags);528528}
···9595 return NULL;9696 rinfo->report_id = ((struct hid_report *) list)->id;9797 break;9898-9898+9999 case HID_REPORT_ID_NEXT:100100 list = (struct list_head *)101101 report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK];···106106 return NULL;107107 rinfo->report_id = ((struct hid_report *) list)->id;108108 break;109109-109109+110110 default:111111 return NULL;112112 }···158158 if (uref->field_index != HID_FIELD_INDEX_NONE ||159159 (list->flags & HIDDEV_FLAG_REPORT) != 0) {160160 list->buffer[list->head] = *uref;161161- list->head = (list->head + 1) & 161161+ list->head = (list->head + 1) &162162 (HIDDEV_BUFFER_SIZE - 1);163163 kill_fasync(&list->fasync, SIGIO, POLL_IN);164164 }···179179 unsigned type = field->report_type;180180 struct hiddev_usage_ref uref;181181182182- uref.report_type = 182182+ uref.report_type =183183 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :184184- ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : 184184+ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :185185 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));186186 uref.report_id = field->report->id;187187 uref.field_index = field->index;···199199 struct hiddev_usage_ref uref;200200201201 memset(&uref, 0, sizeof(uref));202202- uref.report_type = 202202+ uref.report_type =203203 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :204204- ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : 204204+ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :205205 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));206206 uref.report_id = report->id;207207 uref.field_index = HID_FIELD_INDEX_NONE;···236236 *listptr = (*listptr)->next;237237238238 if (!--list->hiddev->open) {239239- if (list->hiddev->exist) 239239+ if (list->hiddev->exist)240240 hid_close(list->hiddev->hid);241241 else242242 kfree(list->hiddev);···303303 if (list->head == list->tail) {304304 add_wait_queue(&list->hiddev->wait, &wait);305305 set_current_state(TASK_INTERRUPTIBLE);306306-306306+307307 while (list->head == list->tail) {308308 if (file->f_flags & O_NONBLOCK) {309309 retval = -EAGAIN;···317317 retval = -EIO;318318 break;319319 }320320-320320+321321 schedule();322322 }323323···329329 return retval;330330331331332332- while (list->head != list->tail && 332332+ while (list->head != list->tail &&333333 retval + event_size <= count) {334334 if ((list->flags & HIDDEV_FLAG_UREF) == 0) {335335 if (list->buffer[list->tail].field_index !=···405405 return -EINVAL;406406407407 for (i = 0; i < hid->maxcollection; i++)408408- if (hid->collection[i].type == 408408+ if (hid->collection[i].type ==409409 HID_COLLECTION_APPLICATION && arg-- == 0)410410 break;411411-411411+412412 if (i == hid->maxcollection)413413 return -EINVAL;414414···562562 if (!uref_multi)563563 return -ENOMEM;564564 uref = &uref_multi->uref;565565- if (copy_from_user(uref, user_arg, sizeof(*uref))) 565565+ if (copy_from_user(uref, user_arg, sizeof(*uref)))566566 goto fault;567567568568 rinfo.report_type = uref->report_type;···595595 return -ENOMEM;596596 uref = &uref_multi->uref;597597 if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {598598- if (copy_from_user(uref_multi, user_arg, 598598+ if (copy_from_user(uref_multi, user_arg,599599 sizeof(*uref_multi)))600600 goto fault;601601 } else {···603603 goto fault;604604 }605605606606- if (cmd != HIDIOCGUSAGE && 606606+ if (cmd != HIDIOCGUSAGE &&607607 cmd != HIDIOCGUSAGES &&608608 uref->report_type == HID_REPORT_TYPE_INPUT)609609 goto inval;···651651 return field->usage[uref->usage_index].collection_index;652652 case HIDIOCGUSAGES:653653 for (i = 0; i < uref_multi->num_values; i++)654654- uref_multi->values[i] = 654654+ uref_multi->values[i] =655655 field->value[uref->usage_index + i];656656- if (copy_to_user(user_arg, uref_multi, 656656+ if (copy_to_user(user_arg, uref_multi,657657 sizeof(*uref_multi)))658658 goto fault;659659 goto goodreturn;660660 case HIDIOCSUSAGES:661661 for (i = 0; i < uref_multi->num_values; i++)662662- field->value[uref->usage_index + i] = 663663- uref_multi->values[i];662662+ field->value[uref->usage_index + i] =663663+ uref_multi->values[i];664664 goto goodreturn;665665 }666666···670670fault:671671 kfree(uref_multi);672672 return -EFAULT;673673-inval: 673673+inval:674674 kfree(uref_multi);675675 return -EINVAL;676676···734734 .name = "usb/hid/hiddev%d",735735 .fops = &hiddev_fops,736736 .mode = S_IFCHR | S_IRUGO | S_IWUSR,737737- .minor_base = HIDDEV_MINOR_BASE,737737+ .minor_base = HIDDEV_MINOR_BASE,738738};739739740740/*···747747 int retval;748748749749 for (i = 0; i < hid->maxcollection; i++)750750- if (hid->collection[i].type == 750750+ if (hid->collection[i].type ==751751 HID_COLLECTION_APPLICATION &&752752 !IS_INPUT_APPLICATION(hid->collection[i].usage))753753 break;···755755 if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0)756756 return -1;757757758758- if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL)))758758+ if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL)))759759 return -1;760760 memset(hiddev, 0, sizeof(struct hiddev));761761762762- retval = usb_register_dev(hid->intf, &hiddev_class);762762+ retval = usb_register_dev(hid->intf, &hiddev_class);763763 if (retval) {764764 err("Not able to get a minor for this device.");765765 kfree(hiddev);···768768769769 init_waitqueue_head(&hiddev->wait);770770771771- hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;771771+ hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;772772773773 hiddev->hid = hid;774774 hiddev->exist = 1;775775776776- hid->minor = hid->intf->minor;776776+ hid->minor = hid->intf->minor;777777 hid->hiddev = hiddev;778778779779 return 0;···818818/* We never attach in this manner, and rely on HID to connect us. This819819 * is why there is no disconnect routine defined in the usb_driver either.820820 */821821-static int hiddev_usbd_probe(struct usb_interface *intf, 821821+static int hiddev_usbd_probe(struct usb_interface *intf,822822 const struct usb_device_id *hiddev_info)823823{824824 return -ENODEV;
+268
drivers/usb/input/itmtouch.c
···11+/******************************************************************************22+ * itmtouch.c -- Driver for ITM touchscreen panel33+ *44+ * This program is free software; you can redistribute it and/or55+ * modify it under the terms of the GNU General Public License as66+ * published by the Free Software Foundation; either version 2 of the77+ * License, or (at your option) any later version.88+ *99+ * This program is distributed in the hope that it will be useful, but1010+ * WITHOUT ANY WARRANTY; without even the implied warranty of1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1212+ * General Public License for more details.1313+ *1414+ * You should have received a copy of the GNU General Public License1515+ * along with this program; if not, write to the Free Software1616+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1717+ *1818+ * Based upon original work by Chris Collins <xfire-itmtouch@xware.cx>.1919+ *2020+ * Kudos to ITM for providing me with the datasheet for the panel,2121+ * even though it was a day later than I had finished writing this2222+ * driver.2323+ *2424+ * It has meant that I've been able to correct my interpretation of the2525+ * protocol packets however.2626+ *2727+ * CC -- 2003/9/292828+ *2929+ * History3030+ * 1.0 & 1.1 2003 (CC) vojtech@suse.cz3131+ * Original version for 2.4.x kernels3232+ *3333+ * 1.2 02/03/2005 (HCE) hc@mivu.no3434+ * Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints.3535+ * Unfortunately no calibration support at this time.3636+ *3737+ * 1.2.1 09/03/2005 (HCE) hc@mivu.no3838+ * Code cleanup and adjusting syntax to start matching kernel standards3939+ *4040+ *****************************************************************************/4141+4242+#include <linux/config.h>4343+4444+#ifdef CONFIG_USB_DEBUG4545+ #define DEBUG4646+#else4747+ #undef DEBUG4848+#endif4949+5050+#include <linux/kernel.h>5151+#include <linux/slab.h>5252+#include <linux/input.h>5353+#include <linux/module.h>5454+#include <linux/init.h>5555+#include <linux/usb.h>5656+5757+/* only an 8 byte buffer necessary for a single packet */5858+#define ITM_BUFSIZE 85959+#define PATH_SIZE 646060+6161+#define USB_VENDOR_ID_ITMINC 0x04036262+#define USB_PRODUCT_ID_TOUCHPANEL 0xf9e96363+6464+#define DRIVER_AUTHOR "Hans-Christian Egtvedt <hc@mivu.no>"6565+#define DRIVER_VERSION "v1.2.1"6666+#define DRIVER_DESC "USB ITM Inc Touch Panel Driver"6767+#define DRIVER_LICENSE "GPL"6868+6969+MODULE_AUTHOR( DRIVER_AUTHOR );7070+MODULE_DESCRIPTION( DRIVER_DESC );7171+MODULE_LICENSE( DRIVER_LICENSE );7272+7373+struct itmtouch_dev {7474+ struct usb_device *usbdev; /* usb device */7575+ struct input_dev inputdev; /* input device */7676+ struct urb *readurb; /* urb */7777+ char rbuf[ITM_BUFSIZE]; /* data */7878+ int users;7979+ char name[128];8080+ char phys[64];8181+};8282+8383+static struct usb_device_id itmtouch_ids [] = {8484+ { USB_DEVICE(USB_VENDOR_ID_ITMINC, USB_PRODUCT_ID_TOUCHPANEL) },8585+ { }8686+};8787+8888+static void itmtouch_irq(struct urb *urb, struct pt_regs *regs)8989+{9090+ struct itmtouch_dev * itmtouch = urb->context;9191+ unsigned char *data = urb->transfer_buffer;9292+ struct input_dev *dev = &itmtouch->inputdev;9393+ int retval;9494+9595+ switch (urb->status) {9696+ case 0:9797+ /* success */9898+ break;9999+ case -ETIMEDOUT:100100+ /* this urb is timing out */101101+ dbg("%s - urb timed out - was the device unplugged?",102102+ __FUNCTION__);103103+ return;104104+ case -ECONNRESET:105105+ case -ENOENT:106106+ case -ESHUTDOWN:107107+ /* this urb is terminated, clean up */108108+ dbg("%s - urb shutting down with status: %d",109109+ __FUNCTION__, urb->status);110110+ return;111111+ default:112112+ dbg("%s - nonzero urb status received: %d",113113+ __FUNCTION__, urb->status);114114+ goto exit;115115+ }116116+117117+ input_regs(dev, regs);118118+119119+ /* if pressure has been released, then don't report X/Y */120120+ if (data[7] & 0x20) {121121+ input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F));122122+ input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F));123123+ }124124+125125+ input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F));126126+ input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20);127127+ input_sync(dev);128128+129129+exit:130130+ retval = usb_submit_urb (urb, GFP_ATOMIC);131131+ if (retval)132132+ printk(KERN_ERR "%s - usb_submit_urb failed with result: %d",133133+ __FUNCTION__, retval);134134+}135135+136136+static int itmtouch_open(struct input_dev *input)137137+{138138+ struct itmtouch_dev *itmtouch = input->private;139139+140140+ itmtouch->readurb->dev = itmtouch->usbdev;141141+142142+ if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL))143143+ return -EIO;144144+145145+ return 0;146146+}147147+148148+static void itmtouch_close(struct input_dev *input)149149+{150150+ struct itmtouch_dev *itmtouch = input->private;151151+152152+ usb_kill_urb(itmtouch->readurb);153153+}154154+155155+static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id *id)156156+{157157+ struct itmtouch_dev *itmtouch;158158+ struct usb_host_interface *interface;159159+ struct usb_endpoint_descriptor *endpoint;160160+ struct usb_device *udev = interface_to_usbdev(intf);161161+ unsigned int pipe;162162+ unsigned int maxp;163163+ char path[PATH_SIZE];164164+165165+ interface = intf->cur_altsetting;166166+ endpoint = &interface->endpoint[0].desc;167167+168168+ if (!(itmtouch = kcalloc(1, sizeof(struct itmtouch_dev), GFP_KERNEL))) {169169+ err("%s - Out of memory.", __FUNCTION__);170170+ return -ENOMEM;171171+ }172172+173173+ itmtouch->usbdev = udev;174174+175175+ itmtouch->inputdev.private = itmtouch;176176+ itmtouch->inputdev.open = itmtouch_open;177177+ itmtouch->inputdev.close = itmtouch_close;178178+179179+ usb_make_path(udev, path, PATH_SIZE);180180+181181+ itmtouch->inputdev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);182182+ itmtouch->inputdev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);183183+ itmtouch->inputdev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);184184+185185+ itmtouch->inputdev.name = itmtouch->name;186186+ itmtouch->inputdev.phys = itmtouch->phys;187187+ itmtouch->inputdev.id.bustype = BUS_USB;188188+ itmtouch->inputdev.id.vendor = udev->descriptor.idVendor;189189+ itmtouch->inputdev.id.product = udev->descriptor.idProduct;190190+ itmtouch->inputdev.id.version = udev->descriptor.bcdDevice;191191+ itmtouch->inputdev.dev = &intf->dev;192192+193193+ if (!strlen(itmtouch->name))194194+ sprintf(itmtouch->name, "USB ITM touchscreen");195195+196196+ /* device limits */197197+ /* as specified by the ITM datasheet, X and Y are 12bit,198198+ * Z (pressure) is 8 bit. However, the fields are defined up199199+ * to 14 bits for future possible expansion.200200+ */201201+ input_set_abs_params(&itmtouch->inputdev, ABS_X, 0, 0x0FFF, 2, 0);202202+ input_set_abs_params(&itmtouch->inputdev, ABS_Y, 0, 0x0FFF, 2, 0);203203+ input_set_abs_params(&itmtouch->inputdev, ABS_PRESSURE, 0, 0xFF, 2, 0);204204+205205+ /* initialise the URB so we can read from the transport stream */206206+ pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress);207207+ maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));208208+209209+ if (maxp > ITM_BUFSIZE)210210+ maxp = ITM_BUFSIZE;211211+212212+ itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL);213213+214214+ if (!itmtouch->readurb) {215215+ dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__);216216+ kfree(itmtouch);217217+ return -ENOMEM;218218+ }219219+220220+ usb_fill_int_urb(itmtouch->readurb, itmtouch->usbdev, pipe, itmtouch->rbuf,221221+ maxp, itmtouch_irq, itmtouch, endpoint->bInterval);222222+223223+ input_register_device(&itmtouch->inputdev);224224+225225+ printk(KERN_INFO "itmtouch: %s registered on %s\n", itmtouch->name, path);226226+ usb_set_intfdata(intf, itmtouch);227227+228228+ return 0;229229+}230230+231231+static void itmtouch_disconnect(struct usb_interface *intf)232232+{233233+ struct itmtouch_dev *itmtouch = usb_get_intfdata(intf);234234+235235+ usb_set_intfdata(intf, NULL);236236+237237+ if (itmtouch) {238238+ input_unregister_device(&itmtouch->inputdev);239239+ usb_kill_urb(itmtouch->readurb);240240+ usb_free_urb(itmtouch->readurb);241241+ kfree(itmtouch);242242+ }243243+}244244+245245+MODULE_DEVICE_TABLE(usb, itmtouch_ids);246246+247247+static struct usb_driver itmtouch_driver = {248248+ .owner = THIS_MODULE,249249+ .name = "itmtouch",250250+ .probe = itmtouch_probe,251251+ .disconnect = itmtouch_disconnect,252252+ .id_table = itmtouch_ids,253253+};254254+255255+static int __init itmtouch_init(void)256256+{257257+ info(DRIVER_DESC " " DRIVER_VERSION);258258+ info(DRIVER_AUTHOR);259259+ return usb_register(&itmtouch_driver);260260+}261261+262262+static void __exit itmtouch_exit(void)263263+{264264+ usb_deregister(&itmtouch_driver);265265+}266266+267267+module_init(itmtouch_init);268268+module_exit(itmtouch_exit);
···1010 * back to the host when polled by the USB controller.1111 *1212 * Testing with the knob I have has shown that it measures approximately 94 "clicks"1313- * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was 1313+ * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was1414 * a variable speed cordless electric drill) has shown that the device can measure1515 * speeds of up to 7 clicks either clockwise or anticlockwise between pollings from1616 * the host. If it counts more than 7 clicks before it is polled, it will wrap back···120120/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */121121static void powermate_sync_state(struct powermate_device *pm)122122{123123- if (pm->requires_update == 0) 123123+ if (pm->requires_update == 0)124124 return; /* no updates are required */125125- if (pm->config->status == -EINPROGRESS) 125125+ if (pm->config->status == -EINPROGRESS)126126 return; /* an update is already in progress; it'll issue this update when it completes */127127128128 if (pm->requires_update & UPDATE_PULSE_ASLEEP){···142142 2: multiply the speed143143 the argument only has an effect for operations 0 and 2, and ranges between144144 1 (least effect) to 255 (maximum effect).145145-145145+146146 thus, several states are equivalent and are coalesced into one state.147147148148 we map this onto a range from 0 to 510, with:···151151 256 -- 510 -- use multiple (510 = fastest).152152153153 Only values of 'arg' quite close to 255 are particularly useful/spectacular.154154- */ 154154+ */155155 if (pm->pulse_speed < 255){156156 op = 0; // divide157157 arg = 255 - pm->pulse_speed;···199199200200 if (urb->status)201201 printk(KERN_ERR "powermate: config urb returned %d\n", urb->status);202202-202202+203203 spin_lock_irqsave(&pm->lock, flags);204204 powermate_sync_state(pm);205205 spin_unlock_irqrestore(&pm->lock, flags);206206}207207208208/* Set the LED up as described and begin the sync with the hardware if required */209209-static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed, 209209+static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed,210210 int pulse_table, int pulse_asleep, int pulse_awake)211211{212212 unsigned long flags;···229229 /* mark state updates which are required */230230 if (static_brightness != pm->static_brightness){231231 pm->static_brightness = static_brightness;232232- pm->requires_update |= UPDATE_STATIC_BRIGHTNESS; 232232+ pm->requires_update |= UPDATE_STATIC_BRIGHTNESS;233233 }234234 if (pulse_asleep != pm->pulse_asleep){235235 pm->pulse_asleep = pulse_asleep;···246246 }247247248248 powermate_sync_state(pm);249249-249249+250250 spin_unlock_irqrestore(&pm->lock, flags);251251}252252···257257 struct powermate_device *pm = dev->private;258258259259 if (type == EV_MSC && code == MSC_PULSELED){260260- /* 260260+ /*261261 bits 0- 7: 8 bits: LED brightness262262 bits 8-16: 9 bits: pulsing speed modifier (0 ... 510); 0-254 = slower, 255 = standard, 256-510 = faster.263263 bits 17-18: 2 bits: pulse table (0, 1, 2 valid)264264 bit 19: 1 bit : pulse whilst asleep?265265 bit 20: 1 bit : pulse constantly?266266- */ 266266+ */267267 int static_brightness = command & 0xFF; // bits 0-7268268 int pulse_speed = (command >> 8) & 0x1FF; // bits 8-16269269 int pulse_table = (command >> 17) & 0x3; // bits 17-18270270 int pulse_asleep = (command >> 19) & 0x1; // bit 19271271 int pulse_awake = (command >> 20) & 0x1; // bit 20272272-272272+273273 powermate_pulse_led(pm, static_brightness, pulse_speed, pulse_table, pulse_asleep, pulse_awake);274274 }275275···378378 switch (le16_to_cpu(udev->descriptor.idProduct)) {379379 case POWERMATE_PRODUCT_NEW: pm->input.name = pm_name_powermate; break;380380 case POWERMATE_PRODUCT_OLD: pm->input.name = pm_name_soundknob; break;381381- default: 381381+ default:382382 pm->input.name = pm_name_soundknob;383383 printk(KERN_WARNING "powermate: unknown product id %04x\n",384384 le16_to_cpu(udev->descriptor.idProduct));···402402 usb_make_path(udev, path, 64);403403 snprintf(pm->phys, 64, "%s/input0", path);404404 printk(KERN_INFO "input: %s on %s\n", pm->input.name, pm->input.phys);405405-405405+406406 /* force an update of everything */407407 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS;408408 powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters409409-409409+410410 usb_set_intfdata(intf, pm);411411 return 0;412412}
+2-9
drivers/usb/input/touchkitusb.c
···6969 struct urb *irq;7070 struct usb_device *udev;7171 struct input_dev input;7272- int open;7372 char name[128];7473 char phys[64];7574};···133134{134135 struct touchkit_usb *touchkit = input->private;135136136136- if (touchkit->open++)137137- return 0;138138-139137 touchkit->irq->dev = touchkit->udev;140138141141- if (usb_submit_urb(touchkit->irq, GFP_ATOMIC)) {142142- touchkit->open--;139139+ if (usb_submit_urb(touchkit->irq, GFP_ATOMIC))143140 return -EIO;144144- }145141146142 return 0;147143}···145151{146152 struct touchkit_usb *touchkit = input->private;147153148148- if (!--touchkit->open)149149- usb_kill_urb(touchkit->irq);154154+ usb_kill_urb(touchkit->irq);150155}151156152157static int touchkit_alloc_buffers(struct usb_device *udev,
+11-18
drivers/usb/input/usbkbd.c
···99/*1010 * This program is free software; you can redistribute it and/or modify1111 * it under the terms of the GNU General Public License as published by1212- * the Free Software Foundation; either version 2 of the License, or 1212+ * the Free Software Foundation; either version 2 of the License, or1313 * (at your option) any later version.1414- * 1414+ *1515 * This program is distributed in the hope that it will be useful,1616 * but WITHOUT ANY WARRANTY; without even the implied warranty of1717 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1818 * GNU General Public License for more details.1919- * 1919+ *2020 * You should have received a copy of the GNU General Public License2121 * along with this program; if not, write to the Free Software2222 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2323- * 2323+ *2424 * Should you need to contact me, the author, you can do so either by2525 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:2626 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic···7272 unsigned char newleds;7373 char name[128];7474 char phys[64];7575- int open;76757776 unsigned char *new;7877 struct usb_ctrlrequest *cr;···165166166167 if (urb->status)167168 warn("led urb status %d received", urb->status);168168-169169+169170 if (*(kbd->leds) == kbd->newleds)170171 return;171172···179180{180181 struct usb_kbd *kbd = dev->private;181182182182- if (kbd->open++)183183- return 0;184184-185183 kbd->irq->dev = kbd->usbdev;186186- if (usb_submit_urb(kbd->irq, GFP_KERNEL)) {187187- kbd->open--;184184+ if (usb_submit_urb(kbd->irq, GFP_KERNEL))188185 return -EIO;189189- }190186191187 return 0;192188}···190196{191197 struct usb_kbd *kbd = dev->private;192198193193- if (!--kbd->open)194194- usb_kill_urb(kbd->irq);199199+ usb_kill_urb(kbd->irq);195200}196201197202static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)···223230 usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);224231}225232226226-static int usb_kbd_probe(struct usb_interface *iface, 233233+static int usb_kbd_probe(struct usb_interface *iface,227234 const struct usb_device_id *id)228235{229236 struct usb_device * dev = interface_to_usbdev(iface);···265272 for (i = 0; i < 255; i++)266273 set_bit(usb_kbd_keycode[i], kbd->dev.keybit);267274 clear_bit(0, kbd->dev.keybit);268268-275275+269276 kbd->dev.private = kbd;270277 kbd->dev.event = usb_kbd_event;271278 kbd->dev.open = usb_kbd_open;···287294 sprintf(kbd->phys, "%s/input0", path);288295289296 kbd->dev.name = kbd->name;290290- kbd->dev.phys = kbd->phys; 297297+ kbd->dev.phys = kbd->phys;291298 kbd->dev.id.bustype = BUS_USB;292299 kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);293300 kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);···322329static void usb_kbd_disconnect(struct usb_interface *intf)323330{324331 struct usb_kbd *kbd = usb_get_intfdata (intf);325325-332332+326333 usb_set_intfdata(intf, NULL);327334 if (kbd) {328335 usb_kill_urb(kbd->irq);
+12-19
drivers/usb/input/usbmouse.c
···99/*1010 * This program is free software; you can redistribute it and/or modify1111 * it under the terms of the GNU General Public License as published by1212- * the Free Software Foundation; either version 2 of the License, or 1212+ * the Free Software Foundation; either version 2 of the License, or1313 * (at your option) any later version.1414- * 1414+ *1515 * This program is distributed in the hope that it will be useful,1616 * but WITHOUT ANY WARRANTY; without even the implied warranty of1717 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1818 * GNU General Public License for more details.1919- * 1919+ *2020 * You should have received a copy of the GNU General Public License2121 * along with this program; if not, write to the Free Software2222 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2323- * 2323+ *2424 * Should you need to contact me, the author, you can do so either by2525 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:2626 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic···5151 struct usb_device *usbdev;5252 struct input_dev dev;5353 struct urb *irq;5454- int open;55545655 signed char *data;5756 dma_addr_t data_dma;···100101{101102 struct usb_mouse *mouse = dev->private;102103103103- if (mouse->open++)104104- return 0;105105-106104 mouse->irq->dev = mouse->usbdev;107107- if (usb_submit_urb(mouse->irq, GFP_KERNEL)) {108108- mouse->open--;105105+ if (usb_submit_urb(mouse->irq, GFP_KERNEL))109106 return -EIO;110110- }111107112108 return 0;113109}···111117{112118 struct usb_mouse *mouse = dev->private;113119114114- if (!--mouse->open)115115- usb_kill_urb(mouse->irq);120120+ usb_kill_urb(mouse->irq);116121}117122118123static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_id * id)···125132126133 interface = intf->cur_altsetting;127134128128- if (interface->desc.bNumEndpoints != 1) 135135+ if (interface->desc.bNumEndpoints != 1)129136 return -ENODEV;130137131138 endpoint = &interface->endpoint[0].desc;132132- if (!(endpoint->bEndpointAddress & 0x80)) 139139+ if (!(endpoint->bEndpointAddress & 0x80))133140 return -ENODEV;134134- if ((endpoint->bmAttributes & 3) != 3) 141141+ if ((endpoint->bmAttributes & 3) != 3)135142 return -ENODEV;136143137144 pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);138145 maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));139146140140- if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) 147147+ if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL)))141148 return -ENOMEM;142149 memset(mouse, 0, sizeof(struct usb_mouse));143150···202209static void usb_mouse_disconnect(struct usb_interface *intf)203210{204211 struct usb_mouse *mouse = usb_get_intfdata (intf);205205-212212+206213 usb_set_intfdata(intf, NULL);207214 if (mouse) {208215 usb_kill_urb(mouse->irq);···231238static int __init usb_mouse_init(void)232239{233240 int retval = usb_register(&usb_mouse_driver);234234- if (retval == 0) 241241+ if (retval == 0)235242 info(DRIVER_VERSION ":" DRIVER_DESC);236243 return retval;237244}
···859859 int (*erase_effect)(struct input_dev *dev, int effect_id);860860861861 struct input_handle *grab;862862+863863+ struct semaphore sem; /* serializes open and close operations */864864+ unsigned int users;865865+862866 struct device *dev;863867864868 struct list_head h_list;
···52525353config SOUND_CMPCI_JOYSTICK5454 bool "Enable joystick"5555- depends on SOUND_CMPCI && X865555+ depends on SOUND_CMPCI && X86 && (GAMEPORT=y || SOUND_CMPCI=GAMEPORT)5656 help5757 Say Y here in order to enable the joystick port on a sound card using5858 the CMI8338 or the CMI8738 chipset. You need to config the
+58-30
sound/oss/es1370.c
···162162#include <asm/page.h>163163#include <asm/uaccess.h>164164165165+#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))166166+#define SUPPORT_JOYSTICK167167+#endif168168+165169/* --------------------------------------------------------------------- */166170167171#undef OSS_DOCUMENTED_MIXER_SEMANTICS···389385 unsigned char obuf[MIDIOUTBUF];390386 } midi;391387388388+#ifdef SUPPORT_JOYSTICK392389 struct gameport *gameport;390390+#endif391391+393392 struct semaphore sem;394393};395394···25612554 { SOUND_MIXER_WRITE_OGAIN, 0x4040 }25622555};2563255625572557+#ifdef SUPPORT_JOYSTICK25582558+25592559+static int __devinit es1370_register_gameport(struct es1370_state *s)25602560+{25612561+ struct gameport *gp;25622562+25632563+ if (!request_region(0x200, JOY_EXTENT, "es1370")) {25642564+ printk(KERN_ERR "es1370: joystick io port 0x200 in use\n");25652565+ return -EBUSY;25662566+ }25672567+25682568+ s->gameport = gp = gameport_allocate_port();25692569+ if (!gp) {25702570+ printk(KERN_ERR "es1370: can not allocate memory for gameport\n");25712571+ release_region(0x200, JOY_EXTENT);25722572+ return -ENOMEM;25732573+ }25742574+25752575+ gameport_set_name(gp, "ESS1370");25762576+ gameport_set_phys(gp, "pci%s/gameport0", pci_name(s->dev));25772577+ gp->dev.parent = &s->dev->dev;25782578+ gp->io = 0x200;25792579+25802580+ s->ctrl |= CTRL_JYSTK_EN;25812581+ outl(s->ctrl, s->io + ES1370_REG_CONTROL);25822582+25832583+ gameport_register_port(gp);25842584+25852585+ return 0;25862586+}25872587+25882588+static inline void es1370_unregister_gameport(struct es1370_state *s)25892589+{25902590+ if (s->gameport) {25912591+ int gpio = s->gameport->io;25922592+ gameport_unregister_port(s->gameport);25932593+ release_region(gpio, JOY_EXTENT);25942594+25952595+ }25962596+}25972597+25982598+#else25992599+static inline int es1370_register_gameport(struct es1370_state *s) { return -ENOSYS; }26002600+static inline void es1370_unregister_gameport(struct es1370_state *s) { }26012601+#endif /* SUPPORT_JOYSTICK */26022602+25642603static int __devinit es1370_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)25652604{25662605 struct es1370_state *s;25672567- struct gameport *gp = NULL;25682606 mm_segment_t fs;25692607 int i, val, ret;25702608···26582606 /* note: setting CTRL_SERR_DIS is reported to break26592607 * mic bias setting (by Kim.Berts@fisub.mail.abb.com) */26602608 s->ctrl = CTRL_CDC_EN | (DAC2_SRTODIV(8000) << CTRL_SH_PCLKDIV) | (1 << CTRL_SH_WTSRSEL);26612661- if (!request_region(0x200, JOY_EXTENT, "es1370")) {26622662- printk(KERN_ERR "es1370: joystick io port 0x200 in use\n");26632663- } else if (!(s->gameport = gp = gameport_allocate_port())) {26642664- printk(KERN_ERR "es1370: can not allocate memory for gameport\n");26652665- release_region(0x200, JOY_EXTENT);26662666- } else {26672667- gameport_set_name(gp, "ESS1370");26682668- gameport_set_phys(gp, "pci%s/gameport0", pci_name(s->dev));26692669- gp->dev.parent = &s->dev->dev;26702670- gp->io = 0x200;26712671- s->ctrl |= CTRL_JYSTK_EN;26722672- }26732609 if (lineout[devindex])26742610 s->ctrl |= CTRL_XCTL0;26752611 if (micbias[devindex])26762612 s->ctrl |= CTRL_XCTL1;26772613 s->sctrl = 0;26782678- printk(KERN_INFO "es1370: found adapter at io %#lx irq %u\n"26792679- KERN_INFO "es1370: features: joystick %s, line %s, mic impedance %s\n",26802680- s->io, s->irq, (s->ctrl & CTRL_JYSTK_EN) ? "on" : "off",26812681- (s->ctrl & CTRL_XCTL0) ? "out" : "in",26822682- (s->ctrl & CTRL_XCTL1) ? "1" : "0");26142614+ printk(KERN_INFO "es1370: adapter at io %#lx irq %u, line %s, mic impedance %s\n",26152615+ s->io, s->irq, (s->ctrl & CTRL_XCTL0) ? "out" : "in",26162616+ (s->ctrl & CTRL_XCTL1) ? "1" : "0");26832617 /* register devices */26842618 if ((s->dev_audio = register_sound_dsp(&es1370_audio_fops, -1)) < 0) {26852619 ret = s->dev_audio;···27112673 }27122674 set_fs(fs);2713267527142714- /* register gameport */27152715- if (gp)27162716- gameport_register_port(gp);26762676+ es1370_register_gameport(s);2717267727182678 /* store it in the driver field */27192679 pci_set_drvdata(pcidev, s);···27332697 err_dev1:27342698 printk(KERN_ERR "es1370: cannot register misc device\n");27352699 free_irq(s->irq, s);27362736- if (s->gameport) {27372737- release_region(s->gameport->io, JOY_EXTENT);27382738- gameport_free_port(s->gameport);27392739- }27402700 err_irq:27412701 release_region(s->io, ES1370_EXTENT);27422702 err_region:···27512719 outl(0, s->io+ES1370_REG_SERIAL_CONTROL); /* clear serial interrupts */27522720 synchronize_irq(s->irq);27532721 free_irq(s->irq, s);27542754- if (s->gameport) {27552755- int gpio = s->gameport->io;27562756- gameport_unregister_port(s->gameport);27572757- release_region(gpio, JOY_EXTENT);27582758- }27222722+ es1370_unregister_gameport(s);27592723 release_region(s->io, ES1370_EXTENT);27602724 unregister_sound_dsp(s->dev_audio);27612725 unregister_sound_mixer(s->dev_mixer);
+63-32
sound/oss/es1371.c
···134134#include <asm/page.h>135135#include <asm/uaccess.h>136136137137+#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))138138+#define SUPPORT_JOYSTICK139139+#endif140140+137141/* --------------------------------------------------------------------- */138142139143#undef OSS_DOCUMENTED_MIXER_SEMANTICS···458454 unsigned char obuf[MIDIOUTBUF];459455 } midi;460456457457+#ifdef SUPPORT_JOYSTICK461458 struct gameport *gameport;459459+#endif460460+462461 struct semaphore sem;463462};464463···27942787 { PCI_ANY_ID, PCI_ANY_ID }27952788};2796278927902790+#ifdef SUPPORT_JOYSTICK27912791+27922792+static int __devinit es1371_register_gameport(struct es1371_state *s)27932793+{27942794+ struct gameport *gp;27952795+ int gpio;27962796+27972797+ for (gpio = 0x218; gpio >= 0x200; gpio -= 0x08)27982798+ if (request_region(gpio, JOY_EXTENT, "es1371"))27992799+ break;28002800+28012801+ if (gpio < 0x200) {28022802+ printk(KERN_ERR PFX "no free joystick address found\n");28032803+ return -EBUSY;28042804+ }28052805+28062806+ s->gameport = gp = gameport_allocate_port();28072807+ if (!gp) {28082808+ printk(KERN_ERR PFX "can not allocate memory for gameport\n");28092809+ release_region(gpio, JOY_EXTENT);28102810+ return -ENOMEM;28112811+ }28122812+28132813+ gameport_set_name(gp, "ESS1371 Gameport");28142814+ gameport_set_phys(gp, "isa%04x/gameport0", gpio);28152815+ gp->dev.parent = &s->dev->dev;28162816+ gp->io = gpio;28172817+28182818+ s->ctrl |= CTRL_JYSTK_EN | (((gpio >> 3) & CTRL_JOY_MASK) << CTRL_JOY_SHIFT);28192819+ outl(s->ctrl, s->io + ES1371_REG_CONTROL);28202820+28212821+ gameport_register_port(gp);28222822+28232823+ return 0;28242824+}28252825+28262826+static inline void es1371_unregister_gameport(struct es1371_state *s)28272827+{28282828+ if (s->gameport) {28292829+ int gpio = s->gameport->io;28302830+ gameport_unregister_port(s->gameport);28312831+ release_region(gpio, JOY_EXTENT);28322832+28332833+ }28342834+}28352835+28362836+#else28372837+static inline int es1371_register_gameport(struct es1371_state *s) { return -ENOSYS; }28382838+static inline void es1371_unregister_gameport(struct es1371_state *s) { }28392839+#endif /* SUPPORT_JOYSTICK */28402840+28412841+27972842static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)27982843{27992844 struct es1371_state *s;28002800- struct gameport *gp;28012845 mm_segment_t fs;28022802- int i, gpio, val, res = -1;28462846+ int i, val, res = -1;28032847 int idx;28042848 unsigned long tmo;28052849 signed long tmo2;···29412883 }29422884 }2943288529442944- for (gpio = 0x218; gpio >= 0x200; gpio -= 0x08)29452945- if (request_region(gpio, JOY_EXTENT, "es1371"))29462946- break;29472947-29482948- if (gpio < 0x200) {29492949- printk(KERN_ERR PFX "no free joystick address found\n");29502950- } else if (!(s->gameport = gp = gameport_allocate_port())) {29512951- printk(KERN_ERR PFX "can not allocate memory for gameport\n");29522952- release_region(gpio, JOY_EXTENT);29532953- } else {29542954- gameport_set_name(gp, "ESS1371 Gameport");29552955- gameport_set_phys(gp, "isa%04x/gameport0", gpio);29562956- gp->dev.parent = &s->dev->dev;29572957- gp->io = gpio;29582958- s->ctrl |= CTRL_JYSTK_EN | (((gpio >> 3) & CTRL_JOY_MASK) << CTRL_JOY_SHIFT);29592959- }29602960-29612886 s->sctrl = 0;29622887 cssr = 0;29632888 s->spdif_volume = -1;···30102969 /* turn on S/PDIF output driver if requested */30112970 outl(cssr, s->io+ES1371_REG_STATUS);3012297130133013- /* register gameport */30143014- if (s->gameport)30153015- gameport_register_port(s->gameport);29722972+ es1371_register_gameport(s);3016297330172974 /* store it in the driver field */30182975 pci_set_drvdata(pcidev, s);···30192980 /* increment devindex */30202981 if (devindex < NR_DEVICE-1)30212982 devindex++;30223022- return 0;29832983+ return 0;3023298430242985 err_gp:30253025- if (s->gameport) {30263026- release_region(s->gameport->io, JOY_EXTENT);30273027- gameport_free_port(s->gameport);30283028- }30292986#ifdef ES1371_DEBUG30302987 if (s->ps)30312988 remove_proc_entry("es1371", NULL);···30603025 outl(0, s->io+ES1371_REG_SERIAL_CONTROL); /* clear serial interrupts */30613026 synchronize_irq(s->irq);30623027 free_irq(s->irq, s);30633063- if (s->gameport) {30643064- int gpio = s->gameport->io;30653065- gameport_unregister_port(s->gameport);30663066- release_region(gpio, JOY_EXTENT);30673067- }30283028+ es1371_unregister_gameport(s);30683029 release_region(s->io, ES1371_EXTENT);30693030 unregister_sound_dsp(s->dev_audio);30703031 unregister_sound_mixer(s->codec->dev_mixer);
···5050#include "sb.h"5151#include "mpu401.h"52525353+#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))5454+#define SUPPORT_JOYSTICK 15555+#endif5656+5357static int mad16_conf;5458static int mad16_cdsel;5555-static struct gameport *gameport;5659static DEFINE_SPINLOCK(lock);57605861#define C928 1···905902 -1, -1, -1, -1906903};907904905905+#ifdef SUPPORT_JOYSTICK906906+907907+static struct gameport *gameport;908908+908909static int __devinit mad16_register_gameport(int io_port)909910{910911 if (!request_region(io_port, 1, "mad16 gameport")) {···931924932925 return 0;933926}927927+928928+static inline void mad16_unregister_gameport(void)929929+{930930+ if (gameport) {931931+ /* the gameport was initialized so we must free it up */932932+ gameport_unregister_port(gameport);933933+ gameport = NULL;934934+ release_region(0x201, 1);935935+ }936936+}937937+#else938938+static inline int mad16_register_gameport(int io_port) { return -ENOSYS; }939939+static inline void mad16_unregister_gameport(void) { }940940+#endif934941935942static int __devinit init_mad16(void)936943{···10811060{10821061 if (found_mpu)10831062 unload_mad16_mpu(&cfg_mpu);10841084- if (gameport) {10851085- /* the gameport was initialized so we must free it up */10861086- gameport_unregister_port(gameport);10871087- gameport = NULL;10881088- release_region(0x201, 1);10891089- }10631063+ mad16_unregister_gameport();10901064 unload_mad16(&cfg);10911065 release_region(MC0_PORT, 12);10921066}