+++ /dev/null
-/*
- * This file is automatically generated by ./gentbl, DO NOT EDIT!
-*/
-
-#define SINTABBITS 9
-#define SINTABSIZE (1<<SINTABBITS)
-
-static short isintab[SINTABSIZE+SINTABSIZE/4] = {
- 0, 402, 804, 1206, 1607, 2009, 2410, 2811,
- 3211, 3611, 4011, 4409, 4807, 5205, 5601, 5997,
- 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126,
- 9511, 9895, 10278, 10659, 11038, 11416, 11792, 12166,
- 12539, 12909, 13278, 13645, 14009, 14372, 14732, 15090,
- 15446, 15799, 16150, 16499, 16845, 17189, 17530, 17868,
- 18204, 18537, 18867, 19194, 19519, 19840, 20159, 20474,
- 20787, 21096, 21402, 21705, 22004, 22301, 22594, 22883,
- 23169, 23452, 23731, 24006, 24278, 24546, 24811, 25072,
- 25329, 25582, 25831, 26077, 26318, 26556, 26789, 27019,
- 27244, 27466, 27683, 27896, 28105, 28309, 28510, 28706,
- 28897, 29085, 29268, 29446, 29621, 29790, 29955, 30116,
- 30272, 30424, 30571, 30713, 30851, 30984, 31113, 31236,
- 31356, 31470, 31580, 31684, 31785, 31880, 31970, 32056,
- 32137, 32213, 32284, 32350, 32412, 32468, 32520, 32567,
- 32609, 32646, 32678, 32705, 32727, 32744, 32757, 32764,
- 32767, 32764, 32757, 32744, 32727, 32705, 32678, 32646,
- 32609, 32567, 32520, 32468, 32412, 32350, 32284, 32213,
- 32137, 32056, 31970, 31880, 31785, 31684, 31580, 31470,
- 31356, 31236, 31113, 30984, 30851, 30713, 30571, 30424,
- 30272, 30116, 29955, 29790, 29621, 29446, 29268, 29085,
- 28897, 28706, 28510, 28309, 28105, 27896, 27683, 27466,
- 27244, 27019, 26789, 26556, 26318, 26077, 25831, 25582,
- 25329, 25072, 24811, 24546, 24278, 24006, 23731, 23452,
- 23169, 22883, 22594, 22301, 22004, 21705, 21402, 21096,
- 20787, 20474, 20159, 19840, 19519, 19194, 18867, 18537,
- 18204, 17868, 17530, 17189, 16845, 16499, 16150, 15799,
- 15446, 15090, 14732, 14372, 14009, 13645, 13278, 12909,
- 12539, 12166, 11792, 11416, 11038, 10659, 10278, 9895,
- 9511, 9126, 8739, 8351, 7961, 7571, 7179, 6786,
- 6392, 5997, 5601, 5205, 4807, 4409, 4011, 3611,
- 3211, 2811, 2410, 2009, 1607, 1206, 804, 402,
- 0, -402, -804, -1206, -1607, -2009, -2410, -2811,
- -3211, -3611, -4011, -4409, -4807, -5205, -5601, -5997,
- -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126,
- -9511, -9895,-10278,-10659,-11038,-11416,-11792,-12166,
- -12539,-12909,-13278,-13645,-14009,-14372,-14732,-15090,
- -15446,-15799,-16150,-16499,-16845,-17189,-17530,-17868,
- -18204,-18537,-18867,-19194,-19519,-19840,-20159,-20474,
- -20787,-21096,-21402,-21705,-22004,-22301,-22594,-22883,
- -23169,-23452,-23731,-24006,-24278,-24546,-24811,-25072,
- -25329,-25582,-25831,-26077,-26318,-26556,-26789,-27019,
- -27244,-27466,-27683,-27896,-28105,-28309,-28510,-28706,
- -28897,-29085,-29268,-29446,-29621,-29790,-29955,-30116,
- -30272,-30424,-30571,-30713,-30851,-30984,-31113,-31236,
- -31356,-31470,-31580,-31684,-31785,-31880,-31970,-32056,
- -32137,-32213,-32284,-32350,-32412,-32468,-32520,-32567,
- -32609,-32646,-32678,-32705,-32727,-32744,-32757,-32764,
- -32767,-32764,-32757,-32744,-32727,-32705,-32678,-32646,
- -32609,-32567,-32520,-32468,-32412,-32350,-32284,-32213,
- -32137,-32056,-31970,-31880,-31785,-31684,-31580,-31470,
- -31356,-31236,-31113,-30984,-30851,-30713,-30571,-30424,
- -30272,-30116,-29955,-29790,-29621,-29446,-29268,-29085,
- -28897,-28706,-28510,-28309,-28105,-27896,-27683,-27466,
- -27244,-27019,-26789,-26556,-26318,-26077,-25831,-25582,
- -25329,-25072,-24811,-24546,-24278,-24006,-23731,-23452,
- -23169,-22883,-22594,-22301,-22004,-21705,-21402,-21096,
- -20787,-20474,-20159,-19840,-19519,-19194,-18867,-18537,
- -18204,-17868,-17530,-17189,-16845,-16499,-16150,-15799,
- -15446,-15090,-14732,-14372,-14009,-13645,-13278,-12909,
- -12539,-12166,-11792,-11416,-11038,-10659,-10278, -9895,
- -9511, -9126, -8739, -8351, -7961, -7571, -7179, -6786,
- -6392, -5997, -5601, -5205, -4807, -4409, -4011, -3611,
- -3211, -2811, -2410, -2009, -1607, -1206, -804, -402,
- 0, 402, 804, 1206, 1607, 2009, 2410, 2811,
- 3211, 3611, 4011, 4409, 4807, 5205, 5601, 5997,
- 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126,
- 9511, 9895, 10278, 10659, 11038, 11416, 11792, 12166,
- 12539, 12909, 13278, 13645, 14009, 14372, 14732, 15090,
- 15446, 15799, 16150, 16499, 16845, 17189, 17530, 17868,
- 18204, 18537, 18867, 19194, 19519, 19840, 20159, 20474,
- 20787, 21096, 21402, 21705, 22004, 22301, 22594, 22883,
- 23169, 23452, 23731, 24006, 24278, 24546, 24811, 25072,
- 25329, 25582, 25831, 26077, 26318, 26556, 26789, 27019,
- 27244, 27466, 27683, 27896, 28105, 28309, 28510, 28706,
- 28897, 29085, 29268, 29446, 29621, 29790, 29955, 30116,
- 30272, 30424, 30571, 30713, 30851, 30984, 31113, 31236,
- 31356, 31470, 31580, 31684, 31785, 31880, 31970, 32056,
- 32137, 32213, 32284, 32350, 32412, 32468, 32520, 32567,
- 32609, 32646, 32678, 32705, 32727, 32744, 32757, 32764
-};
-
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
+ * (11/11/2001) gkh
+ * Added support for the m125 devices, and added check to prevent oopses
+ * for Clié devices that lie about the number of ports they have.
+ *
* (08/30/2001) gkh
* Added support for the Clie devices, both the 3.5 and 4.0 os versions.
* Many thanks to Daniel Burke, and Bryan Payne for helping with this.
/*
* Version Information
*/
-#define DRIVER_VERSION "v1.4"
+#define DRIVER_VERSION "v1.5"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
-#define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clie driver"
+#define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clié driver"
#define MIN(a,b) (((a)<(b))?(a):(b))
/* All of the device info needed for the Handspring Visor */
static __u16 handspring_vendor_id = HANDSPRING_VENDOR_ID;
static __u16 handspring_product_id = HANDSPRING_VISOR_ID;
-struct usb_serial_device_type handspring_device = {
+static struct usb_serial_device_type handspring_device = {
name: "Handspring Visor",
idVendor: &handspring_vendor_id,
idProduct: &handspring_product_id,
static __u16 palm_vendor_id = PALM_VENDOR_ID;
static __u16 palm_m500_id = PALM_M500_ID;
static __u16 palm_m505_id = PALM_M505_ID;
-struct usb_serial_device_type palm_m500_device = {
+static __u16 palm_m125_id = PALM_M125_ID;
+static struct usb_serial_device_type palm_m500_device = {
name: "Palm M500",
idVendor: &palm_vendor_id,
idProduct: &palm_m500_id,
};
/* device info for the Palm M505 */
-struct usb_serial_device_type palm_m505_device = {
+static struct usb_serial_device_type palm_m505_device = {
name: "Palm M505",
idVendor: &palm_vendor_id,
idProduct: &palm_m505_id,
read_bulk_callback: visor_read_bulk_callback,
};
+/* device info for the Palm M125 */
+static struct usb_serial_device_type palm_m125_device = {
+ name: "Palm M125",
+ idVendor: &palm_vendor_id,
+ idProduct: &palm_m125_id,
+ needs_interrupt_in: MUST_HAVE_NOT, /* this device must not have an interrupt in endpoint */
+ needs_bulk_in: MUST_HAVE, /* this device must have a bulk in endpoint */
+ needs_bulk_out: MUST_HAVE, /* this device must have a bulk out endpoint */
+ num_interrupt_in: 0,
+ num_bulk_in: 2,
+ num_bulk_out: 2,
+ num_ports: 2,
+ open: visor_open,
+ close: visor_close,
+ throttle: visor_throttle,
+ unthrottle: visor_unthrottle,
+ startup: visor_startup,
+ shutdown: visor_shutdown,
+ ioctl: visor_ioctl,
+ set_termios: visor_set_termios,
+ write: visor_write,
+ write_room: visor_write_room,
+ chars_in_buffer: visor_chars_in_buffer,
+ write_bulk_callback: visor_write_bulk_callback,
+ read_bulk_callback: visor_read_bulk_callback,
+};
+
/* device info for the Sony Clie OS version 3.5 */
static __u16 sony_vendor_id = SONY_VENDOR_ID;
static __u16 sony_3_5_id = SONY_CLIE_3_5_ID;
dbg(__FUNCTION__ " - port %d", port->number);
+ if (!port->read_urb) {
+ err ("Device lied about number of ports, please use a lower one.");
+ return -ENODEV;
+ }
+
down (&port->sem);
++port->open_count;
/* stop reads and writes on all ports */
for (i=0; i < serial->num_ports; ++i) {
- while (serial->port[i].open_count > 0) {
- visor_close (&serial->port[i], NULL);
- }
+ serial->port[i].active = 0;
+ serial->port[i].open_count = 0;
}
}
usb_serial_register (&handspring_device);
usb_serial_register (&palm_m500_device);
usb_serial_register (&palm_m505_device);
+ usb_serial_register (&palm_m125_device);
usb_serial_register (&clie_3_5_device);
usb_serial_register (&clie_4_0_device);
usb_serial_deregister (&handspring_device);
usb_serial_deregister (&palm_m500_device);
usb_serial_deregister (&palm_m505_device);
+ usb_serial_deregister (&palm_m125_device);
usb_serial_deregister (&clie_3_5_device);
usb_serial_deregister (&clie_4_0_device);
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
+ * (05/30/2001) gkh
+ * switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
* (04/08/2001) gb
* Identify version on module load.
*
/*
* Version Information
*/
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_DESC "USB ConnectTech WhiteHEAT driver"
static __u16 connecttech_vendor_id = CONNECT_TECH_VENDOR_ID;
static __u16 connecttech_whiteheat_fake_product_id = CONNECT_TECH_FAKE_WHITE_HEAT_ID;
static __u16 connecttech_whiteheat_product_id = CONNECT_TECH_WHITE_HEAT_ID;
-struct usb_serial_device_type whiteheat_fake_device = {
+static struct usb_serial_device_type whiteheat_fake_device = {
name: "Connect Tech - WhiteHEAT - (prerenumeration)",
idVendor: &connecttech_vendor_id, /* the Connect Tech vendor id */
idProduct: &connecttech_whiteheat_fake_product_id, /* the White Heat initial product id */
num_ports: 1,
startup: whiteheat_startup
};
-struct usb_serial_device_type whiteheat_device = {
+static struct usb_serial_device_type whiteheat_device = {
name: "Connect Tech - WhiteHEAT",
idVendor: &connecttech_vendor_id, /* the Connect Tech vendor id */
idProduct: &connecttech_whiteheat_product_id, /* the White Heat real product id */
struct usb_serial_port *port;
int timeout;
__u8 *transfer_buffer;
+ int retval = 0;
dbg(__FUNCTION__" - command %d", command);
memcpy (&transfer_buffer[1], data, datasize);
port->write_urb->transfer_buffer_length = datasize + 1;
port->write_urb->dev = serial->dev;
- if (usb_submit_urb (port->write_urb)) {
+ retval = usb_submit_urb (port->write_urb);
+ if (retval) {
dbg (__FUNCTION__" - submit urb failed");
- return -1;
+ goto exit;
}
/* wait for the command to complete */
if (info->command_finished == FALSE) {
dbg (__FUNCTION__ " - command timed out.");
- return -1;
+ retval = -ETIMEDOUT;
+ goto exit;
}
if (info->command_finished == WHITEHEAT_CMD_FAILURE) {
dbg (__FUNCTION__ " - command failed.");
- return -1;
+ retval = -EIO;
+ goto exit;
}
- if (info->command_finished == WHITEHEAT_CMD_COMPLETE) {
+ if (info->command_finished == WHITEHEAT_CMD_COMPLETE)
dbg (__FUNCTION__ " - command completed.");
- return 0;
- }
- return 0;
+exit:
+ return retval;
}
struct whiteheat_min_set open_command;
struct usb_serial_port *command_port;
struct whiteheat_private *info;
- int result;
+ int retval = 0;
dbg(__FUNCTION__" - port %d", port->number);
+ down (&port->sem);
+
++port->open_count;
MOD_INC_USE_COUNT;
info = (struct whiteheat_private *)kmalloc (sizeof(struct whiteheat_private), GFP_KERNEL);
if (info == NULL) {
err(__FUNCTION__ " - out of memory");
- return -ENOMEM;
+ retval = -ENOMEM;
+ goto error_exit;
}
init_waitqueue_head(&info->wait_command);
command_port->read_urb->complete = command_port_read_callback;
command_port->read_urb->dev = port->serial->dev;
command_port->tty = port->tty; /* need this to "fake" our our sanity check macros */
- usb_submit_urb (command_port->read_urb);
+ retval = usb_submit_urb (command_port->read_urb);
+ if (retval) {
+ err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
+ goto error_exit;
+ }
}
/* Start reading from the device */
port->read_urb->dev = port->serial->dev;
- result = usb_submit_urb(port->read_urb);
- if (result)
- err(__FUNCTION__ " - failed submitting read urb, error %d", result);
+ retval = usb_submit_urb(port->read_urb);
+ if (retval) {
+ err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
+ goto error_exit;
+ }
/* send an open port command */
/* firmware uses 1 based port numbering */
open_command.port = port->number - port->serial->minor + 1;
- whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+ retval = whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+ if (retval)
+ goto error_exit;
/* Need to do device specific setup here (control lines, baud rate, etc.) */
/* FIXME!!! */
}
dbg(__FUNCTION__ " - exit");
+ up (&port->sem);
- return 0;
+ return retval;
+
+error_exit:
+ --port->open_count;
+ MOD_DEC_USE_COUNT;
+
+ dbg(__FUNCTION__ " - error_exit");
+ up (&port->sem);
+
+ return retval;
}
dbg(__FUNCTION__ " - port %d", port->number);
+ down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
port->active = 0;
}
MOD_DEC_USE_COUNT;
+ up (&port->sem);
}
static void whiteheat_set_termios (struct usb_serial_port *port, struct termios *old_termios)
{
- unsigned int cflag = port->tty->termios->c_cflag;
+ unsigned int cflag;
struct whiteheat_port_settings port_settings;
dbg(__FUNCTION__ " -port %d", port->number);
+ down (&port->sem);
+
+ if ((!port->tty) || (!port->tty->termios)) {
+ dbg(__FUNCTION__" - no tty structures");
+ goto exit;
+ }
+
+ cflag = port->tty->termios->c_cflag;
/* check that they really want us to change something */
if (old_termios) {
if ((cflag == old_termios->c_cflag) &&
(RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) {
dbg(__FUNCTION__ " - nothing to change...");
- return;
+ goto exit;
}
}
- if ((!port->tty) || (!port->tty->termios)) {
- dbg(__FUNCTION__" - no tty structures");
- return;
- }
-
/* set the port number */
/* firmware uses 1 based port numbering */
port_settings.port = port->number + 1;
/* now send the message to the device */
whiteheat_send_cmd (port->serial, WHITEHEAT_SETUP_PORT, (__u8 *)&port_settings, sizeof(port_settings));
+exit:
+ up (&port->sem);
return;
}