blob: f80b1a6a244bcadc63124d4a303adc8163b94667 [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
Jeff Kirsherd3770502013-12-06 09:13:43 -080025 * along with this program; if not, see <http://www.gnu.org/licenses/>.
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090026 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 ********************************************************************/
28
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090029#include <linux/gfp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/workqueue.h>
31#include <linux/interrupt.h>
32
33#include <net/irda/irda.h>
34#include <net/irda/parameters.h>
35
36#include <net/irda/ircomm_core.h>
37#include <net/irda/ircomm_tty_attach.h>
38#include <net/irda/ircomm_tty.h>
39
40#include <net/irda/ircomm_param.h>
41
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090042static int ircomm_param_service_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090044static int ircomm_param_port_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090046static int ircomm_param_port_name(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090048static int ircomm_param_service_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090050static int ircomm_param_data_rate(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090052static int ircomm_param_data_format(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090054static int ircomm_param_flow_control(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 int get);
56static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get);
57static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090058static int ircomm_param_line_status(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 int get);
60static int ircomm_param_dte(void *instance, irda_param_t *param, int get);
61static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
62static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
63
64static pi_minor_info_t pi_minor_call_table_common[] = {
65 { ircomm_param_service_type, PV_INT_8_BITS },
66 { ircomm_param_port_type, PV_INT_8_BITS },
67 { ircomm_param_port_name, PV_STRING }
68};
69static pi_minor_info_t pi_minor_call_table_non_raw[] = {
70 { ircomm_param_data_rate, PV_INT_32_BITS | PV_BIG_ENDIAN },
71 { ircomm_param_data_format, PV_INT_8_BITS },
72 { ircomm_param_flow_control, PV_INT_8_BITS },
73 { ircomm_param_xon_xoff, PV_INT_16_BITS },
74 { ircomm_param_enq_ack, PV_INT_16_BITS },
75 { ircomm_param_line_status, PV_INT_8_BITS }
76};
77static pi_minor_info_t pi_minor_call_table_9_wire[] = {
78 { ircomm_param_dte, PV_INT_8_BITS },
79 { ircomm_param_dce, PV_INT_8_BITS },
80 { ircomm_param_poll, PV_NO_VALUE },
81};
82
83static pi_major_info_t pi_major_call_table[] = {
84 { pi_minor_call_table_common, 3 },
85 { pi_minor_call_table_non_raw, 6 },
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +090086 { pi_minor_call_table_9_wire, 3 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070087/* { pi_minor_call_table_centronics } */
88};
89
90pi_param_info_t ircomm_param_info = { pi_major_call_table, 3, 0x0f, 4 };
91
92/*
93 * Function ircomm_param_request (self, pi, flush)
94 *
95 * Queue a parameter for the control channel
96 *
97 */
98int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
99{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 unsigned long flags;
101 struct sk_buff *skb;
102 int count;
103
Harvey Harrison0dc47872008-03-05 20:47:47 -0800104 IRDA_DEBUG(2, "%s()\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106 IRDA_ASSERT(self != NULL, return -1;);
107 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
108
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 /* Make sure we don't send parameters for raw mode */
110 if (self->service_type == IRCOMM_3_WIRE_RAW)
111 return 0;
112
113 spin_lock_irqsave(&self->spinlock, flags);
114
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900115 skb = self->ctrl_skb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 if (!skb) {
Samuel Ortiz485fb2c2006-07-21 14:50:41 -0700117 skb = alloc_skb(256, GFP_ATOMIC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 if (!skb) {
119 spin_unlock_irqrestore(&self->spinlock, flags);
120 return -ENOMEM;
121 }
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900122
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 skb_reserve(skb, self->max_header_size);
124 self->ctrl_skb = skb;
125 }
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900126 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 * Inserting is a little bit tricky since we don't know how much
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900128 * room we will need. But this should hopefully work OK
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 */
Arnaldo Carvalho de Melo27a884d2007-04-19 20:29:13 -0700130 count = irda_param_insert(self, pi, skb_tail_pointer(skb),
131 skb_tailroom(skb), &ircomm_param_info);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 if (count < 0) {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800133 IRDA_WARNING("%s(), no room for parameter!\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 spin_unlock_irqrestore(&self->spinlock, flags);
135 return -1;
136 }
137 skb_put(skb, count);
138
139 spin_unlock_irqrestore(&self->spinlock, flags);
140
Harvey Harrison0dc47872008-03-05 20:47:47 -0800141 IRDA_DEBUG(2, "%s(), skb->len=%d\n", __func__ , skb->len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
143 if (flush) {
144 /* ircomm_tty_do_softint will take care of the rest */
145 schedule_work(&self->tqueue);
146 }
147
148 return count;
149}
150
151/*
152 * Function ircomm_param_service_type (self, buf, len)
153 *
154 * Handle service type, this function will both be called after the LM-IAS
155 * query and then the remote device sends its initial parameters
156 *
157 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900158static int ircomm_param_service_type(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 int get)
160{
161 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
162 __u8 service_type = (__u8) param->pv.i;
163
164 IRDA_ASSERT(self != NULL, return -1;);
165 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
166
167 if (get) {
168 param->pv.i = self->settings.service_type;
169 return 0;
170 }
171
172 /* Find all common service types */
173 service_type &= self->service_type;
174 if (!service_type) {
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900175 IRDA_DEBUG(2,
Harvey Harrison0dc47872008-03-05 20:47:47 -0800176 "%s(), No common service type to use!\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 return -1;
178 }
Harvey Harrison0dc47872008-03-05 20:47:47 -0800179 IRDA_DEBUG(0, "%s(), services in common=%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180 service_type);
181
182 /*
183 * Now choose a preferred service type of those available
184 */
185 if (service_type & IRCOMM_CENTRONICS)
186 self->settings.service_type = IRCOMM_CENTRONICS;
187 else if (service_type & IRCOMM_9_WIRE)
188 self->settings.service_type = IRCOMM_9_WIRE;
189 else if (service_type & IRCOMM_3_WIRE)
190 self->settings.service_type = IRCOMM_3_WIRE;
191 else if (service_type & IRCOMM_3_WIRE_RAW)
192 self->settings.service_type = IRCOMM_3_WIRE_RAW;
193
Harvey Harrison0dc47872008-03-05 20:47:47 -0800194 IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 self->settings.service_type);
196
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900197 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 * Now the line is ready for some communication. Check if we are a
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900199 * server, and send over some initial parameters.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 * Client do it in ircomm_tty_state_setup().
201 * Note : we may get called from ircomm_tty_getvalue_confirm(),
202 * therefore before we even have open any socket. And self->client
203 * is initialised to TRUE only later. So, we check if the link is
204 * really initialised. - Jean II
205 */
206 if ((self->max_header_size != IRCOMM_TTY_HDR_UNINITIALISED) &&
207 (!self->client) &&
208 (self->settings.service_type != IRCOMM_3_WIRE_RAW))
209 {
210 /* Init connection */
211 ircomm_tty_send_initial_parameters(self);
212 ircomm_tty_link_established(self);
213 }
214
215 return 0;
216}
217
218/*
219 * Function ircomm_param_port_type (self, param)
220 *
221 * The port type parameter tells if the devices are serial or parallel.
222 * Since we only advertise serial service, this parameter should only
223 * be equal to IRCOMM_SERIAL.
224 */
225static int ircomm_param_port_type(void *instance, irda_param_t *param, int get)
226{
227 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
228
229 IRDA_ASSERT(self != NULL, return -1;);
230 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900231
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 if (get)
233 param->pv.i = IRCOMM_SERIAL;
234 else {
235 self->settings.port_type = (__u8) param->pv.i;
236
Harvey Harrison0dc47872008-03-05 20:47:47 -0800237 IRDA_DEBUG(0, "%s(), port type=%d\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 self->settings.port_type);
239 }
240 return 0;
241}
242
243/*
244 * Function ircomm_param_port_name (self, param)
245 *
246 * Exchange port name
247 *
248 */
249static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
250{
251 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900252
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 IRDA_ASSERT(self != NULL, return -1;);
254 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
255
256 if (get) {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800257 IRDA_DEBUG(0, "%s(), not imp!\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 } else {
Harvey Harrison0dc47872008-03-05 20:47:47 -0800259 IRDA_DEBUG(0, "%s(), port-name=%s\n", __func__ , param->pv.c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 strncpy(self->settings.port_name, param->pv.c, 32);
261 }
262
263 return 0;
264}
265
266/*
267 * Function ircomm_param_data_rate (self, param)
268 *
269 * Exchange data rate to be used in this settings
270 *
271 */
272static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
273{
274 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900275
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 IRDA_ASSERT(self != NULL, return -1;);
277 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
278
279 if (get)
280 param->pv.i = self->settings.data_rate;
281 else
282 self->settings.data_rate = param->pv.i;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900283
Harvey Harrison0dc47872008-03-05 20:47:47 -0800284 IRDA_DEBUG(2, "%s(), data rate = %d\n", __func__ , param->pv.i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285
286 return 0;
287}
288
289/*
290 * Function ircomm_param_data_format (self, param)
291 *
292 * Exchange data format to be used in this settings
293 *
294 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900295static int ircomm_param_data_format(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 int get)
297{
298 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
299
300 IRDA_ASSERT(self != NULL, return -1;);
301 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
302
303 if (get)
304 param->pv.i = self->settings.data_format;
305 else
306 self->settings.data_format = (__u8) param->pv.i;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900307
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 return 0;
309}
310
311/*
312 * Function ircomm_param_flow_control (self, param)
313 *
314 * Exchange flow control settings to be used in this settings
315 *
316 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900317static int ircomm_param_flow_control(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 int get)
319{
320 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
321
322 IRDA_ASSERT(self != NULL, return -1;);
323 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900324
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325 if (get)
326 param->pv.i = self->settings.flow_control;
327 else
328 self->settings.flow_control = (__u8) param->pv.i;
329
Harvey Harrison0dc47872008-03-05 20:47:47 -0800330 IRDA_DEBUG(1, "%s(), flow control = 0x%02x\n", __func__ , (__u8) param->pv.i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331
332 return 0;
333}
334
335/*
336 * Function ircomm_param_xon_xoff (self, param)
337 *
338 * Exchange XON/XOFF characters
339 *
340 */
341static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get)
342{
343 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
344
345 IRDA_ASSERT(self != NULL, return -1;);
346 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900347
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 if (get) {
349 param->pv.i = self->settings.xonxoff[0];
350 param->pv.i |= self->settings.xonxoff[1] << 8;
351 } else {
352 self->settings.xonxoff[0] = (__u16) param->pv.i & 0xff;
353 self->settings.xonxoff[1] = (__u16) param->pv.i >> 8;
354 }
355
Harvey Harrison0dc47872008-03-05 20:47:47 -0800356 IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357 param->pv.i & 0xff, param->pv.i >> 8);
358
359 return 0;
360}
361
362/*
363 * Function ircomm_param_enq_ack (self, param)
364 *
365 * Exchange ENQ/ACK characters
366 *
367 */
368static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get)
369{
370 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
371
372 IRDA_ASSERT(self != NULL, return -1;);
373 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900374
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 if (get) {
376 param->pv.i = self->settings.enqack[0];
377 param->pv.i |= self->settings.enqack[1] << 8;
378 } else {
379 self->settings.enqack[0] = (__u16) param->pv.i & 0xff;
380 self->settings.enqack[1] = (__u16) param->pv.i >> 8;
381 }
382
Harvey Harrison0dc47872008-03-05 20:47:47 -0800383 IRDA_DEBUG(0, "%s(), ENQ/ACK = 0x%02x,0x%02x\n", __func__ ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 param->pv.i & 0xff, param->pv.i >> 8);
385
386 return 0;
387}
388
389/*
390 * Function ircomm_param_line_status (self, param)
391 *
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900392 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 *
394 */
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900395static int ircomm_param_line_status(void *instance, irda_param_t *param,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 int get)
397{
Harvey Harrison0dc47872008-03-05 20:47:47 -0800398 IRDA_DEBUG(2, "%s(), not impl.\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399
400 return 0;
401}
402
403/*
404 * Function ircomm_param_dte (instance, param)
405 *
406 * If we get here, there must be some sort of null-modem connection, and
407 * we are probably working in server mode as well.
408 */
409static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
410{
411 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
412 __u8 dte;
413
414 IRDA_ASSERT(self != NULL, return -1;);
415 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
416
417 if (get)
418 param->pv.i = self->settings.dte;
419 else {
420 dte = (__u8) param->pv.i;
421
422 self->settings.dce = 0;
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900423
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 if (dte & IRCOMM_DELTA_DTR)
425 self->settings.dce |= (IRCOMM_DELTA_DSR|
426 IRCOMM_DELTA_RI |
427 IRCOMM_DELTA_CD);
428 if (dte & IRCOMM_DTR)
429 self->settings.dce |= (IRCOMM_DSR|
430 IRCOMM_RI |
431 IRCOMM_CD);
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900432
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 if (dte & IRCOMM_DELTA_RTS)
434 self->settings.dce |= IRCOMM_DELTA_CTS;
435 if (dte & IRCOMM_RTS)
436 self->settings.dce |= IRCOMM_CTS;
437
438 /* Take appropriate actions */
439 ircomm_tty_check_modem_status(self);
440
441 /* Null modem cable emulator */
442 self->settings.null_modem = TRUE;
443 }
444
445 return 0;
446}
447
448/*
449 * Function ircomm_param_dce (instance, param)
450 *
YOSHIFUJI Hideaki6819bc22007-02-09 23:24:53 +0900451 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 *
453 */
454static int ircomm_param_dce(void *instance, irda_param_t *param, int get)
455{
456 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
457 __u8 dce;
458
Harvey Harrison0dc47872008-03-05 20:47:47 -0800459 IRDA_DEBUG(1, "%s(), dce = 0x%02x\n", __func__ , (__u8) param->pv.i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460
461 dce = (__u8) param->pv.i;
462
463 IRDA_ASSERT(self != NULL, return -1;);
464 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
465
466 self->settings.dce = dce;
467
468 /* Check if any of the settings have changed */
469 if (dce & 0x0f) {
470 if (dce & IRCOMM_DELTA_CTS) {
Frans Popb1383382010-03-24 07:57:28 +0000471 IRDA_DEBUG(2, "%s(), CTS\n", __func__ );
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 }
473 }
474
475 ircomm_tty_check_modem_status(self);
476
477 return 0;
478}
479
480/*
481 * Function ircomm_param_poll (instance, param)
482 *
483 * Called when the peer device is polling for the line settings
484 *
485 */
486static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
487{
488 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
489
490 IRDA_ASSERT(self != NULL, return -1;);
491 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
492
Joe Perchescc53ded2007-12-20 14:00:51 -0800493 /* Poll parameters are always of length 0 (just a signal) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 if (!get) {
495 /* Respond with DTE line settings */
496 ircomm_param_request(self, IRCOMM_DTE, TRUE);
497 }
498 return 0;
499}
500
501
502
503
504