Subversion Repositories shark

Rev

Rev 523 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
494 giacomo 1
/*
2
 * PS/2 mouse driver
3
 *
4
 * Copyright (c) 1999-2002 Vojtech Pavlik
5
 */
6
 
7
/*
8
 * This program is free software; you can redistribute it and/or modify it
9
 * under the terms of the GNU General Public License version 2 as published by
10
 * the Free Software Foundation.
11
 */
12
 
13
#include <linuxcomp.h>
14
 
15
#include <linux/delay.h>
16
#include <linux/module.h>
17
#include <linux/slab.h>
18
#include <linux/interrupt.h>
19
#include <linux/input.h>
20
#include <linux/serio.h>
21
#include <linux/init.h>
22
#include <linux/pm.h>
23
#include "psmouse.h"
523 mauro 24
#include "synaptics.h"
494 giacomo 25
#include "logips2pp.h"
26
 
27
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
28
MODULE_DESCRIPTION("PS/2 mouse driver");
29
MODULE_PARM(psmouse_noext, "1i");
30
MODULE_PARM_DESC(psmouse_noext, "Disable any protocol extensions. Useful for KVM switches.");
31
MODULE_PARM(psmouse_resolution, "i");
32
MODULE_PARM_DESC(psmouse_resolution, "Resolution, in dpi.");
33
MODULE_PARM(psmouse_rate, "i");
34
MODULE_PARM_DESC(psmouse_rate, "Report rate, in reports per second.");
35
MODULE_PARM(psmouse_smartscroll, "i");
36
MODULE_PARM_DESC(psmouse_smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled.");
37
MODULE_PARM(psmouse_resetafter, "i");
38
MODULE_PARM_DESC(psmouse_resetafter, "Reset Synaptics Touchpad after so many bad packets (0 = never).");
39
MODULE_LICENSE("GPL");
40
 
41
static int psmouse_noext;
42
int psmouse_resolution = 200;
43
unsigned int psmouse_rate = 100;
44
int psmouse_smartscroll = 1;
45
unsigned int psmouse_resetafter;
46
 
47
static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2"};
48
 
49
/*
50
 * psmouse_process_packet() analyzes the PS/2 mouse packet contents and
51
 * reports relevant events to the input module.
52
 */
53
 
54
static void psmouse_process_packet(struct psmouse *psmouse, struct pt_regs *regs)
55
{
56
        struct input_dev *dev = &psmouse->dev;
57
        unsigned char *packet = psmouse->packet;
58
 
59
        input_regs(dev, regs);
60
 
61
/*
62
 * The PS2++ protocol is a little bit complex
63
 */
64
 
65
        if (psmouse->type == PSMOUSE_PS2PP || psmouse->type == PSMOUSE_PS2TPP)
66
                ps2pp_process_packet(psmouse);
67
 
68
/*
69
 * Scroll wheel on IntelliMice, scroll buttons on NetMice
70
 */
71
 
72
        if (psmouse->type == PSMOUSE_IMPS || psmouse->type == PSMOUSE_GENPS)
73
                input_report_rel(dev, REL_WHEEL, -(signed char) packet[3]);
74
 
75
/*
76
 * Scroll wheel and buttons on IntelliMouse Explorer
77
 */
78
 
79
        if (psmouse->type == PSMOUSE_IMEX) {
80
                input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7));
81
                input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1);
82
                input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1);
83
        }
84
 
85
/*
86
 * Extra buttons on Genius NewNet 3D
87
 */
88
 
89
        if (psmouse->type == PSMOUSE_GENPS) {
90
                input_report_key(dev, BTN_SIDE, (packet[0] >> 6) & 1);
91
                input_report_key(dev, BTN_EXTRA, (packet[0] >> 7) & 1);
92
        }
93
 
94
/*
95
 * Generic PS/2 Mouse
96
 */
97
 
98
        input_report_key(dev, BTN_LEFT,    packet[0]       & 1);
99
        input_report_key(dev, BTN_MIDDLE, (packet[0] >> 2) & 1);
100
        input_report_key(dev, BTN_RIGHT,  (packet[0] >> 1) & 1);
101
 
102
        input_report_rel(dev, REL_X, packet[1] ? (int) packet[1] - (int) ((packet[0] << 4) & 0x100) : 0);
103
        input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0);
104
 
105
        input_sync(dev);
106
}
107
 
108
/*
109
 * psmouse_interrupt() handles incoming characters, either gathering them into
110
 * packets or passing them to the command routine as command output.
111
 */
112
 
113
static irqreturn_t psmouse_interrupt(struct serio *serio,
114
                unsigned char data, unsigned int flags, struct pt_regs *regs)
115
{
116
        struct psmouse *psmouse = serio->private;
117
 
118
        if (psmouse->state == PSMOUSE_IGNORE)
119
                goto out;
120
 
121
        if (psmouse->acking) {
122
                switch (data) {
123
                        case PSMOUSE_RET_ACK:
124
                                psmouse->ack = 1;
125
                                break;
126
                        case PSMOUSE_RET_NAK:
127
                                psmouse->ack = -1;
128
                                break;
129
                        default:
130
                                psmouse->ack = 1;       /* Workaround for mice which don't ACK the Get ID command */
131
                                if (psmouse->cmdcnt)
132
                                        psmouse->cmdbuf[--psmouse->cmdcnt] = data;
133
                                break;
134
                }
135
                psmouse->acking = 0;
136
                goto out;
137
        }
138
 
139
        if (psmouse->cmdcnt) {
140
                psmouse->cmdbuf[--psmouse->cmdcnt] = data;
141
                goto out;
142
        }
143
 
144
        if (psmouse->pktcnt && time_after(jiffies26, psmouse->last + HZ/2)) {
145
                printk(KERN_WARNING "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n",
146
                       psmouse->name, psmouse->phys, psmouse->pktcnt);
147
                psmouse->pktcnt = 0;
148
        }
149
 
150
        psmouse->last = jiffies26;
151
        psmouse->packet[psmouse->pktcnt++] = data;
152
 
153
        if (psmouse->packet[0] == PSMOUSE_RET_BAT) {
154
                if (psmouse->pktcnt == 1)
155
                        goto out;
156
 
157
                if (psmouse->pktcnt == 2) {
158
                        if (psmouse->packet[1] == PSMOUSE_RET_ID) {
159
                                psmouse->state = PSMOUSE_IGNORE;
160
                                serio_rescan(serio);
161
                                goto out;
162
                        }
163
                        if (psmouse->type == PSMOUSE_SYNAPTICS) {
164
                                /* neither 0xAA nor 0x00 are valid first bytes
165
                                 * for a packet in absolute mode
166
                                 */
167
                                psmouse->pktcnt = 0;
168
                                goto out;
169
                        }
170
                }
171
        }
172
 
173
        if (psmouse->type == PSMOUSE_SYNAPTICS) {
174
                /*
175
                 * The synaptics driver has its own resync logic,
176
                 * so it needs to receive all bytes one at a time.
177
                 */
523 mauro 178
                synaptics_process_byte(psmouse, regs);
494 giacomo 179
                goto out;
180
        }
181
 
182
        if (psmouse->pktcnt == 3 + (psmouse->type >= PSMOUSE_GENPS)) {
183
                psmouse_process_packet(psmouse, regs);
184
                psmouse->pktcnt = 0;
185
                goto out;
186
        }
187
out:
188
        return IRQ_HANDLED;
189
}
190
 
191
/*
192
 * psmouse_sendbyte() sends a byte to the mouse, and waits for acknowledge.
193
 * It doesn't handle retransmission, though it could - because when there would
194
 * be need for retransmissions, the mouse has to be replaced anyway.
195
 */
196
 
197
static int psmouse_sendbyte(struct psmouse *psmouse, unsigned char byte)
198
{
199
        int timeout = 10000; /* 100 msec */
200
        psmouse->ack = 0;
201
        psmouse->acking = 1;
202
 
203
        if (serio_write(psmouse->serio, byte)) {
204
                psmouse->acking = 0;
205
                return -1;
206
        }
207
 
208
        while (!psmouse->ack && timeout--) udelay(10);
209
 
210
        return -(psmouse->ack <= 0);
211
}
212
 
213
/*
214
 * psmouse_command() sends a command and its parameters to the mouse,
215
 * then waits for the response and puts it in the param array.
216
 */
217
 
218
int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command)
219
{
220
        int timeout = 500000; /* 500 msec */
221
        int send = (command >> 12) & 0xf;
222
        int receive = (command >> 8) & 0xf;
223
        int i;
224
 
225
        psmouse->cmdcnt = receive;
226
 
227
        if (command == PSMOUSE_CMD_RESET_BAT)
228
                timeout = 4000000; /* 4 sec */
229
 
230
        if (command & 0xff)
231
                if (psmouse_sendbyte(psmouse, command & 0xff))
232
                        return (psmouse->cmdcnt = 0) - 1;
233
 
234
        for (i = 0; i < send; i++)
235
                if (psmouse_sendbyte(psmouse, param[i]))
236
                        return (psmouse->cmdcnt = 0) - 1;
237
 
238
        while (psmouse->cmdcnt && timeout--) {
239
 
240
                if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_RESET_BAT)
241
                        timeout = 100000;
242
 
243
                if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_GETID &&
244
                    psmouse->cmdbuf[1] != 0xab && psmouse->cmdbuf[1] != 0xac) {
245
                        psmouse->cmdcnt = 0;
246
                        break;
247
                }
248
 
249
                udelay(1);
250
        }
251
 
252
        for (i = 0; i < receive; i++)
253
                param[i] = psmouse->cmdbuf[(receive - 1) - i];
254
 
255
        if (psmouse->cmdcnt)
256
                return (psmouse->cmdcnt = 0) - 1;
257
 
258
        return 0;
259
}
260
 
261
/*
262
 * psmouse_extensions() probes for any extensions to the basic PS/2 protocol
263
 * the mouse may have.
264
 */
265
 
266
static int psmouse_extensions(struct psmouse *psmouse)
267
{
268
        unsigned char param[4];
269
 
270
        param[0] = 0;
271
        psmouse->vendor = "Generic";
272
        psmouse->name = "Mouse";
273
        psmouse->model = 0;
274
 
275
        if (psmouse_noext)
276
                return PSMOUSE_PS2;
277
 
278
/*
279
 * Try Synaptics TouchPad magic ID
280
 */
281
 
523 mauro 282
       param[0] = 0;
494 giacomo 283
       psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
284
       psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
285
       psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
286
       psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
287
       psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
288
 
289
       if (param[1] == 0x47) {
290
                psmouse->vendor = "Synaptics";
291
                psmouse->name = "TouchPad";
518 mauro 292
                if (!synaptics_init(psmouse))
494 giacomo 293
                        return PSMOUSE_SYNAPTICS;
518 mauro 294
                else
494 giacomo 295
                        return PSMOUSE_PS2;
523 mauro 296
       }
494 giacomo 297
 
298
/*
299
 * Try Genius NetMouse magic init.
300
 */
301
 
302
        param[0] = 3;
303
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
304
        psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
305
        psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
306
        psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
307
        psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
308
 
309
        if (param[0] == 0x00 && param[1] == 0x33 && param[2] == 0x55) {
310
 
311
                set_bit(BTN_EXTRA, psmouse->dev.keybit);
312
                set_bit(BTN_SIDE, psmouse->dev.keybit);
313
                set_bit(REL_WHEEL, psmouse->dev.relbit);
314
 
315
                psmouse->vendor = "Genius";
316
                psmouse->name = "Wheel Mouse";
317
                return PSMOUSE_GENPS;
318
        }
319
 
320
/*
321
 * Try Logitech magic ID.
322
 */
323
 
324
        param[0] = 0;
325
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
326
        psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
327
        psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
328
        psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
329
        param[1] = 0;
330
        psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
331
 
332
        if (param[1]) {
333
                int type = ps2pp_detect_model(psmouse, param);
334
                if (type)
335
                        return type;
336
        }
337
 
338
/*
339
 * Try IntelliMouse magic init.
340
 */
341
 
342
        param[0] = 200;
343
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE);
344
        param[0] = 100;
345
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE);
346
        param[0] =  80;
347
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE);
348
        psmouse_command(psmouse, param, PSMOUSE_CMD_GETID);
349
 
350
        if (param[0] == 3) {
351
 
352
                set_bit(REL_WHEEL, psmouse->dev.relbit);
353
 
354
/*
355
 * Try IntelliMouse/Explorer magic init.
356
 */
357
 
358
                param[0] = 200;
359
                psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE);
360
                param[0] = 200;
361
                psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE);
362
                param[0] =  80;
363
                psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE);
364
                psmouse_command(psmouse, param, PSMOUSE_CMD_GETID);
365
 
366
                if (param[0] == 4) {
367
 
368
                        set_bit(BTN_SIDE, psmouse->dev.keybit);
369
                        set_bit(BTN_EXTRA, psmouse->dev.keybit);
370
 
371
                        psmouse->name = "Explorer Mouse";
372
                        return PSMOUSE_IMEX;
373
                }
374
 
375
                psmouse->name = "Wheel Mouse";
376
                return PSMOUSE_IMPS;
377
        }
378
 
379
/*
380
 * Okay, all failed, we have a standard mouse here. The number of the buttons
381
 * is still a question, though. We assume 3.
382
 */
383
 
384
        return PSMOUSE_PS2;
385
}
386
 
387
/*
388
 * psmouse_probe() probes for a PS/2 mouse.
389
 */
390
 
391
static int psmouse_probe(struct psmouse *psmouse)
392
{
393
        unsigned char param[2];
394
 
395
/*
396
 * First, we check if it's a mouse. It should send 0x00 or 0x03
397
 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer.
398
 */
399
 
400
        param[0] = param[1] = 0xa5;
401
 
402
        if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETID))
403
                return -1;
404
 
405
        if (param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04)
406
                return -1;
407
 
408
/*
409
 * Then we reset and disable the mouse so that it doesn't generate events.
410
 */
411
 
412
        if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS))
413
                return -1;
414
 
415
/*
416
 * And here we try to determine if it has any extensions over the
417
 * basic PS/2 3-button mouse.
418
 */
419
 
420
        return psmouse->type = psmouse_extensions(psmouse);
421
}
422
 
423
/*
424
 * Here we set the mouse resolution.
425
 */
426
 
427
static void psmouse_set_resolution(struct psmouse *psmouse)
428
{
429
        unsigned char param[1];
430
 
431
        if (psmouse->type == PSMOUSE_PS2PP && psmouse_resolution > 400) {
432
                ps2pp_set_800dpi(psmouse);
433
                return;
434
        }
435
 
436
        if (!psmouse_resolution || psmouse_resolution >= 200)
437
                param[0] = 3;
438
        else if (psmouse_resolution >= 100)
439
                param[0] = 2;
440
        else if (psmouse_resolution >= 50)
441
                param[0] = 1;
442
        else if (psmouse_resolution)
443
                param[0] = 0;
444
 
445
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
446
}
447
 
448
/*
449
 * Here we set the mouse report rate.
450
 */
451
 
452
static void psmouse_set_rate(struct psmouse *psmouse)
453
{
454
        unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 };
455
        int i = 0;
456
 
457
        while (rates[i] > psmouse_rate) i++;
458
        psmouse_command(psmouse, rates + i, PSMOUSE_CMD_SETRATE);
459
}
460
 
461
/*
462
 * psmouse_initialize() initializes the mouse to a sane state.
463
 */
464
 
465
static void psmouse_initialize(struct psmouse *psmouse)
466
{
467
        unsigned char param[2];
468
 
469
/*
470
 * We set the mouse report rate, resolution and scaling.
471
 */
472
 
473
        if (!psmouse_noext) {
474
                psmouse_set_rate(psmouse);
475
                psmouse_set_resolution(psmouse);
476
                psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
477
        }
478
 
479
/*
480
 * We set the mouse into streaming mode.
481
 */
482
 
483
        psmouse_command(psmouse, param, PSMOUSE_CMD_SETSTREAM);
484
}
485
 
486
/*
487
 * psmouse_activate() enables the mouse so that we get motion reports from it.
488
 */
489
 
490
static void psmouse_activate(struct psmouse *psmouse)
491
{
492
        if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE))
493
                printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", psmouse->serio->phys);
494
 
495
        psmouse->state = PSMOUSE_ACTIVATED;
496
}
497
 
498
/*
499
 * psmouse_cleanup() resets the mouse into power-on state.
500
 */
501
 
502
static void psmouse_cleanup(struct serio *serio)
503
{
504
        struct psmouse *psmouse = serio->private;
505
        unsigned char param[2];
506
        psmouse_command(psmouse, param, PSMOUSE_CMD_RESET_BAT);
507
}
508
 
509
/*
510
 * psmouse_disconnect() closes and frees.
511
 */
512
 
513
static void psmouse_disconnect(struct serio *serio)
514
{
515
        struct psmouse *psmouse = serio->private;
516
 
523 mauro 517
        /* Added by Nino - Clean de mouse before closing */
518
        psmouse_cleanup(serio);
519
 
494 giacomo 520
        psmouse->state = PSMOUSE_IGNORE;
523 mauro 521
        synaptics_disconnect(psmouse);
494 giacomo 522
        input_unregister_device(&psmouse->dev);
523
        serio_close(serio);
524
        kfree(psmouse);
525
}
526
 
527
/*
528
 * Reinitialize mouse hardware after software suspend.
529
 */
530
 
531
static int psmouse_pm_callback(struct pm_dev *dev, pm_request_t request, void *data)
532
{
533
        struct psmouse *psmouse = dev->data;
534
        struct serio_dev *ser_dev = psmouse->serio->dev;
535
 
523 mauro 536
        synaptics_disconnect(psmouse);
494 giacomo 537
 
538
        /* We need to reopen the serio port to reinitialize the i8042 controller */
539
        serio_close(psmouse->serio);
540
        serio_open(psmouse->serio, ser_dev);
541
 
542
        /* Probe and re-initialize the mouse */
543
        psmouse_probe(psmouse);
544
        psmouse_initialize(psmouse);
523 mauro 545
        synaptics_pt_init(psmouse);
494 giacomo 546
        psmouse_activate(psmouse);
547
 
548
        return 0;
549
}
550
 
551
/*
552
 * psmouse_connect() is a callback from the serio module when
553
 * an unhandled serio port is found.
554
 */
555
 
556
static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
557
{
558
        struct psmouse *psmouse;
559
        struct pm_dev *pmdev;
560
 
561
        if ((serio->type & SERIO_TYPE) != SERIO_8042 &&
562
            (serio->type & SERIO_TYPE) != SERIO_PS_PSTHRU)
563
                return;
564
 
565
        if (!(psmouse = kmalloc(sizeof(struct psmouse), GFP_KERNEL)))
566
                return;
567
 
568
        memset(psmouse, 0, sizeof(struct psmouse));
569
 
570
        init_input_dev(&psmouse->dev);
571
        psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
572
        psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
573
        psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
574
 
575
        psmouse->state = PSMOUSE_NEW_DEVICE;
576
        psmouse->serio = serio;
577
        psmouse->dev.private = psmouse;
578
 
579
        serio->private = psmouse;
580
 
581
        if (serio_open(serio, dev)) {
582
                kfree(psmouse);
583
                return;
584
        }
585
 
586
        if (psmouse_probe(psmouse) <= 0) {
587
                serio_close(serio);
588
                kfree(psmouse);
589
                return;
590
        }
591
 
592
        pmdev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, psmouse_pm_callback);
593
        if (pmdev) {
594
                psmouse->dev.pm_dev = pmdev;
595
                pmdev->data = psmouse;
596
        }
597
 
598
        sprintf26(psmouse->devname, "%s %s %s",
599
                psmouse_protocols[psmouse->type], psmouse->vendor, psmouse->name);
600
        sprintf26(psmouse->phys, "%s/input0",
601
                serio->phys);
602
 
603
        psmouse->dev.name = psmouse->devname;
604
        psmouse->dev.phys = psmouse->phys;
605
        psmouse->dev.id.bustype = BUS_I8042;
606
        psmouse->dev.id.vendor = 0x0002;
607
        psmouse->dev.id.product = psmouse->type;
608
        psmouse->dev.id.version = psmouse->model;
609
 
610
        input_register_device(&psmouse->dev);
611
 
612
        printk(KERN_INFO "input: %s on %s\n", psmouse->devname, serio->phys);
613
 
614
        psmouse_initialize(psmouse);
615
 
523 mauro 616
        synaptics_pt_init(psmouse);
494 giacomo 617
 
618
        psmouse_activate(psmouse);
619
}
620
 
621
static struct serio_dev psmouse_dev = {
622
        .interrupt =    psmouse_interrupt,
623
        .connect =      psmouse_connect,
624
        .disconnect =   psmouse_disconnect,
625
        .cleanup =      psmouse_cleanup,
626
};
627
 
628
#ifndef MODULE
629
static int __init psmouse_noext_setup(char *str)
630
{
631
        psmouse_noext = 1;
632
        return 1;
633
}
634
 
635
static int __init psmouse_resolution_setup(char *str)
636
{
637
        get_option(&str, &psmouse_resolution);
638
        return 1;
639
}
640
 
641
static int __init psmouse_smartscroll_setup(char *str)
642
{
643
        get_option(&str, &psmouse_smartscroll);
644
        return 1;
645
}
646
 
647
static int __init psmouse_resetafter_setup(char *str)
648
{
649
        get_option(&str, &psmouse_resetafter);
650
        return 1;
651
}
652
 
653
static int __init psmouse_rate_setup(char *str)
654
{
655
        get_option(&str, &psmouse_rate);
656
        return 1;
657
}
658
 
659
__setup("psmouse_noext", psmouse_noext_setup);
660
__setup("psmouse_resolution=", psmouse_resolution_setup);
661
__setup("psmouse_smartscroll=", psmouse_smartscroll_setup);
662
__setup("psmouse_resetafter=", psmouse_resetafter_setup);
663
__setup("psmouse_rate=", psmouse_rate_setup);
664
 
665
#endif
666
 
667
int __init psmouse_init(void)
668
{
669
        serio_register_device(&psmouse_dev);
670
        return 0;
671
}
672
 
673
void __exit psmouse_exit(void)
674
{
675
        serio_unregister_device(&psmouse_dev);
676
}
677
 
678
module_init(psmouse_init);
679
module_exit(psmouse_exit);