keyspan.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /*
  2. Keyspan USB to Serial Converter driver
  3. (C) Copyright (C) 2000-2001
  4. Hugh Blemings <hugh@blemings.org>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. See http://blemings.org/hugh/keyspan.html for more information.
  10. Code in this driver inspired by and in a number of places taken
  11. from Brian Warner's original Keyspan-PDA driver.
  12. This driver has been put together with the support of Innosys, Inc.
  13. and Keyspan, Inc the manufacturers of the Keyspan USB-serial products.
  14. Thanks Guys :)
  15. Thanks to Paulus for miscellaneous tidy ups, some largish chunks
  16. of much nicer and/or completely new code and (perhaps most uniquely)
  17. having the patience to sit down and explain why and where he'd changed
  18. stuff.
  19. Tip 'o the hat to IBM (and previously Linuxcare :) for supporting
  20. staff in their work on open source projects.
  21. See keyspan.c for update history.
  22. */
  23. #ifndef __LINUX_USB_SERIAL_KEYSPAN_H
  24. #define __LINUX_USB_SERIAL_KEYSPAN_H
  25. /* Function prototypes for Keyspan serial converter */
  26. static int keyspan_open (struct tty_struct *tty,
  27. struct usb_serial_port *port);
  28. static void keyspan_close (struct usb_serial_port *port);
  29. static void keyspan_dtr_rts (struct usb_serial_port *port, int on);
  30. static int keyspan_startup (struct usb_serial *serial);
  31. static void keyspan_disconnect (struct usb_serial *serial);
  32. static void keyspan_release (struct usb_serial *serial);
  33. static int keyspan_port_probe(struct usb_serial_port *port);
  34. static int keyspan_port_remove(struct usb_serial_port *port);
  35. static int keyspan_write_room (struct tty_struct *tty);
  36. static int keyspan_write (struct tty_struct *tty,
  37. struct usb_serial_port *port,
  38. const unsigned char *buf,
  39. int count);
  40. static void keyspan_send_setup (struct usb_serial_port *port,
  41. int reset_port);
  42. static void keyspan_set_termios (struct tty_struct *tty,
  43. struct usb_serial_port *port,
  44. struct ktermios *old);
  45. static void keyspan_break_ctl (struct tty_struct *tty,
  46. int break_state);
  47. static int keyspan_tiocmget (struct tty_struct *tty);
  48. static int keyspan_tiocmset (struct tty_struct *tty,
  49. unsigned int set,
  50. unsigned int clear);
  51. static int keyspan_fake_startup (struct usb_serial *serial);
  52. static int keyspan_usa19_calc_baud (struct usb_serial_port *port,
  53. u32 baud_rate, u32 baudclk,
  54. u8 *rate_hi, u8 *rate_low,
  55. u8 *prescaler, int portnum);
  56. static int keyspan_usa19w_calc_baud (struct usb_serial_port *port,
  57. u32 baud_rate, u32 baudclk,
  58. u8 *rate_hi, u8 *rate_low,
  59. u8 *prescaler, int portnum);
  60. static int keyspan_usa28_calc_baud (struct usb_serial_port *port,
  61. u32 baud_rate, u32 baudclk,
  62. u8 *rate_hi, u8 *rate_low,
  63. u8 *prescaler, int portnum);
  64. static int keyspan_usa19hs_calc_baud (struct usb_serial_port *port,
  65. u32 baud_rate, u32 baudclk,
  66. u8 *rate_hi, u8 *rate_low,
  67. u8 *prescaler, int portnum);
  68. static int keyspan_usa28_send_setup (struct usb_serial *serial,
  69. struct usb_serial_port *port,
  70. int reset_port);
  71. static int keyspan_usa26_send_setup (struct usb_serial *serial,
  72. struct usb_serial_port *port,
  73. int reset_port);
  74. static int keyspan_usa49_send_setup (struct usb_serial *serial,
  75. struct usb_serial_port *port,
  76. int reset_port);
  77. static int keyspan_usa90_send_setup (struct usb_serial *serial,
  78. struct usb_serial_port *port,
  79. int reset_port);
  80. static int keyspan_usa67_send_setup (struct usb_serial *serial,
  81. struct usb_serial_port *port,
  82. int reset_port);
  83. /* Values used for baud rate calculation - device specific */
  84. #define KEYSPAN_INVALID_BAUD_RATE (-1)
  85. #define KEYSPAN_BAUD_RATE_OK (0)
  86. #define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
  87. #define KEYSPAN_USA19_BAUDCLK (12000000L)
  88. #define KEYSPAN_USA19W_BAUDCLK (24000000L)
  89. #define KEYSPAN_USA19HS_BAUDCLK (14769231L)
  90. #define KEYSPAN_USA28_BAUDCLK (1843200L)
  91. #define KEYSPAN_USA28X_BAUDCLK (12000000L)
  92. #define KEYSPAN_USA49W_BAUDCLK (48000000L)
  93. /* Some constants used to characterise each device. */
  94. #define KEYSPAN_MAX_NUM_PORTS (4)
  95. #define KEYSPAN_MAX_FLIPS (2)
  96. /* Device info for the Keyspan serial converter, used
  97. by the overall usb-serial probe function */
  98. #define KEYSPAN_VENDOR_ID (0x06cd)
  99. /* Product IDs for the products supported, pre-renumeration */
  100. #define keyspan_usa18x_pre_product_id 0x0105
  101. #define keyspan_usa19_pre_product_id 0x0103
  102. #define keyspan_usa19qi_pre_product_id 0x010b
  103. #define keyspan_mpr_pre_product_id 0x011b
  104. #define keyspan_usa19qw_pre_product_id 0x0118
  105. #define keyspan_usa19w_pre_product_id 0x0106
  106. #define keyspan_usa28_pre_product_id 0x0101
  107. #define keyspan_usa28x_pre_product_id 0x0102
  108. #define keyspan_usa28xa_pre_product_id 0x0114
  109. #define keyspan_usa28xb_pre_product_id 0x0113
  110. #define keyspan_usa49w_pre_product_id 0x0109
  111. #define keyspan_usa49wlc_pre_product_id 0x011a
  112. /* Product IDs post-renumeration. Note that the 28x and 28xb
  113. have the same id's post-renumeration but behave identically
  114. so it's not an issue. As such, the 28xb is not listed in any
  115. of the device tables. */
  116. #define keyspan_usa18x_product_id 0x0112
  117. #define keyspan_usa19_product_id 0x0107
  118. #define keyspan_usa19qi_product_id 0x010c
  119. #define keyspan_usa19hs_product_id 0x0121
  120. #define keyspan_mpr_product_id 0x011c
  121. #define keyspan_usa19qw_product_id 0x0119
  122. #define keyspan_usa19w_product_id 0x0108
  123. #define keyspan_usa28_product_id 0x010f
  124. #define keyspan_usa28x_product_id 0x0110
  125. #define keyspan_usa28xa_product_id 0x0115
  126. #define keyspan_usa28xb_product_id 0x0110
  127. #define keyspan_usa28xg_product_id 0x0135
  128. #define keyspan_usa49w_product_id 0x010a
  129. #define keyspan_usa49wlc_product_id 0x012a
  130. #define keyspan_usa49wg_product_id 0x0131
  131. struct keyspan_device_details {
  132. /* product ID value */
  133. int product_id;
  134. enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90, msg_usa67} msg_format;
  135. /* Number of physical ports */
  136. int num_ports;
  137. /* 1 if endpoint flipping used on input, 0 if not */
  138. int indat_endp_flip;
  139. /* 1 if endpoint flipping used on output, 0 if not */
  140. int outdat_endp_flip;
  141. /* Table mapping input data endpoint IDs to physical
  142. port number and flip if used */
  143. int indat_endpoints[KEYSPAN_MAX_NUM_PORTS];
  144. /* Same for output endpoints */
  145. int outdat_endpoints[KEYSPAN_MAX_NUM_PORTS];
  146. /* Input acknowledge endpoints */
  147. int inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
  148. /* Output control endpoints */
  149. int outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
  150. /* Endpoint used for input status */
  151. int instat_endpoint;
  152. /* Endpoint used for input data 49WG only */
  153. int indat_endpoint;
  154. /* Endpoint used for global control functions */
  155. int glocont_endpoint;
  156. int (*calculate_baud_rate) (struct usb_serial_port *port,
  157. u32 baud_rate, u32 baudclk,
  158. u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
  159. u32 baudclk;
  160. };
  161. /* Now for each device type we setup the device detail
  162. structure with the appropriate information (provided
  163. in Keyspan's documentation) */
  164. static const struct keyspan_device_details usa18x_device_details = {
  165. .product_id = keyspan_usa18x_product_id,
  166. .msg_format = msg_usa26,
  167. .num_ports = 1,
  168. .indat_endp_flip = 0,
  169. .outdat_endp_flip = 1,
  170. .indat_endpoints = {0x81},
  171. .outdat_endpoints = {0x01},
  172. .inack_endpoints = {0x85},
  173. .outcont_endpoints = {0x05},
  174. .instat_endpoint = 0x87,
  175. .indat_endpoint = -1,
  176. .glocont_endpoint = 0x07,
  177. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  178. .baudclk = KEYSPAN_USA18X_BAUDCLK,
  179. };
  180. static const struct keyspan_device_details usa19_device_details = {
  181. .product_id = keyspan_usa19_product_id,
  182. .msg_format = msg_usa28,
  183. .num_ports = 1,
  184. .indat_endp_flip = 1,
  185. .outdat_endp_flip = 1,
  186. .indat_endpoints = {0x81},
  187. .outdat_endpoints = {0x01},
  188. .inack_endpoints = {0x83},
  189. .outcont_endpoints = {0x03},
  190. .instat_endpoint = 0x84,
  191. .indat_endpoint = -1,
  192. .glocont_endpoint = -1,
  193. .calculate_baud_rate = keyspan_usa19_calc_baud,
  194. .baudclk = KEYSPAN_USA19_BAUDCLK,
  195. };
  196. static const struct keyspan_device_details usa19qi_device_details = {
  197. .product_id = keyspan_usa19qi_product_id,
  198. .msg_format = msg_usa28,
  199. .num_ports = 1,
  200. .indat_endp_flip = 1,
  201. .outdat_endp_flip = 1,
  202. .indat_endpoints = {0x81},
  203. .outdat_endpoints = {0x01},
  204. .inack_endpoints = {0x83},
  205. .outcont_endpoints = {0x03},
  206. .instat_endpoint = 0x84,
  207. .indat_endpoint = -1,
  208. .glocont_endpoint = -1,
  209. .calculate_baud_rate = keyspan_usa28_calc_baud,
  210. .baudclk = KEYSPAN_USA19_BAUDCLK,
  211. };
  212. static const struct keyspan_device_details mpr_device_details = {
  213. .product_id = keyspan_mpr_product_id,
  214. .msg_format = msg_usa28,
  215. .num_ports = 1,
  216. .indat_endp_flip = 1,
  217. .outdat_endp_flip = 1,
  218. .indat_endpoints = {0x81},
  219. .outdat_endpoints = {0x01},
  220. .inack_endpoints = {0x83},
  221. .outcont_endpoints = {0x03},
  222. .instat_endpoint = 0x84,
  223. .indat_endpoint = -1,
  224. .glocont_endpoint = -1,
  225. .calculate_baud_rate = keyspan_usa28_calc_baud,
  226. .baudclk = KEYSPAN_USA19_BAUDCLK,
  227. };
  228. static const struct keyspan_device_details usa19qw_device_details = {
  229. .product_id = keyspan_usa19qw_product_id,
  230. .msg_format = msg_usa26,
  231. .num_ports = 1,
  232. .indat_endp_flip = 0,
  233. .outdat_endp_flip = 1,
  234. .indat_endpoints = {0x81},
  235. .outdat_endpoints = {0x01},
  236. .inack_endpoints = {0x85},
  237. .outcont_endpoints = {0x05},
  238. .instat_endpoint = 0x87,
  239. .indat_endpoint = -1,
  240. .glocont_endpoint = 0x07,
  241. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  242. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  243. };
  244. static const struct keyspan_device_details usa19w_device_details = {
  245. .product_id = keyspan_usa19w_product_id,
  246. .msg_format = msg_usa26,
  247. .num_ports = 1,
  248. .indat_endp_flip = 0,
  249. .outdat_endp_flip = 1,
  250. .indat_endpoints = {0x81},
  251. .outdat_endpoints = {0x01},
  252. .inack_endpoints = {0x85},
  253. .outcont_endpoints = {0x05},
  254. .instat_endpoint = 0x87,
  255. .indat_endpoint = -1,
  256. .glocont_endpoint = 0x07,
  257. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  258. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  259. };
  260. static const struct keyspan_device_details usa19hs_device_details = {
  261. .product_id = keyspan_usa19hs_product_id,
  262. .msg_format = msg_usa90,
  263. .num_ports = 1,
  264. .indat_endp_flip = 0,
  265. .outdat_endp_flip = 0,
  266. .indat_endpoints = {0x81},
  267. .outdat_endpoints = {0x01},
  268. .inack_endpoints = {-1},
  269. .outcont_endpoints = {0x02},
  270. .instat_endpoint = 0x82,
  271. .indat_endpoint = -1,
  272. .glocont_endpoint = -1,
  273. .calculate_baud_rate = keyspan_usa19hs_calc_baud,
  274. .baudclk = KEYSPAN_USA19HS_BAUDCLK,
  275. };
  276. static const struct keyspan_device_details usa28_device_details = {
  277. .product_id = keyspan_usa28_product_id,
  278. .msg_format = msg_usa28,
  279. .num_ports = 2,
  280. .indat_endp_flip = 1,
  281. .outdat_endp_flip = 1,
  282. .indat_endpoints = {0x81, 0x83},
  283. .outdat_endpoints = {0x01, 0x03},
  284. .inack_endpoints = {0x85, 0x86},
  285. .outcont_endpoints = {0x05, 0x06},
  286. .instat_endpoint = 0x87,
  287. .indat_endpoint = -1,
  288. .glocont_endpoint = 0x07,
  289. .calculate_baud_rate = keyspan_usa28_calc_baud,
  290. .baudclk = KEYSPAN_USA28_BAUDCLK,
  291. };
  292. static const struct keyspan_device_details usa28x_device_details = {
  293. .product_id = keyspan_usa28x_product_id,
  294. .msg_format = msg_usa26,
  295. .num_ports = 2,
  296. .indat_endp_flip = 0,
  297. .outdat_endp_flip = 1,
  298. .indat_endpoints = {0x81, 0x83},
  299. .outdat_endpoints = {0x01, 0x03},
  300. .inack_endpoints = {0x85, 0x86},
  301. .outcont_endpoints = {0x05, 0x06},
  302. .instat_endpoint = 0x87,
  303. .indat_endpoint = -1,
  304. .glocont_endpoint = 0x07,
  305. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  306. .baudclk = KEYSPAN_USA28X_BAUDCLK,
  307. };
  308. static const struct keyspan_device_details usa28xa_device_details = {
  309. .product_id = keyspan_usa28xa_product_id,
  310. .msg_format = msg_usa26,
  311. .num_ports = 2,
  312. .indat_endp_flip = 0,
  313. .outdat_endp_flip = 1,
  314. .indat_endpoints = {0x81, 0x83},
  315. .outdat_endpoints = {0x01, 0x03},
  316. .inack_endpoints = {0x85, 0x86},
  317. .outcont_endpoints = {0x05, 0x06},
  318. .instat_endpoint = 0x87,
  319. .indat_endpoint = -1,
  320. .glocont_endpoint = 0x07,
  321. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  322. .baudclk = KEYSPAN_USA28X_BAUDCLK,
  323. };
  324. static const struct keyspan_device_details usa28xg_device_details = {
  325. .product_id = keyspan_usa28xg_product_id,
  326. .msg_format = msg_usa67,
  327. .num_ports = 2,
  328. .indat_endp_flip = 0,
  329. .outdat_endp_flip = 0,
  330. .indat_endpoints = {0x84, 0x88},
  331. .outdat_endpoints = {0x02, 0x06},
  332. .inack_endpoints = {-1, -1},
  333. .outcont_endpoints = {-1, -1},
  334. .instat_endpoint = 0x81,
  335. .indat_endpoint = -1,
  336. .glocont_endpoint = 0x01,
  337. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  338. .baudclk = KEYSPAN_USA28X_BAUDCLK,
  339. };
  340. /* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
  341. static const struct keyspan_device_details usa49w_device_details = {
  342. .product_id = keyspan_usa49w_product_id,
  343. .msg_format = msg_usa49,
  344. .num_ports = 4,
  345. .indat_endp_flip = 0,
  346. .outdat_endp_flip = 0,
  347. .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
  348. .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
  349. .inack_endpoints = {-1, -1, -1, -1},
  350. .outcont_endpoints = {-1, -1, -1, -1},
  351. .instat_endpoint = 0x87,
  352. .indat_endpoint = -1,
  353. .glocont_endpoint = 0x07,
  354. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  355. .baudclk = KEYSPAN_USA49W_BAUDCLK,
  356. };
  357. static const struct keyspan_device_details usa49wlc_device_details = {
  358. .product_id = keyspan_usa49wlc_product_id,
  359. .msg_format = msg_usa49,
  360. .num_ports = 4,
  361. .indat_endp_flip = 0,
  362. .outdat_endp_flip = 0,
  363. .indat_endpoints = {0x81, 0x82, 0x83, 0x84},
  364. .outdat_endpoints = {0x01, 0x02, 0x03, 0x04},
  365. .inack_endpoints = {-1, -1, -1, -1},
  366. .outcont_endpoints = {-1, -1, -1, -1},
  367. .instat_endpoint = 0x87,
  368. .indat_endpoint = -1,
  369. .glocont_endpoint = 0x07,
  370. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  371. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  372. };
  373. static const struct keyspan_device_details usa49wg_device_details = {
  374. .product_id = keyspan_usa49wg_product_id,
  375. .msg_format = msg_usa49,
  376. .num_ports = 4,
  377. .indat_endp_flip = 0,
  378. .outdat_endp_flip = 0,
  379. .indat_endpoints = {-1, -1, -1, -1}, /* single 'global' data in EP */
  380. .outdat_endpoints = {0x01, 0x02, 0x04, 0x06},
  381. .inack_endpoints = {-1, -1, -1, -1},
  382. .outcont_endpoints = {-1, -1, -1, -1},
  383. .instat_endpoint = 0x81,
  384. .indat_endpoint = 0x88,
  385. .glocont_endpoint = 0x00, /* uses control EP */
  386. .calculate_baud_rate = keyspan_usa19w_calc_baud,
  387. .baudclk = KEYSPAN_USA19W_BAUDCLK,
  388. };
  389. static const struct keyspan_device_details *keyspan_devices[] = {
  390. &usa18x_device_details,
  391. &usa19_device_details,
  392. &usa19qi_device_details,
  393. &mpr_device_details,
  394. &usa19qw_device_details,
  395. &usa19w_device_details,
  396. &usa19hs_device_details,
  397. &usa28_device_details,
  398. &usa28x_device_details,
  399. &usa28xa_device_details,
  400. &usa28xg_device_details,
  401. /* 28xb not required as it renumerates as a 28x */
  402. &usa49w_device_details,
  403. &usa49wlc_device_details,
  404. &usa49wg_device_details,
  405. NULL,
  406. };
  407. static const struct usb_device_id keyspan_ids_combined[] = {
  408. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
  409. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
  410. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
  411. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
  412. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
  413. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
  414. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
  415. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
  416. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
  417. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
  418. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
  419. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
  420. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
  421. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
  422. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
  423. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
  424. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
  425. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
  426. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
  427. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
  428. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
  429. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
  430. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
  431. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
  432. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
  433. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
  434. { } /* Terminating entry */
  435. };
  436. MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
  437. /* usb_device_id table for the pre-firmware download keyspan devices */
  438. static const struct usb_device_id keyspan_pre_ids[] = {
  439. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
  440. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
  441. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
  442. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
  443. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
  444. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
  445. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
  446. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
  447. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
  448. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
  449. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
  450. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_pre_product_id) },
  451. { } /* Terminating entry */
  452. };
  453. static const struct usb_device_id keyspan_1port_ids[] = {
  454. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
  455. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
  456. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
  457. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
  458. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
  459. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
  460. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
  461. { } /* Terminating entry */
  462. };
  463. static const struct usb_device_id keyspan_2port_ids[] = {
  464. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
  465. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
  466. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
  467. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xg_product_id) },
  468. { } /* Terminating entry */
  469. };
  470. static const struct usb_device_id keyspan_4port_ids[] = {
  471. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
  472. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
  473. { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wg_product_id)},
  474. { } /* Terminating entry */
  475. };
  476. /* Structs for the devices, pre and post renumeration. */
  477. static struct usb_serial_driver keyspan_pre_device = {
  478. .driver = {
  479. .owner = THIS_MODULE,
  480. .name = "keyspan_no_firm",
  481. },
  482. .description = "Keyspan - (without firmware)",
  483. .id_table = keyspan_pre_ids,
  484. .num_ports = 1,
  485. .attach = keyspan_fake_startup,
  486. };
  487. static struct usb_serial_driver keyspan_1port_device = {
  488. .driver = {
  489. .owner = THIS_MODULE,
  490. .name = "keyspan_1",
  491. },
  492. .description = "Keyspan 1 port adapter",
  493. .id_table = keyspan_1port_ids,
  494. .num_ports = 1,
  495. .open = keyspan_open,
  496. .close = keyspan_close,
  497. .dtr_rts = keyspan_dtr_rts,
  498. .write = keyspan_write,
  499. .write_room = keyspan_write_room,
  500. .set_termios = keyspan_set_termios,
  501. .break_ctl = keyspan_break_ctl,
  502. .tiocmget = keyspan_tiocmget,
  503. .tiocmset = keyspan_tiocmset,
  504. .attach = keyspan_startup,
  505. .disconnect = keyspan_disconnect,
  506. .release = keyspan_release,
  507. .port_probe = keyspan_port_probe,
  508. .port_remove = keyspan_port_remove,
  509. };
  510. static struct usb_serial_driver keyspan_2port_device = {
  511. .driver = {
  512. .owner = THIS_MODULE,
  513. .name = "keyspan_2",
  514. },
  515. .description = "Keyspan 2 port adapter",
  516. .id_table = keyspan_2port_ids,
  517. .num_ports = 2,
  518. .open = keyspan_open,
  519. .close = keyspan_close,
  520. .dtr_rts = keyspan_dtr_rts,
  521. .write = keyspan_write,
  522. .write_room = keyspan_write_room,
  523. .set_termios = keyspan_set_termios,
  524. .break_ctl = keyspan_break_ctl,
  525. .tiocmget = keyspan_tiocmget,
  526. .tiocmset = keyspan_tiocmset,
  527. .attach = keyspan_startup,
  528. .disconnect = keyspan_disconnect,
  529. .release = keyspan_release,
  530. .port_probe = keyspan_port_probe,
  531. .port_remove = keyspan_port_remove,
  532. };
  533. static struct usb_serial_driver keyspan_4port_device = {
  534. .driver = {
  535. .owner = THIS_MODULE,
  536. .name = "keyspan_4",
  537. },
  538. .description = "Keyspan 4 port adapter",
  539. .id_table = keyspan_4port_ids,
  540. .num_ports = 4,
  541. .open = keyspan_open,
  542. .close = keyspan_close,
  543. .dtr_rts = keyspan_dtr_rts,
  544. .write = keyspan_write,
  545. .write_room = keyspan_write_room,
  546. .set_termios = keyspan_set_termios,
  547. .break_ctl = keyspan_break_ctl,
  548. .tiocmget = keyspan_tiocmget,
  549. .tiocmset = keyspan_tiocmset,
  550. .attach = keyspan_startup,
  551. .disconnect = keyspan_disconnect,
  552. .release = keyspan_release,
  553. .port_probe = keyspan_port_probe,
  554. .port_remove = keyspan_port_remove,
  555. };
  556. static struct usb_serial_driver * const serial_drivers[] = {
  557. &keyspan_pre_device, &keyspan_1port_device,
  558. &keyspan_2port_device, &keyspan_4port_device, NULL
  559. };
  560. #endif