blob: d57aefd9fe7780c53a2ae4e0698d135e963e6261 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*********************************************************************
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +09002 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Filename: ircomm_param.c
4 * Version: 1.0
5 * Description: Parameter handling for the IrCOMM protocol
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Mon Jun 7 10:25:11 1999
9 * Modified at: Sun Jan 30 14:32:03 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090011 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090013 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 * the License, or (at your option) any later version.
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090018 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090023 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 * MA 02111-1307 USA
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090028 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 ********************************************************************/
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/workqueue.h>
32#include <linux/interrupt.h>
33
34#include <net/irda/irda.h>
35#include <net/irda/parameters.h>
36
37#include <net/irda/ircomm_core.h>
38#include <net/irda/ircomm_tty_attach.h>
39#include <net/irda/ircomm_tty.h>
40
41#include <net/irda/ircomm_param.h>
42
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090043static int ircomm_param_service_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090045static int ircomm_param_port_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090047static int ircomm_param_port_name(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090049static int ircomm_param_service_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090051static int ircomm_param_data_rate(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090053static int ircomm_param_data_format(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090055static int ircomm_param_flow_control(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 int get);
57static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get);
58static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090059static int ircomm_param_line_status(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 int get);
61static int ircomm_param_dte(void *instance, irda_param_t *param, int get);
62static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
63static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
64
65static pi_minor_info_t pi_minor_call_table_common[] = {
66 { ircomm_param_service_type, PV_INT_8_BITS },
67 { ircomm_param_port_type, PV_INT_8_BITS },
68 { ircomm_param_port_name, PV_STRING }
69};
70static pi_minor_info_t pi_minor_call_table_non_raw[] = {
71 { ircomm_param_data_rate, PV_INT_32_BITS | PV_BIG_ENDIAN },
72 { ircomm_param_data_format, PV_INT_8_BITS },
73 { ircomm_param_flow_control, PV_INT_8_BITS },
74 { ircomm_param_xon_xoff, PV_INT_16_BITS },
75 { ircomm_param_enq_ack, PV_INT_16_BITS },
76 { ircomm_param_line_status, PV_INT_8_BITS }
77};
78static pi_minor_info_t pi_minor_call_table_9_wire[] = {
79 { ircomm_param_dte, PV_INT_8_BITS },
80 { ircomm_param_dce, PV_INT_8_BITS },
81 { ircomm_param_poll, PV_NO_VALUE },
82};
83
84static pi_major_info_t pi_major_call_table[] = {
85 { pi_minor_call_table_common, 3 },
86 { pi_minor_call_table_non_raw, 6 },
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090087 { pi_minor_call_table_9_wire, 3 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070088/* { pi_minor_call_table_centronics } */
89};
90
91pi_param_info_t ircomm_param_info = { pi_major_call_table, 3, 0x0f, 4 };
92
93/*
94 * Function ircomm_param_request (self, pi, flush)
95 *
96 * Queue a parameter for the control channel
97 *
98 */
99int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
100{
101 struct tty_struct *tty;
102 unsigned long flags;
103 struct sk_buff *skb;
104 int count;
105
Harvey Harrison0dc47872008-03-05 20:47:47 -0800106 IRDA_DEBUG(2, "%s()\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
108 IRDA_ASSERT(self != NULL, return -1;);
109 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
110
111 tty = self->tty;
112 if (!tty)
113 return 0;
114
115 /* Make sure we don't send parameters for raw mode */
116 if (self->service_type == IRCOMM_3_WIRE_RAW)
117 return 0;
118
119 spin_lock_irqsave(&self->spinlock, flags);
120
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900121 skb = self->ctrl_skb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 if (!skb) {
Samuel Ortiz485fb2c2006-07-21 14:50:41 -0700123 skb = alloc_skb(256, GFP_ATOMIC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 if (!skb) {
125 spin_unlock_irqrestore(&self->spinlock, flags);
126 return -ENOMEM;
127 }
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900128
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 skb_reserve(skb, self->max_header_size);
130 self->ctrl_skb = skb;
131 }
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900132 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 * Inserting is a little bit tricky since we don't know how much
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900134 * room we will need. But this should hopefully work OK
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 */
Arnaldo Carvalho de Melo27a884d2007-04-19 20:29:13 -0700136 count = irda_param_insert(self, pi, skb_tail_pointer(skb),
137 skb_tailroom(skb), &ircomm_param_info);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 if (count < 0) {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800139 IRDA_WARNING("%s(), no room for parameter!\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 spin_unlock_irqrestore(&self->spinlock, flags);
141 return -1;
142 }
143 skb_put(skb, count);
144
145 spin_unlock_irqrestore(&self->spinlock, flags);
146
Harvey Harrison0dc47872008-03-05 20:47:47 -0800147 IRDA_DEBUG(2, "%s(), skb->len=%d\n", __func__ , skb->len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
149 if (flush) {
150 /* ircomm_tty_do_softint will take care of the rest */
151 schedule_work(&self->tqueue);
152 }
153
154 return count;
155}
156
157/*
158 * Function ircomm_param_service_type (self, buf, len)
159 *
160 * Handle service type, this function will both be called after the LM-IAS
161 * query and then the remote device sends its initial parameters
162 *
163 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900164static int ircomm_param_service_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 int get)
166{
167 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
168 __u8 service_type = (__u8) param->pv.i;
169
170 IRDA_ASSERT(self != NULL, return -1;);
171 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
172
173 if (get) {
174 param->pv.i = self->settings.service_type;
175 return 0;
176 }
177
178 /* Find all common service types */
179 service_type &= self->service_type;
180 if (!service_type) {
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900181 IRDA_DEBUG(2,
Harvey Harrison0dc47872008-03-05 20:47:47 -0800182 "%s(), No common service type to use!\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 return -1;
184 }
Harvey Harrison0dc47872008-03-05 20:47:47 -0800185 IRDA_DEBUG(0, "%s(), services in common=%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 service_type);
187
188 /*
189 * Now choose a preferred service type of those available
190 */
191 if (service_type & IRCOMM_CENTRONICS)
192 self->settings.service_type = IRCOMM_CENTRONICS;
193 else if (service_type & IRCOMM_9_WIRE)
194 self->settings.service_type = IRCOMM_9_WIRE;
195 else if (service_type & IRCOMM_3_WIRE)
196 self->settings.service_type = IRCOMM_3_WIRE;
197 else if (service_type & IRCOMM_3_WIRE_RAW)
198 self->settings.service_type = IRCOMM_3_WIRE_RAW;
199
Harvey Harrison0dc47872008-03-05 20:47:47 -0800200 IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 self->settings.service_type);
202
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900203 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 * Now the line is ready for some communication. Check if we are a
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900205 * server, and send over some initial parameters.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 * Client do it in ircomm_tty_state_setup().
207 * Note : we may get called from ircomm_tty_getvalue_confirm(),
208 * therefore before we even have open any socket. And self->client
209 * is initialised to TRUE only later. So, we check if the link is
210 * really initialised. - Jean II
211 */
212 if ((self->max_header_size != IRCOMM_TTY_HDR_UNINITIALISED) &&
213 (!self->client) &&
214 (self->settings.service_type != IRCOMM_3_WIRE_RAW))
215 {
216 /* Init connection */
217 ircomm_tty_send_initial_parameters(self);
218 ircomm_tty_link_established(self);
219 }
220
221 return 0;
222}
223
224/*
225 * Function ircomm_param_port_type (self, param)
226 *
227 * The port type parameter tells if the devices are serial or parallel.
228 * Since we only advertise serial service, this parameter should only
229 * be equal to IRCOMM_SERIAL.
230 */
231static int ircomm_param_port_type(void *instance, irda_param_t *param, int get)
232{
233 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
234
235 IRDA_ASSERT(self != NULL, return -1;);
236 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900237
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 if (get)
239 param->pv.i = IRCOMM_SERIAL;
240 else {
241 self->settings.port_type = (__u8) param->pv.i;
242
Harvey Harrison0dc47872008-03-05 20:47:47 -0800243 IRDA_DEBUG(0, "%s(), port type=%d\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 self->settings.port_type);
245 }
246 return 0;
247}
248
249/*
250 * Function ircomm_param_port_name (self, param)
251 *
252 * Exchange port name
253 *
254 */
255static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
256{
257 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900258
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 IRDA_ASSERT(self != NULL, return -1;);
260 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
261
262 if (get) {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800263 IRDA_DEBUG(0, "%s(), not imp!\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 } else {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800265 IRDA_DEBUG(0, "%s(), port-name=%s\n", __func__ , param->pv.c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 strncpy(self->settings.port_name, param->pv.c, 32);
267 }
268
269 return 0;
270}
271
272/*
273 * Function ircomm_param_data_rate (self, param)
274 *
275 * Exchange data rate to be used in this settings
276 *
277 */
278static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
279{
280 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900281
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 IRDA_ASSERT(self != NULL, return -1;);
283 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
284
285 if (get)
286 param->pv.i = self->settings.data_rate;
287 else
288 self->settings.data_rate = param->pv.i;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900289
Harvey Harrison0dc47872008-03-05 20:47:47 -0800290 IRDA_DEBUG(2, "%s(), data rate = %d\n", __func__ , param->pv.i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291
292 return 0;
293}
294
295/*
296 * Function ircomm_param_data_format (self, param)
297 *
298 * Exchange data format to be used in this settings
299 *
300 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900301static int ircomm_param_data_format(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 int get)
303{
304 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
305
306 IRDA_ASSERT(self != NULL, return -1;);
307 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
308
309 if (get)
310 param->pv.i = self->settings.data_format;
311 else
312 self->settings.data_format = (__u8) param->pv.i;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900313
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 return 0;
315}
316
317/*
318 * Function ircomm_param_flow_control (self, param)
319 *
320 * Exchange flow control settings to be used in this settings
321 *
322 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900323static int ircomm_param_flow_control(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 int get)
325{
326 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
327
328 IRDA_ASSERT(self != NULL, return -1;);
329 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900330
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 if (get)
332 param->pv.i = self->settings.flow_control;
333 else
334 self->settings.flow_control = (__u8) param->pv.i;
335
Harvey Harrison0dc47872008-03-05 20:47:47 -0800336 IRDA_DEBUG(1, "%s(), flow control = 0x%02x\n", __func__ , (__u8) param->pv.i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337
338 return 0;
339}
340
341/*
342 * Function ircomm_param_xon_xoff (self, param)
343 *
344 * Exchange XON/XOFF characters
345 *
346 */
347static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get)
348{
349 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
350
351 IRDA_ASSERT(self != NULL, return -1;);
352 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900353
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 if (get) {
355 param->pv.i = self->settings.xonxoff[0];
356 param->pv.i |= self->settings.xonxoff[1] << 8;
357 } else {
358 self->settings.xonxoff[0] = (__u16) param->pv.i & 0xff;
359 self->settings.xonxoff[1] = (__u16) param->pv.i >> 8;
360 }
361
Harvey Harrison0dc47872008-03-05 20:47:47 -0800362 IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 param->pv.i & 0xff, param->pv.i >> 8);
364
365 return 0;
366}
367
368/*
369 * Function ircomm_param_enq_ack (self, param)
370 *
371 * Exchange ENQ/ACK characters
372 *
373 */
374static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get)
375{
376 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
377
378 IRDA_ASSERT(self != NULL, return -1;);
379 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900380
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 if (get) {
382 param->pv.i = self->settings.enqack[0];
383 param->pv.i |= self->settings.enqack[1] << 8;
384 } else {
385 self->settings.enqack[0] = (__u16) param->pv.i & 0xff;
386 self->settings.enqack[1] = (__u16) param->pv.i >> 8;
387 }
388
Harvey Harrison0dc47872008-03-05 20:47:47 -0800389 IRDA_DEBUG(0, "%s(), ENQ/ACK = 0x%02x,0x%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 param->pv.i & 0xff, param->pv.i >> 8);
391
392 return 0;
393}
394
395/*
396 * Function ircomm_param_line_status (self, param)
397 *
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900398 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 *
400 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900401static int ircomm_param_line_status(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 int get)
403{
Harvey Harrison0dc47872008-03-05 20:47:47 -0800404 IRDA_DEBUG(2, "%s(), not impl.\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405
406 return 0;
407}
408
409/*
410 * Function ircomm_param_dte (instance, param)
411 *
412 * If we get here, there must be some sort of null-modem connection, and
413 * we are probably working in server mode as well.
414 */
415static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
416{
417 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
418 __u8 dte;
419
420 IRDA_ASSERT(self != NULL, return -1;);
421 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
422
423 if (get)
424 param->pv.i = self->settings.dte;
425 else {
426 dte = (__u8) param->pv.i;
427
428 self->settings.dce = 0;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900429
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 if (dte & IRCOMM_DELTA_DTR)
431 self->settings.dce |= (IRCOMM_DELTA_DSR|
432 IRCOMM_DELTA_RI |
433 IRCOMM_DELTA_CD);
434 if (dte & IRCOMM_DTR)
435 self->settings.dce |= (IRCOMM_DSR|
436 IRCOMM_RI |
437 IRCOMM_CD);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900438
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 if (dte & IRCOMM_DELTA_RTS)
440 self->settings.dce |= IRCOMM_DELTA_CTS;
441 if (dte & IRCOMM_RTS)
442 self->settings.dce |= IRCOMM_CTS;
443
444 /* Take appropriate actions */
445 ircomm_tty_check_modem_status(self);
446
447 /* Null modem cable emulator */
448 self->settings.null_modem = TRUE;
449 }
450
451 return 0;
452}
453
454/*
455 * Function ircomm_param_dce (instance, param)
456 *
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900457 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 *
459 */
460static int ircomm_param_dce(void *instance, irda_param_t *param, int get)
461{
462 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
463 __u8 dce;
464
Harvey Harrison0dc47872008-03-05 20:47:47 -0800465 IRDA_DEBUG(1, "%s(), dce = 0x%02x\n", __func__ , (__u8) param->pv.i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466
467 dce = (__u8) param->pv.i;
468
469 IRDA_ASSERT(self != NULL, return -1;);
470 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
471
472 self->settings.dce = dce;
473
474 /* Check if any of the settings have changed */
475 if (dce & 0x0f) {
476 if (dce & IRCOMM_DELTA_CTS) {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800477 IRDA_DEBUG(2, "%s(), CTS \n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 }
479 }
480
481 ircomm_tty_check_modem_status(self);
482
483 return 0;
484}
485
486/*
487 * Function ircomm_param_poll (instance, param)
488 *
489 * Called when the peer device is polling for the line settings
490 *
491 */
492static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
493{
494 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
495
496 IRDA_ASSERT(self != NULL, return -1;);
497 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
498
Joe Perchescc53ded2007-12-20 14:00:51 -0800499 /* Poll parameters are always of length 0 (just a signal) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 if (!get) {
501 /* Respond with DTE line settings */
502 ircomm_param_request(self, IRCOMM_DTE, TRUE);
503 }
504 return 0;
505}
506
507
508
509
510