Lines Matching +full:serial +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (C) 1999 - 2004
7 * Greg Kroah-Hartman (greg@kroah.com)
9 * See Documentation/usb/usb-serial.rst for more information on using this
25 #include <linux/usb/serial.h>
32 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
38 static int visor_probe(struct usb_serial *serial,
39 const struct usb_device_id *id);
40 static int visor_calc_num_ports(struct usb_serial *serial,
42 static int clie_5_calc_num_ports(struct usb_serial *serial,
45 static int clie_3_5_startup(struct usb_serial *serial);
46 static int palm_os_3_probe(struct usb_serial *serial,
47 const struct usb_device_id *id);
48 static int palm_os_4_probe(struct usb_serial *serial,
49 const struct usb_device_id *id);
225 if (!port->read_urb) { in visor_open()
227 dev_err(&port->dev, "Device lied about number of ports, please use a lower one.\n"); in visor_open()
228 return -ENODEV; in visor_open()
236 if (port->interrupt_in_urb) { in visor_open()
237 dev_dbg(&port->dev, "adding interrupt input for treo\n"); in visor_open()
238 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); in visor_open()
240 dev_err(&port->dev, in visor_open()
241 "%s - failed submitting interrupt urb, error %d\n", in visor_open()
254 usb_kill_urb(port->interrupt_in_urb); in visor_close()
259 usb_control_msg(port->serial->dev, in visor_close()
260 usb_rcvctrlpipe(port->serial->dev, 0), in visor_close()
269 struct usb_serial_port *port = urb->context; in visor_read_int_callback()
270 int status = urb->status; in visor_read_int_callback()
277 case -ECONNRESET: in visor_read_int_callback()
278 case -ENOENT: in visor_read_int_callback()
279 case -ESHUTDOWN: in visor_read_int_callback()
281 dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n", in visor_read_int_callback()
285 dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n", in visor_read_int_callback()
297 usb_serial_debug_data(&port->dev, __func__, urb->actual_length, in visor_read_int_callback()
298 urb->transfer_buffer); in visor_read_int_callback()
303 dev_err(&urb->dev->dev, in visor_read_int_callback()
304 "%s - Error %d submitting interrupt urb\n", in visor_read_int_callback()
308 static int palm_os_3_probe(struct usb_serial *serial, in palm_os_3_probe() argument
309 const struct usb_device_id *id) in palm_os_3_probe() argument
311 struct device *dev = &serial->dev->dev; in palm_os_3_probe()
321 return -ENOMEM; in palm_os_3_probe()
324 retval = usb_control_msg(serial->dev, in palm_os_3_probe()
325 usb_rcvctrlpipe(serial->dev, 0), in palm_os_3_probe()
330 dev_err(dev, "%s - error %d getting connection information\n", in palm_os_3_probe()
337 retval = -ENODEV; in palm_os_3_probe()
343 num_ports = le16_to_cpu(connection_info->num_ports); in palm_os_3_probe()
348 serial->type->description); in palm_os_3_probe()
353 switch (connection_info->connections[i].port_function_id) { in palm_os_3_probe()
374 serial->type->description, in palm_os_3_probe()
375 connection_info->connections[i].port, string); in palm_os_3_probe()
377 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description, in palm_os_3_probe()
384 usb_set_serial_data(serial, (void *)(long)num_ports); in palm_os_3_probe()
388 retval = usb_control_msg(serial->dev, in palm_os_3_probe()
389 usb_rcvctrlpipe(serial->dev, 0), in palm_os_3_probe()
394 dev_err(dev, "%s - error %d getting bytes available request\n", in palm_os_3_probe()
404 static int palm_os_4_probe(struct usb_serial *serial, in palm_os_4_probe() argument
405 const struct usb_device_id *id) in palm_os_4_probe() argument
407 struct device *dev = &serial->dev->dev; in palm_os_4_probe()
414 return -ENOMEM; in palm_os_4_probe()
416 retval = usb_control_msg(serial->dev, in palm_os_4_probe()
417 usb_rcvctrlpipe(serial->dev, 0), in palm_os_4_probe()
422 dev_err(dev, "%s - error %d getting connection info\n", in palm_os_4_probe()
432 static int visor_probe(struct usb_serial *serial, in visor_probe() argument
433 const struct usb_device_id *id) in visor_probe() argument
436 int (*startup)(struct usb_serial *serial, in visor_probe()
437 const struct usb_device_id *id); in visor_probe()
440 * some Samsung Android phones in modem mode have the same ID in visor_probe()
441 * as SPH-I500, but they are ACM devices, so dont bind to them in visor_probe()
443 if (id->idVendor == SAMSUNG_VENDOR_ID && in visor_probe()
444 id->idProduct == SAMSUNG_SPH_I500_ID && in visor_probe()
445 serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM && in visor_probe()
446 serial->dev->descriptor.bDeviceSubClass == in visor_probe()
448 return -ENODEV; in visor_probe()
450 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { in visor_probe()
451 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", in visor_probe()
452 serial->dev->actconfig->desc.bConfigurationValue); in visor_probe()
453 return -ENODEV; in visor_probe()
456 if (id->driver_info) { in visor_probe()
457 startup = (void *)id->driver_info; in visor_probe()
458 retval = startup(serial, id); in visor_probe()
464 static int visor_calc_num_ports(struct usb_serial *serial, in visor_calc_num_ports() argument
467 unsigned int vid = le16_to_cpu(serial->dev->descriptor.idVendor); in visor_calc_num_ports()
468 int num_ports = (int)(long)(usb_get_serial_data(serial)); in visor_calc_num_ports()
471 usb_set_serial_data(serial, NULL); in visor_calc_num_ports()
478 epds->num_interrupt_in == 0) in visor_calc_num_ports()
481 if (epds->num_bulk_in < 2 || epds->num_interrupt_in < 2) { in visor_calc_num_ports()
482 dev_err(&serial->interface->dev, "missing endpoints\n"); in visor_calc_num_ports()
483 return -ENODEV; in visor_calc_num_ports()
493 swap(epds->bulk_in[0], epds->bulk_in[1]); in visor_calc_num_ports()
494 swap(epds->interrupt_in[0], epds->interrupt_in[1]); in visor_calc_num_ports()
499 static int clie_5_calc_num_ports(struct usb_serial *serial, in clie_5_calc_num_ports() argument
504 * Communication in from the UX50/TH55 uses the first bulk-in in clie_5_calc_num_ports()
506 * bulk-out endpoint. in clie_5_calc_num_ports()
511 * bulk-out endpoint for both ports? in clie_5_calc_num_ports()
513 epds->bulk_out[0] = epds->bulk_out[1]; in clie_5_calc_num_ports()
515 return serial->type->num_ports; in clie_5_calc_num_ports()
518 static int clie_3_5_startup(struct usb_serial *serial) in clie_3_5_startup() argument
520 struct device *dev = &serial->dev->dev; in clie_3_5_startup()
526 return -ENOMEM; in clie_3_5_startup()
529 * Note that PEG-300 series devices expect the following two calls. in clie_3_5_startup()
533 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), in clie_3_5_startup()
544 result = -EIO; in clie_3_5_startup()
549 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), in clie_3_5_startup()
562 result = -EIO; in clie_3_5_startup()