* thanks to Karl Hiramoto karl@hiramoto.org. RTSCTS hardware flow
* control thanks to Munir Nassar nassarmu@real-time.com
*
- * Silicon Labs RJM: updated to 0.11 for 2.6.15 and later kernels
- *
- * vxxPKGVERxx by R. Steve McKown, Titanium Mirror, Inc., rsmckown@gmail.com.
- * Added port configuration, usb descriptor and gpio management.
- *
- * Outstanding Issues:
- * Buffers are not flushed when the port is opened.
- * Multiple calls to write() may fail with "Resource temporarily unavailable"
- *
*/
#include <linux/kernel.h>
static int debug;
-static struct usb_device_id id_table [] = {
+static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */
{ USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
{ USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */
{ USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
{ USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
{ USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
+ { USB_DEVICE(0x10C4, 0x81E8) }, /* Zephyr Bioharness */
{ USB_DEVICE(0x10C4, 0x81F2) }, /* C1007 HF band RFID controller */
{ USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
{ USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */
{ USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demostration module */
- { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
+ { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesys ETRX2USB */
{ USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
{ USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
{ USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
{ USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
+ { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
{ } /* Terminating Entry */
};
cp210x_buffer_t t;
if (!kbuf || !ubuf || !klen ||
- copy_from_user(&t, (cp210x_buffer_t *)ubuf, sizeof(t)))
+ copy_from_user(&t, (cp210x_buffer_t __user *)ubuf,
+ sizeof(t)))
return 0;
if (t.len < klen)
klen = t.len;
- if (!t.buf || !t.len || copy_from_user(kbuf, t.buf, klen))
+ if (!t.buf || !t.len ||
+ copy_from_user(kbuf, (char __user *)t.buf, klen))
return 0;
return klen;
}
* connections are torn down. We also ignore the error return, since
* the part resets and doesn't send one...
*/
- cp210x_ctlmsg(port, 0xff, 0x40, 0x0008, 0x00, 0, 0);
+ cp210x_ctlmsg(port, 0xff, 0x40, 0x0008, 0x00, NULL, 0);
#else
usb_reset_device(port->serial->dev);
#endif
unsigned int value)
{
return cp210x_ctlmsg(port, 0xff, 0x40, 0x3700 | (cmd & 0xff),
- value, 0, 0);
+ value, NULL, 0);
}
/* Populates usbstr with: (len) + (0x03) + unicode(str). Each char in str
dbg("%s - port %d, gpio = 0x%.2x", __FUNCTION__, port->number, gpio);
return cp210x_ctlmsg(port, 0xff, 0x40, 0x37e1,
- ((uint16_t)gpio << 8) | GPIO_MASK, 0, 0);
+ ((uint16_t)gpio << 8) | GPIO_MASK, NULL, 0);
}
/* Set select gpio bits */
dbg("%s - port %d, gpiob = 0x%.4x", __FUNCTION__, port->number, gpio);
/* FIXME: how about REQTYPE_HOST_TO_DEVICE instead of 0x40? */
- return cp210x_ctlmsg(port, 0xff, 0x40, 0x37e1, gpio, 0, 0);
+ return cp210x_ctlmsg(port, 0xff, 0x40, 0x37e1, gpio, NULL, 0);
}
static int cp210x_gpioget(struct usb_serial_port *port, u8 *gpio)
return -EPROTO;
}
- /* Single data value */
- result = usb_control_msg(serial->dev,
- usb_sndctrlpipe(serial->dev, 0),
- request, REQTYPE_HOST_TO_DEVICE, data[0],
- 0, NULL, 0, 300);
return 0;
}
dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
switch (cmd) {
-
+
case TIOCMGET:
{
int result = cp210x_tiocmget(port, file);
- if (copy_to_user(&arg, &result, sizeof(int)))
- return -EFAULT;
+ if (copy_to_user((int __user *)&arg, &result, sizeof(int)))
+ return -EFAULT;
return 0;
}
break;
case TIOCMSET:
case TIOCMBIS:
-
case TIOCMBIC:
{
int val = 0;
- if (copy_from_user(&val, &arg, sizeof(int)))
+ if (copy_from_user(&val, (int __user *)&arg, sizeof(int)))
return -EFAULT;
/* this looks wrong: TIOCMSET isn't going to work right */
case IOCTL_GPIOGET:
if (cp210x_get_partnum(port) == CP210x_CP2103_VERSION) {
u8 gpio = 0;
- if (!cp210x_gpioget(port, &gpio) && !copy_to_user((u8*)arg,
- &gpio, sizeof(gpio)))
+ if (!cp210x_gpioget(port, &gpio) && !copy_to_user(
+ (u8 __user *)arg, &gpio, sizeof(gpio)))
return 0;
}
return -EFAULT;
{
cp210x_port_config_t config;
if (!cp210x_portconfget(port, &config) && !copy_to_user(
- (cp210x_port_config_t*)arg, &config,
- sizeof(config)))
+ (cp210x_port_config_t __user *)arg,
+ &config, sizeof(config)))
return 0;
}
return -EFAULT;
case IOCTL_PORTCONFSET:
{
cp210x_port_config_t config;
- if (!copy_from_user(&config, (cp210x_port_config_t*)arg,
+ if (!copy_from_user(&config, (cp210x_port_config_t __user *)arg,
sizeof(config)) &&
!cp210x_portconfset(port, &config))
return 0;
case IOCTL_SETVID:
{
unsigned int vid;
- if (!copy_from_user(&vid, (unsigned int *)arg,
+ if (!copy_from_user(&vid, (unsigned int __user *)arg,
sizeof(unsigned int)) &&
!cp210x_setu16(port, 0x01, vid))
return 0;
case IOCTL_SETPID:
{
unsigned int pid;
- if (!copy_from_user(&pid, (unsigned int *)arg,
+ if (!copy_from_user(&pid, (unsigned int __user *)arg,
sizeof(unsigned int)) &&
!cp210x_setu16(port, 0x02, pid))
return 0;
case IOCTL_SETDEVVER:
{
unsigned int ver;
- if (!copy_from_user(&ver, (unsigned int *)arg,
+ if (!copy_from_user(&ver, (unsigned int __user *)arg,
sizeof(unsigned int)) &&
!cp210x_setu16(port, 0x07, ver))
return 0;