1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#include <linux/module.h>
35#include <linux/delay.h>
36#include <linux/init.h>
37
38#include <net/irda/irda.h>
39
40#include "sir-dev.h"
41
42static int esi_open(struct sir_dev *);
43static int esi_close(struct sir_dev *);
44static int esi_change_speed(struct sir_dev *, unsigned);
45static int esi_reset(struct sir_dev *);
46
47static struct dongle_driver esi = {
48 .owner = THIS_MODULE,
49 .driver_name = "JetEye PC ESI-9680 PC",
50 .type = IRDA_ESI_DONGLE,
51 .open = esi_open,
52 .close = esi_close,
53 .reset = esi_reset,
54 .set_speed = esi_change_speed,
55};
56
57static int __init esi_sir_init(void)
58{
59 return irda_register_dongle(&esi);
60}
61
62static void __exit esi_sir_cleanup(void)
63{
64 irda_unregister_dongle(&esi);
65}
66
67static int esi_open(struct sir_dev *dev)
68{
69 struct qos_info *qos = &dev->qos;
70
71
72 sirdev_set_dtr_rts(dev, FALSE, TRUE);
73
74 qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
75 qos->min_turn_time.bits = 0x01;
76 irda_qos_bits_to_value(qos);
77
78
79
80 return 0;
81}
82
83static int esi_close(struct sir_dev *dev)
84{
85
86 sirdev_set_dtr_rts(dev, FALSE, FALSE);
87
88 return 0;
89}
90
91
92
93
94
95
96
97
98static int esi_change_speed(struct sir_dev *dev, unsigned speed)
99{
100 int ret = 0;
101 int dtr, rts;
102
103 switch (speed) {
104 case 19200:
105 dtr = TRUE;
106 rts = FALSE;
107 break;
108 case 115200:
109 dtr = rts = TRUE;
110 break;
111 default:
112 ret = -EINVAL;
113 speed = 9600;
114
115 case 9600:
116 dtr = FALSE;
117 rts = TRUE;
118 break;
119 }
120
121
122 sirdev_set_dtr_rts(dev, dtr, rts);
123 dev->speed = speed;
124
125 return ret;
126}
127
128
129
130
131
132
133
134static int esi_reset(struct sir_dev *dev)
135{
136 sirdev_set_dtr_rts(dev, FALSE, FALSE);
137
138
139
140
141
142
143
144
145
146 sirdev_set_dtr_rts(dev, FALSE, TRUE);
147 dev->speed = 9600;
148
149 return 0;
150}
151
152MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
153MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
154MODULE_LICENSE("GPL");
155MODULE_ALIAS("irda-dongle-1");
156
157module_init(esi_sir_init);
158module_exit(esi_sir_cleanup);
159
160