drivers/usb/serial/keyspan_pda.c
Source file repositories/reference/linux-study-clean/drivers/usb/serial/keyspan_pda.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/serial/keyspan_pda.c- Extension
.c- Size
- 18283 bytes
- Lines
- 723
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/slab.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/module.hlinux/spinlock.hlinux/workqueue.hlinux/uaccess.hlinux/usb.hlinux/usb/serial.hlinux/usb/ezusb.h
Detected Declarations
struct keyspan_pda_privatefunction keyspan_pda_get_write_roomfunction keyspan_pda_request_unthrottlefunction keyspan_pda_rx_interruptfunction keyspan_pda_rx_throttlefunction keyspan_pda_rx_unthrottlefunction keyspan_pda_setbaudfunction keyspan_pda_break_ctlfunction keyspan_pda_set_termiosfunction keyspan_pda_get_modem_infofunction keyspan_pda_set_modem_infofunction keyspan_pda_tiocmgetfunction keyspan_pda_tiocmsetfunction keyspan_pda_write_startfunction keyspan_pda_write_bulk_callbackfunction keyspan_pda_writefunction keyspan_pda_dtr_rtsfunction keyspan_pda_openfunction keyspan_pda_closefunction keyspan_pda_fake_startupfunction keyspan_pda_port_probefunction keyspan_pda_port_remove
Annotated Snippet
struct keyspan_pda_private {
int tx_room;
struct work_struct unthrottle_work;
struct usb_serial *serial;
struct usb_serial_port *port;
};
static int keyspan_pda_write_start(struct usb_serial_port *port);
#define KEYSPAN_VENDOR_ID 0x06cd
#define KEYSPAN_PDA_FAKE_ID 0x0103
#define KEYSPAN_PDA_ID 0x0104 /* no clue */
/* For Xircom PGSDB9 and older Entrega version of the same device */
#define XIRCOM_VENDOR_ID 0x085a
#define XIRCOM_FAKE_ID 0x8027
#define XIRCOM_FAKE_ID_2 0x8025 /* "PGMFHUB" serial */
#define ENTREGA_VENDOR_ID 0x1645
#define ENTREGA_FAKE_ID 0x8093
static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, id_table_combined);
static const struct usb_device_id id_table_std[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
{ } /* Terminating entry */
};
static const struct usb_device_id id_table_fake[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
{ } /* Terminating entry */
};
static int keyspan_pda_get_write_room(struct keyspan_pda_private *priv)
{
struct usb_serial_port *port = priv->port;
struct usb_serial *serial = port->serial;
u8 room;
int rc;
rc = usb_control_msg_recv(serial->dev,
0,
6, /* write_room */
USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_IN,
0, /* value: 0 means "remaining room" */
0, /* index */
&room,
1,
2000,
GFP_KERNEL);
if (rc) {
dev_dbg(&port->dev, "roomquery failed: %d\n", rc);
return rc;
}
dev_dbg(&port->dev, "roomquery says %d\n", room);
return room;
}
static void keyspan_pda_request_unthrottle(struct work_struct *work)
{
struct keyspan_pda_private *priv =
container_of(work, struct keyspan_pda_private, unthrottle_work);
struct usb_serial_port *port = priv->port;
struct usb_serial *serial = port->serial;
unsigned long flags;
int result;
dev_dbg(&port->dev, "%s\n", __func__);
/*
* Ask the device to tell us when the tx buffer becomes
* sufficiently empty.
*/
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0),
7, /* request_unthrottle */
USB_TYPE_VENDOR | USB_RECIP_INTERFACE
| USB_DIR_OUT,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/slab.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/module.h`, `linux/spinlock.h`.
- Detected declarations: `struct keyspan_pda_private`, `function keyspan_pda_get_write_room`, `function keyspan_pda_request_unthrottle`, `function keyspan_pda_rx_interrupt`, `function keyspan_pda_rx_throttle`, `function keyspan_pda_rx_unthrottle`, `function keyspan_pda_setbaud`, `function keyspan_pda_break_ctl`, `function keyspan_pda_set_termios`, `function keyspan_pda_get_modem_info`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.