pl2303有ubuntu下的驱动吗?

内核编译和嵌入式产品的设计与开发
回复
hyz_ub
帖子: 38
注册时间: 2008-07-31 10:53
来自: 福建泉州

pl2303有ubuntu下的驱动吗?

#1

帖子 hyz_ub » 2008-08-19 14:03

我找到的都是RedHat下的。 RedHat9下的驱动要怎么改才能用? 我把原文件上传上来(有源码)。

下面是 “pl2303.c “ 的内容。

代码: 全选

/*
 * Prolific PL2303 USB to serial adaptor driver
 *
 * Copyright (C) 2001-2002 Greg Kroah-Hartman (greg@kroah.com)
 *
 * Original driver for 2.2.x by anonymous
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 * See Documentation/usb/usb-serial.txt for more information on using this driver
 *
 * 2001_Oct_06 gkh
 *	Added RTS and DTR line control.  Thanks to joe@bndlg.de for parts of it.
 *
 * 2001_Sep_19 gkh
 *	Added break support.
 *
 * 2001_Aug_30 gkh
 *	fixed oops in write_bulk_callback.
 *
 * 2001_Aug_28 gkh
 *	reworked buffer logic to be like other usb-serial drivers.  Hopefully
 *	removing some reported problems.
 *
 * 2001_Jun_06 gkh
 *	finished porting to 2.4 format.
 *
 */

#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>

#ifdef CONFIG_USB_SERIAL_DEBUG
	static int debug = 1;
#else
	static int debug;
#endif

#include "usb-serial.h"
#include "pl2303.h"

/*
 * Version Information
 */
#define DRIVER_VERSION "v0.91"
#define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"



static struct usb_device_id id_table [] = {
	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) },
	{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
	{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
	{ USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
	{ USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) },
	{ USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
	{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
	{ }					/* Terminating entry */
};

MODULE_DEVICE_TABLE (usb, id_table);


#define SET_LINE_REQUEST_TYPE		0x21
#define SET_LINE_REQUEST		0x20

#define SET_CONTROL_REQUEST_TYPE	0x21
#define SET_CONTROL_REQUEST		0x22
#define CONTROL_DTR			0x01
#define CONTROL_RTS			0x02

#define BREAK_REQUEST_TYPE		0x21
#define BREAK_REQUEST			0x23	
#define BREAK_ON			0xffff
#define BREAK_OFF			0x0000

#define GET_LINE_REQUEST_TYPE		0xa1
#define GET_LINE_REQUEST		0x21

#define VENDOR_WRITE_REQUEST_TYPE	0x40
#define VENDOR_WRITE_REQUEST		0x01

#define VENDOR_READ_REQUEST_TYPE	0xc0
#define VENDOR_READ_REQUEST		0x01

/* function prototypes for a PL2303 serial converter */
static int pl2303_open (struct usb_serial_port *port, struct file *filp);
static void pl2303_close (struct usb_serial_port *port, struct file *filp);
static void pl2303_set_termios (struct usb_serial_port *port,
				struct termios *old);
static int pl2303_ioctl (struct usb_serial_port *port, struct file *file,
			 unsigned int cmd, unsigned long arg);
static void pl2303_read_int_callback (struct urb *urb);
static void pl2303_read_bulk_callback (struct urb *urb);
static void pl2303_write_bulk_callback (struct urb *urb);
static int pl2303_write (struct usb_serial_port *port, int from_user,
			 const unsigned char *buf, int count);
static void pl2303_break_ctl(struct usb_serial_port *port,int break_state);
static int pl2303_startup (struct usb_serial *serial);
static void pl2303_shutdown (struct usb_serial *serial);


/* All of the device info needed for the PL2303 SIO serial converter */
static struct usb_serial_device_type pl2303_device = {
	.owner =		THIS_MODULE,
	.name =			"PL-2303",
	.id_table =		id_table,
	.num_interrupt_in =	NUM_DONT_CARE,
	.num_bulk_in =		1,
	.num_bulk_out =		1,
	.num_ports =		1,
	.open =			pl2303_open,
	.close =		pl2303_close,
	.write =		pl2303_write,
	.ioctl =		pl2303_ioctl,
	.break_ctl =		pl2303_break_ctl,
	.set_termios =		pl2303_set_termios,
	.read_bulk_callback =	pl2303_read_bulk_callback,
	.read_int_callback =	pl2303_read_int_callback,
	.write_bulk_callback =	pl2303_write_bulk_callback,
	.startup =		pl2303_startup,
	.shutdown =		pl2303_shutdown,
};

struct pl2303_private {
	u8 line_control;
	u8 termios_initialized;
	u8 driverType;
};


static int pl2303_startup (struct usb_serial *serial)
{
	struct pl2303_private *priv;
	int i;

	for (i = 0; i < serial->num_ports; ++i) {
		priv = kmalloc (sizeof (struct pl2303_private), GFP_KERNEL);
		if (!priv)
			return -ENOMEM;
		memset (priv, 0x00, sizeof (struct pl2303_private));
		serial->port[i].private = priv;
	}
	return 0;
}

static int set_control_lines (struct usb_device *dev, u8 value)
{
	int retval;
	
	retval = usb_control_msg (dev, usb_sndctrlpipe (dev, 0),
				  SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE,
				  value, 0, NULL, 0, 100);
	dbg("%s - value = %d, retval = %d", __FUNCTION__, value, retval);
	return retval;
}

static int pl2303_write (struct usb_serial_port *port, int from_user,  const unsigned char *buf, int count)
{
	int result;

	dbg("%s - port %d, %d bytes", __FUNCTION__, port->number, count);

	if (port->write_urb->status == -EINPROGRESS) {
		dbg("%s - already writing", __FUNCTION__);
		return 0;
	}

	count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
	if (from_user) {
		if (copy_from_user (port->write_urb->transfer_buffer, buf, count))
			return -EFAULT;
	} else {
		memcpy (port->write_urb->transfer_buffer, buf, count);
	}
	
	usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);

	port->write_urb->transfer_buffer_length = count;
	port->write_urb->dev = port->serial->dev;
	result = usb_submit_urb (port->write_urb);
	if (result)
		err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
	else
		result = count;

	return result;
}



static void pl2303_set_termios (struct usb_serial_port *port, struct termios *old_termios)
{
	struct usb_serial *serial = port->serial;
	struct pl2303_private *priv = port->private;
	unsigned int cflag;
	unsigned char *buf;
	int baud;
	int i;

	dbg("%s -  port %d, initialized = %d", __FUNCTION__, port->number,
	     ((struct pl2303_private *) port->private)->termios_initialized);

	if ((!port->tty) || (!port->tty->termios)) {
		dbg("%s - no tty structures", __FUNCTION__);
		return;
	}

	if (!(((struct pl2303_private *) port->private)->termios_initialized)) {
		*(port->tty->termios) = tty_std_termios;
		port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
		((struct pl2303_private *) port->private)->termios_initialized = 1;
	}
	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("%s - nothing to change...", __FUNCTION__);
		    return;
		}
	}

	buf = kmalloc (7, GFP_KERNEL);
	if (!buf) {
		err("%s - out of memory.", __FUNCTION__);
		return;
	}
	memset (buf, 0x00, 0x07);
	
	i = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0),
			     GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
			     0, 0, buf, 7, 100);
	dbg ("0xa1:0x21:0:0  %d - %x %x %x %x %x %x %x", i,
	     buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);


	i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
			     VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
			     0, 1, NULL, 0, 100);

	dbg ("0x40:1:0:1  %d", i);

	if (cflag & CSIZE) {
		switch (cflag & CSIZE) {
			case CS5:	buf[6] = 5;	break;
			case CS6:	buf[6] = 6;	break;
			case CS7:	buf[6] = 7;	break;
			default:
			case CS8:	buf[6] = 8;	break;
		}
		dbg("%s - data bits = %d", __FUNCTION__, buf[6]);
	}

	baud = 0;
	switch (cflag & CBAUD) {
		case B0:	baud = 0;	break;
		case B75:	baud = 75;	break;
		case B150:	baud = 150;	break;
		case B300:	baud = 1228800;	break;
		case B600:	baud = 600;	break;
		case B1200:	baud = 1200;	break;
		case B1800:	baud = 1800;	break;
		case B2400:	baud = 2400;	break;
		case B4800:	baud = 4800;	break;
		case B9600:	baud = 9600;	break;
		case B19200:	baud = 19200;	break;
		case B38400:	baud = 38400;	break;
		case B57600:	baud = 57600;	break;
		case B115200:	baud = 115200;	break;
		case B230400:	baud = 230400;	break;
		case B460800:	baud = 460800;	break;
		default:
			err ("pl2303 driver does not support the baudrate requested (fix it)");
			break;
	}
	dbg("%s - baud = %d", __FUNCTION__, baud);
	if (baud) {
		buf[0] = baud & 0xff;
		buf[1] = (baud >> 8) & 0xff;
		buf[2] = (baud >> 16) & 0xff;
		buf[3] = (baud >> 24) & 0xff;
	}

	/* For reference buf[4]=0 is 1 stop bits */
	/* For reference buf[4]=1 is 1.5 stop bits */
	/* For reference buf[4]=2 is 2 stop bits */
	if (cflag & CSTOPB) {
		buf[4] = 2;
		dbg("%s - stop bits = 2", __FUNCTION__);
	} else {
		buf[4] = 0;
		dbg("%s - stop bits = 1", __FUNCTION__);
	}

	if (cflag & PARENB) {
		/* For reference buf[5]=0 is none parity */
		/* For reference buf[5]=1 is odd parity */
		/* For reference buf[5]=2 is even parity */
		/* For reference buf[5]=3 is mark parity */
		/* For reference buf[5]=4 is space parity */
		if (cflag & PARODD) {
			buf[5] = 1;
			dbg("%s - parity = odd", __FUNCTION__);
		} else {
			buf[5] = 2;
			dbg("%s - parity = even", __FUNCTION__);
		}
	} else {
		buf[5] = 0;
		dbg("%s - parity = none", __FUNCTION__);
	}

	i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
			     SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE,
			     0, 0, buf, 7, 100);
	dbg ("0x21:0x20:0:0  %d", i);

	if (cflag && CBAUD) {
		priv = port->private;
		if ((cflag && CBAUD) == B0)
			priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
		else
			priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
		set_control_lines (serial->dev, priv->line_control);
	}
	
	buf[0] = buf[1] = buf[2] = buf[3] = buf[4] = buf[5] = buf[6] = 0;

	i = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0),
			     GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
			     0, 0, buf, 7, 100);
	dbg ("0xa1:0x21:0:0  %d - %x %x %x %x %x %x %x", i,
	     buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);

	if (cflag & CRTSCTS) {
		if(priv->driverType == 2) {
			i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
													 VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
													 0x0, 0x61, NULL, 0, 100);
			dbg ("0x40:0x1:0x0:0x61  %d", i);
		} else {
			i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
													 VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
													 0x0, 0x41, NULL, 0, 100);
			dbg ("0x40:0x1:0x0:0x41  %d", i);
		}
	}

	kfree (buf);
}


static int pl2303_open (struct usb_serial_port *port, struct file *filp)
{
	struct termios tmp_termios;
	struct usb_serial *serial = port->serial;
	unsigned char buf[10];
	int result;
	struct pl2303_private *priv = port->private;

	if (port_paranoia_check (port, __FUNCTION__))
		return -ENODEV;
		
	dbg("%s -  port %d", __FUNCTION__, port->number);

	if(serial->dev->descriptor.bDeviceClass == 0x02)
		priv->driverType = 0;
	else if(serial->dev->descriptor.bMaxPacketSize0 == 0x40)
		priv->driverType = 2;
	else if(serial->dev->descriptor.bDeviceClass == 0x00)
		priv->driverType = 1;
	else if(serial->dev->descriptor.bDeviceClass == 0xFF)
		priv->driverType = 1;

	printk("PL-2303 driver type: %d", priv->driverType);

#define FISH(a,b,c,d)								\
	result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0),	\
			       b, a, c, d, buf, 1, 100);			\
	dbg("0x%x:0x%x:0x%x:0x%x  %d - %x",a,b,c,d,result,buf[0]);

#define SOUP(a,b,c,d)								\
	result=usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev,0),	\
			       b, a, c, d, NULL, 0, 100);			\
	dbg("0x%x:0x%x:0x%x:0x%x  %d",a,b,c,d,result);

	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
	SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 0);
	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
	SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 1);
	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
	FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
	SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0, 1);
	SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 1, 0);

	if(priv->driverType == 2) {
		SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x44);
	} else {
		SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x24);
	}

	/* Setup termios */
	if (port->tty) {
		pl2303_set_termios (port, &tmp_termios);
	}

	//FIXME: need to assert RTS and DTR if CRTSCTS off

	dbg("%s - submitting read urb", __FUNCTION__);
	port->read_urb->dev = serial->dev;
	result = usb_submit_urb (port->read_urb);
	if (result) {
		err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
		pl2303_close (port, NULL);
		return -EPROTO;
	}

	dbg("%s - submitting interrupt urb", __FUNCTION__);
	port->interrupt_in_urb->dev = serial->dev;
	result = usb_submit_urb (port->interrupt_in_urb);
	if (result) {
		err("%s - failed submitting interrupt urb, error %d", __FUNCTION__, result);
		pl2303_close (port, NULL);
		return -EPROTO;
	}
	return 0;
}


static void pl2303_close (struct usb_serial_port *port, struct file *filp)
{
	struct usb_serial *serial;
	struct pl2303_private *priv;
	unsigned int c_cflag;
	int result;

	if (port_paranoia_check (port, __FUNCTION__))
		return;
	serial = get_usb_serial (port, __FUNCTION__);
	if (!serial)
		return;
	
	dbg("%s - port %d", __FUNCTION__, port->number);

	if (serial->dev) {
		if (port->tty) {
			c_cflag = port->tty->termios->c_cflag;
			if (c_cflag & HUPCL) {
				/* drop DTR and RTS */
				priv = port->private;
				priv->line_control = 0;
				set_control_lines (port->serial->dev,
						   priv->line_control);
			}
		}

		/* shutdown our urbs */
		dbg("%s - shutting down urbs", __FUNCTION__);
		result = usb_unlink_urb (port->write_urb);
		if (result)
			dbg("%s - usb_unlink_urb (write_urb)"
			    " failed with reason: %d", __FUNCTION__,
			     result);

		result = usb_unlink_urb (port->read_urb);
		if (result)
			dbg("%s - usb_unlink_urb (read_urb) "
			    "failed with reason: %d", __FUNCTION__,
			     result);

		result = usb_unlink_urb (port->interrupt_in_urb);
		if (result)
			dbg("%s - usb_unlink_urb (interrupt_in_urb)"
			    " failed with reason: %d", __FUNCTION__,
			     result);
	}
}

static int set_modem_info (struct usb_serial_port *port, unsigned int cmd, unsigned int *value)
{
	struct pl2303_private *priv = port->private;
	unsigned int arg;

	if (copy_from_user(&arg, value, sizeof(int)))
		return -EFAULT;

	switch (cmd) {
		case TIOCMBIS:
			if (arg & TIOCM_RTS)
				priv->line_control |= CONTROL_RTS;
			if (arg & TIOCM_DTR)
				priv->line_control |= CONTROL_DTR;
			break;

		case TIOCMBIC:
			if (arg & TIOCM_RTS)
				priv->line_control &= ~CONTROL_RTS;
			if (arg & TIOCM_DTR)
				priv->line_control &= ~CONTROL_DTR;
			break;

		case TIOCMSET:
			/* turn off RTS and DTR and then only turn
			   on what was asked to */
			priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
			priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
			priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
			break;
	}

	return set_control_lines (port->serial->dev, priv->line_control);
}

static int get_modem_info (struct usb_serial_port *port, unsigned int *value)
{
	struct pl2303_private *priv = port->private;
	unsigned int mcr = priv->line_control;
	unsigned int result;

	result = ((mcr & CONTROL_DTR)		? TIOCM_DTR : 0)
		  | ((mcr & CONTROL_RTS)	? TIOCM_RTS : 0);

	dbg("%s - result = %x", __FUNCTION__, result);

	if (copy_to_user(value, &result, sizeof(int)))
		return -EFAULT;
	return 0;
}

static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg)
{
	dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);

	switch (cmd) {
		
		case TIOCMGET:
			dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
			return get_modem_info (port, (unsigned int *)arg);

		case TIOCMBIS:
		case TIOCMBIC:
		case TIOCMSET:
			dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__,  port->number);
			return set_modem_info(port, cmd, (unsigned int *) arg);

		default:
			dbg("%s not supported = 0x%04x", __FUNCTION__, cmd);
			break;
	}

	return -ENOIOCTLCMD;
}


static void pl2303_break_ctl (struct usb_serial_port *port, int break_state)
{
	struct usb_serial *serial = port->serial;
	u16 state;
	int result;

	dbg("%s - port %d", __FUNCTION__, port->number);

	if (break_state == 0)
		state = BREAK_OFF;
	else
		state = BREAK_ON;
	dbg("%s - turning break %s", state==BREAK_OFF ? "off" : "on", __FUNCTION__);

	result = usb_control_msg (serial->dev, usb_rcvctrlpipe (serial->dev, 0),
				  BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
				  0, NULL, 0, 100);
	if (result)
		dbg("%s - error sending break = %d", __FUNCTION__, result);
}


static void pl2303_shutdown (struct usb_serial *serial)
{
	int i;

	dbg("%s", __FUNCTION__);

	for (i = 0; i < serial->num_ports; ++i)
		kfree (serial->port[i].private);
}


static void pl2303_read_int_callback (struct urb *urb)
{
	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
	//unsigned char *data = urb->transfer_buffer;
	//int i;

//ints auto restart...

	if (!serial) {
		return;
	}

	if (urb->status) {
		urb->status = 0;
		return;
	}

	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
#if 0
//FIXME need to update state of terminal lines variable
#endif

	return;
}


static void pl2303_read_bulk_callback (struct urb *urb)
{
	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
	struct tty_struct *tty;
	unsigned char *data = urb->transfer_buffer;
	int i;
	int result;

	if (port_paranoia_check (port, __FUNCTION__))
		return;

	dbg("%s - port %d", __FUNCTION__, port->number);

	if (!serial) {
		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
		return;
	}

	if (urb->status) {
		dbg("%s - urb->status = %d", __FUNCTION__, urb->status);
		if (!port->open_count) {
			dbg("%s - port is closed, exiting.", __FUNCTION__);
			return;
		}
		if (urb->status == -EPROTO) {
			/* PL2303 mysteriously fails with -EPROTO reschedule the read */
			dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__);
			urb->status = 0;
			urb->dev = serial->dev;
			result = usb_submit_urb(urb);
			if (result)
				err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
			return;
		}
		dbg("%s - unable to handle the error, exiting.", __FUNCTION__);
		return;
	}

	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);

	tty = port->tty;
	if (tty && urb->actual_length) {
		for (i = 0; i < urb->actual_length; ++i) {
			if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
				tty_flip_buffer_push(tty);
			}
			tty_insert_flip_char (tty, data[i], 0);
		}
		tty_flip_buffer_push (tty);
	}

	/* Schedule the next read _if_ we are still open */
	if (port->open_count) {
		urb->dev = serial->dev;
		result = usb_submit_urb(urb);
		if (result)
			err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
	}

	return;
}



static void pl2303_write_bulk_callback (struct urb *urb)
{
	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
	int result;

	if (port_paranoia_check (port, __FUNCTION__))
		return;
	
	dbg("%s - port %d", __FUNCTION__, port->number);
	
	if (urb->status) {
		/* error in the urb, so we have to resubmit it */
		if (serial_paranoia_check (port->serial, __FUNCTION__)) {
			return;
		}
		dbg("%s - Overflow in write", __FUNCTION__);
		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
		port->write_urb->transfer_buffer_length = 1;
		port->write_urb->dev = port->serial->dev;
		result = usb_submit_urb (port->write_urb);
		if (result)
			err("%s - failed resubmitting write urb, error %d", __FUNCTION__, result);

		return;
	}

	queue_task(&port->tqueue, &tq_immediate);
	mark_bh(IMMEDIATE_BH);

	return;
}


static int __init pl2303_init (void)
{
	usb_serial_register (&pl2303_device);
	info(DRIVER_DESC " " DRIVER_VERSION);
	return 0;
}


static void __exit pl2303_exit (void)
{
	usb_serial_deregister (&pl2303_device);
}


module_init(pl2303_init);
module_exit(pl2303_exit);

MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug enabled or not");









”Makefile“

代码: 全选

# USB-Serial Makefile

#

# USAGE:

# To install driver -

#        make inst (The Makefile will check the module and compile and link it automatically. It will also remove

#                   the loaded USB-Serial driver)

#

# To uninstall driver -

#        make uninst

#

# To uninstall all drivers (including base driver) -

#        make uninst_all

#

# To remove module (*.o) files -

#        make clean

#



KINCLUDES=/usr/src/linux-2.4/include

DRVINCLUDES=/usr/src/linux-2.4/drivers/usb/serial



# uncomment line below if you have SMP

#SMPFLAGS=	-D__SMP__ -DCONFIG_SMP=1



# Unless you have a 386/486, you shouldn't need

# to change anything below here...



# CPUFLAGS=	-DCPU=586 -march=i586

MODULE=		pl2303

BASE_MODULE=	usbserial

CC=		gcc

CPPFLAGS=	-D__KERNEL__ -I$(KINCLUDES) -I$(DRVINCLUDES)

MODFLAGS=	-DMODULE

KERNFLAGS=      $(CPPFLAGS) $(CPUFLAGS) $(SMPFLAGS) \

		-Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer \

		-fno-strict-aliasing -fno-common -Wno-unused

# EXTRA_CFLAGS=	-DEXPORT_SYMTAB

# DBGCFLAGS=	-DDEBUG -DCONFIG_USB_SERIAL_DEBUG

CFLAGS=		$(KERNFLAGS) $(DBGCFLAGS) $(MODFLAGS)



RELVER=		$(shell uname -r)



all::		$(MODULE).o



$(MODULE).o:	$(MODULE).c

	$(CC) $(CFLAGS) -c $<



.PHONY: inst, uninst, uninst_all, clean



inst:	$(MODULE).o

ifneq (,$(findstring $(MODULE),$(shell lsmod | grep $(MODULE))))		# if module was already loaded

	rmmod $(MODULE)

	insmod ./$(MODULE).o

else

ifeq (,$(findstring $(BASE_MODULE),$(shell lsmod | grep $(BASE_MODULE))))	# if there is no base module

	insmod /lib/modules/$(RELVER)/kernel/drivers/usb/serial/$(BASE_MODULE).o

endif	

	insmod ./$(MODULE).o

endif

	@echo

	@echo ">> Please unplug and plug the cable if it is already plugged-in. <<"

	@echo



uninst:

ifneq (,$(findstring $(MODULE),$(shell lsmod | grep $(MODULE))))		# if module was loaded

	rmmod $(MODULE)

endif	

	@echo

	@echo ">> The USB-Serial driver is removed! <<"

	@echo



uninst_all:

ifneq (,$(findstring $(MODULE),$(shell lsmod | grep $(MODULE))))		# if module was loaded

	rmmod $(MODULE)

endif

ifneq (,$(findstring $(BASE_MODULE),$(shell lsmod | grep $(BASE_MODULE))))	# if base module was loaded

	rmmod $(BASE_MODULE)

endif	

	@echo

	@echo ">> The USB-Serial and base driver are removed! <<"

	@echo



clean:

	rm -f *.o






”ReadMe.txt“

代码: 全选

To install driver -

        make inst (The Makefile will check the module and compile and link it automatically. It will also remove

                   the loaded USB-Serial driver)



To uninstall driver -

        make uninst



To uninstall all drivers (including base driver) -

        make uninst_all



To remove module (*.o) files -

        make clean
附件
PL2303驱动_Linux.rar
(19.38 KiB) 已下载 230 次
hyz_ub
帖子: 38
注册时间: 2008-07-31 10:53
来自: 福建泉州

#2

帖子 hyz_ub » 2008-08-19 14:08

我直接编译的错误提示
hyj@hyj-desktop:~/文档/Redhat9$ make inst
gcc -D__KERNEL__ -I/usr/src/linux-2.4/include -I/usr/src/linux-2.4/drivers/usb/serial -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -DMODULE -c pl2303.c
pl2303.c:33:26: 错误: linux/config.h:No such file or directory
pl2303.c:36:24: 错误: linux/init.h:No such file or directory
pl2303.c:37:24: 错误: linux/slab.h:No such file or directory
pl2303.c:39:30: 错误: linux/tty_driver.h:No such file or directory
pl2303.c:40:28: 错误: linux/tty_flip.h:No such file or directory
pl2303.c:42:26: 错误: linux/module.h:No such file or directory
pl2303.c:43:28: 错误: linux/spinlock.h:No such file or directory
pl2303.c:44:25: 错误: asm/uaccess.h:No such file or directory
pl2303.c:45:23: 错误: linux/usb.h:No such file or directory
pl2303.c:53:24: 错误: usb-serial.h:No such file or directory
pl2303.c:54:20: 错误: pl2303.h:No such file or directory
pl2303.c:64: 错误: 数组元素的类型不完全
pl2303.c:65: 警告: 隐式声明函数‘USB_DEVICE’
pl2303.c:65: 错误: ‘PL2303_VENDOR_ID’未声明 (不在函数内)
pl2303.c:65: 错误: ‘PL2303_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:66: 错误: ‘PL2303_PRODUCT_ID_RSAQ2’未声明 (不在函数内)
pl2303.c:67: 错误: ‘IODATA_VENDOR_ID’未声明 (不在函数内)
pl2303.c:67: 错误: ‘IODATA_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:68: 错误: ‘ATEN_VENDOR_ID’未声明 (不在函数内)
pl2303.c:68: 错误: ‘ATEN_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:69: 错误: ‘ELCOM_VENDOR_ID’未声明 (不在函数内)
pl2303.c:69: 错误: ‘ELCOM_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:70: 错误: ‘ITEGNO_VENDOR_ID’未声明 (不在函数内)
pl2303.c:70: 错误: ‘ITEGNO_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:71: 错误: ‘MA620_VENDOR_ID’未声明 (不在函数内)
pl2303.c:71: 错误: ‘MA620_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:72: 错误: ‘RATOC_VENDOR_ID’未声明 (不在函数内)
pl2303.c:72: 错误: ‘RATOC_PRODUCT_ID’未声明 (不在函数内)
pl2303.c:76: 警告: 数据定义时没有类型或存储类
pl2303.c:76: 警告: 在‘MODULE_DEVICE_TABLE’的声明中,类型默认为‘int’
pl2303.c:76: 警告: 函数声明中出现形参名却未指定类型
pl2303.c:102: 警告: ‘struct file’在形参表内部声明
pl2303.c:102: 警告: 它的作用域仅限于此定义或声明,这可能并不是您想要的
pl2303.c:102: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:103: 警告: ‘struct file’在形参表内部声明
pl2303.c:103: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:105: 警告: ‘struct termios’在形参表内部声明
pl2303.c:105: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:107: 警告: ‘struct file’在形参表内部声明
pl2303.c:107: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:108: 警告: ‘struct urb’在形参表内部声明
pl2303.c:109: 警告: ‘struct urb’在形参表内部声明
pl2303.c:110: 警告: ‘struct urb’在形参表内部声明
pl2303.c:112: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:113: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:114: 警告: ‘struct usb_serial’在形参表内部声明
pl2303.c:115: 警告: ‘struct usb_serial’在形参表内部声明
pl2303.c:119: 错误: 变量‘pl2303_device’有初始值设定但类型不完全
pl2303.c:120: 错误: 初始值设定项里有未知的字段‘owner’
pl2303.c:120: 错误: ‘THIS_MODULE’未声明 (不在函数内)
pl2303.c:120: 警告: 结构初始化时有多余元素
pl2303.c:120: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:121: 错误: 初始值设定项里有未知的字段‘name’
pl2303.c:121: 警告: 结构初始化时有多余元素
pl2303.c:121: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:122: 错误: 初始值设定项里有未知的字段‘id_table’
pl2303.c:122: 警告: 结构初始化时有多余元素
pl2303.c:122: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:123: 错误: 初始值设定项里有未知的字段‘num_interrupt_in’
pl2303.c:123: 错误: ‘NUM_DONT_CARE’未声明 (不在函数内)
pl2303.c:123: 警告: 结构初始化时有多余元素
pl2303.c:123: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:124: 错误: 初始值设定项里有未知的字段‘num_bulk_in’
pl2303.c:124: 警告: 结构初始化时有多余元素
pl2303.c:124: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:125: 错误: 初始值设定项里有未知的字段‘num_bulk_out’
pl2303.c:125: 警告: 结构初始化时有多余元素
pl2303.c:125: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:126: 错误: 初始值设定项里有未知的字段‘num_ports’
pl2303.c:126: 警告: 结构初始化时有多余元素
pl2303.c:126: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:127: 错误: 初始值设定项里有未知的字段‘open’
pl2303.c:127: 警告: 结构初始化时有多余元素
pl2303.c:127: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:128: 错误: 初始值设定项里有未知的字段‘close’
pl2303.c:128: 警告: 结构初始化时有多余元素
pl2303.c:128: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:129: 错误: 初始值设定项里有未知的字段‘write’
pl2303.c:129: 警告: 结构初始化时有多余元素
pl2303.c:129: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:130: 错误: 初始值设定项里有未知的字段‘ioctl’
pl2303.c:130: 警告: 结构初始化时有多余元素
pl2303.c:130: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:131: 错误: 初始值设定项里有未知的字段‘break_ctl’
pl2303.c:131: 警告: 结构初始化时有多余元素
pl2303.c:131: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:132: 错误: 初始值设定项里有未知的字段‘set_termios’
pl2303.c:132: 警告: 结构初始化时有多余元素
pl2303.c:132: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:133: 错误: 初始值设定项里有未知的字段‘read_bulk_callback’
pl2303.c:133: 警告: 结构初始化时有多余元素
pl2303.c:133: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:134: 错误: 初始值设定项里有未知的字段‘read_int_callback’
pl2303.c:134: 警告: 结构初始化时有多余元素
pl2303.c:134: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:135: 错误: 初始值设定项里有未知的字段‘write_bulk_callback’
pl2303.c:135: 警告: 结构初始化时有多余元素
pl2303.c:135: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:136: 错误: 初始值设定项里有未知的字段‘startup’
pl2303.c:136: 警告: 结构初始化时有多余元素
pl2303.c:136: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:137: 错误: 初始值设定项里有未知的字段‘shutdown’
pl2303.c:137: 警告: 结构初始化时有多余元素
pl2303.c:137: 警告: (在‘pl2303_device’的初始化附近)
pl2303.c:141: 错误: expected specifier-qualifier-list before ‘u8’
pl2303.c:147: 警告: ‘struct usb_serial’在形参表内部声明
pl2303.c:148: 错误: 与‘pl2303_startup’类型冲突
pl2303.c:114: 错误: ‘pl2303_startup’的上一个声明在此
pl2303.c: 在函数‘pl2303_startup’中:
pl2303.c:152: 错误: 提领指向不完全类型的指针
pl2303.c:153: 警告: 隐式声明函数‘kmalloc’
pl2303.c:153: 错误: ‘GFP_KERNEL’未声明 (在此函数内第一次使用)
pl2303.c:153: 错误: (即使在一个函数内多次出现,每个未声明的标识符在其
pl2303.c:153: 错误: 所在的函数内也只报告一次。)
pl2303.c:153: 警告: 赋值时将整数赋给指针,未作类型转换
pl2303.c:156: 警告: 隐式声明函数‘memset’
pl2303.c:156: 警告: 内建函数 ‘memset’ 不兼容的隐式声明
pl2303.c:157: 错误: 提领指向不完全类型的指针
pl2303.c: 在文件层:
pl2303.c:162: 错误: expected declaration specifiers or ‘...’ before ‘u8’
pl2303.c:162: 警告: ‘struct usb_device’在形参表内部声明
pl2303.c: 在函数‘set_control_lines’中:
pl2303.c:166: 警告: 隐式声明函数‘usb_control_msg’
pl2303.c:166: 警告: 隐式声明函数‘usb_sndctrlpipe’
pl2303.c:168: 错误: ‘value’未声明 (在此函数内第一次使用)
pl2303.c:168: 错误: ‘NULL’未声明 (在此函数内第一次使用)
pl2303.c:169: 警告: 隐式声明函数‘dbg’
pl2303.c: 在文件层:
pl2303.c:173: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:174: 错误: 与‘pl2303_write’类型冲突
pl2303.c:112: 错误: ‘pl2303_write’的上一个声明在此
pl2303.c: 在函数‘pl2303_write’中:
pl2303.c:177: 错误: 提领指向不完全类型的指针
pl2303.c:179: 错误: 提领指向不完全类型的指针
pl2303.c:184: 错误: 提领指向不完全类型的指针
pl2303.c:184: 错误: 提领指向不完全类型的指针
pl2303.c:186: 警告: 隐式声明函数‘copy_from_user’
pl2303.c:186: 错误: 提领指向不完全类型的指针
pl2303.c:189: 警告: 隐式声明函数‘memcpy’
pl2303.c:189: 警告: 内建函数 ‘memcpy’ 不兼容的隐式声明
pl2303.c:189: 错误: 提领指向不完全类型的指针
pl2303.c:192: 警告: 隐式声明函数‘usb_serial_debug_data’
pl2303.c:192: 错误: 提领指向不完全类型的指针
pl2303.c:194: 错误: 提领指向不完全类型的指针
pl2303.c:195: 错误: 提领指向不完全类型的指针
pl2303.c:195: 错误: 提领指向不完全类型的指针
pl2303.c:196: 警告: 隐式声明函数‘usb_submit_urb’
pl2303.c:196: 错误: 提领指向不完全类型的指针
pl2303.c:198: 警告: 隐式声明函数‘err’
pl2303.c: 在文件层:
pl2303.c:207: 警告: ‘struct termios’在形参表内部声明
pl2303.c:207: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:208: 错误: 与‘pl2303_set_termios’类型冲突
pl2303.c:105: 错误: ‘pl2303_set_termios’的上一个声明在此
pl2303.c: 在函数‘pl2303_set_termios’中:
pl2303.c:209: 错误: 提领指向不完全类型的指针
pl2303.c:210: 错误: 提领指向不完全类型的指针
pl2303.c:216: 错误: 提领指向不完全类型的指针
pl2303.c:217: 错误: 提领指向不完全类型的指针
pl2303.c:219: 错误: 提领指向不完全类型的指针
pl2303.c:219: 错误: 提领指向不完全类型的指针
pl2303.c:224: 错误: 提领指向不完全类型的指针
pl2303.c:225: 错误: 提领指向不完全类型的指针
pl2303.c:225: 错误: ‘tty_std_termios’未声明 (在此函数内第一次使用)
pl2303.c:226: 错误: 提领指向不完全类型的指针
pl2303.c:226: 错误: ‘B9600’未声明 (在此函数内第一次使用)
pl2303.c:226: 错误: ‘CS8’未声明 (在此函数内第一次使用)
pl2303.c:226: 错误: ‘CREAD’未声明 (在此函数内第一次使用)
pl2303.c:226: 错误: ‘HUPCL’未声明 (在此函数内第一次使用)
pl2303.c:226: 错误: ‘CLOCAL’未声明 (在此函数内第一次使用)
pl2303.c:227: 错误: 提领指向不完全类型的指针
pl2303.c:229: 错误: 提领指向不完全类型的指针
pl2303.c:232: 错误: 提领指向不完全类型的指针
pl2303.c:233: 警告: 隐式声明函数‘RELEVANT_IFLAG’
pl2303.c:233: 错误: 提领指向不完全类型的指针
pl2303.c:233: 错误: 提领指向不完全类型的指针
pl2303.c:239: 错误: ‘GFP_KERNEL’未声明 (在此函数内第一次使用)
pl2303.c:239: 警告: 赋值时将整数赋给指针,未作类型转换
pl2303.c:244: 警告: 内建函数 ‘memset’ 不兼容的隐式声明
pl2303.c:246: 错误: 提领指向不完全类型的指针
pl2303.c:246: 警告: 隐式声明函数‘usb_rcvctrlpipe’
pl2303.c:246: 错误: 提领指向不完全类型的指针
pl2303.c:253: 错误: 提领指向不完全类型的指针
pl2303.c:253: 错误: 提领指向不完全类型的指针
pl2303.c:255: 错误: ‘NULL’未声明 (在此函数内第一次使用)
pl2303.c:259: 错误: ‘CSIZE’未声明 (在此函数内第一次使用)
pl2303.c:261: 错误: ‘CS5’未声明 (在此函数内第一次使用)
pl2303.c:262: 错误: ‘CS6’未声明 (在此函数内第一次使用)
pl2303.c:263: 错误: ‘CS7’未声明 (在此函数内第一次使用)
pl2303.c:271: 错误: ‘CBAUD’未声明 (在此函数内第一次使用)
pl2303.c:272: 错误: ‘B0’未声明 (在此函数内第一次使用)
pl2303.c:273: 错误: ‘B75’未声明 (在此函数内第一次使用)
pl2303.c:274: 错误: ‘B150’未声明 (在此函数内第一次使用)
pl2303.c:275: 错误: ‘B300’未声明 (在此函数内第一次使用)
pl2303.c:276: 错误: ‘B600’未声明 (在此函数内第一次使用)
pl2303.c:277: 错误: ‘B1200’未声明 (在此函数内第一次使用)
pl2303.c:278: 错误: ‘B1800’未声明 (在此函数内第一次使用)
pl2303.c:279: 错误: ‘B2400’未声明 (在此函数内第一次使用)
pl2303.c:280: 错误: ‘B4800’未声明 (在此函数内第一次使用)
pl2303.c:282: 错误: ‘B19200’未声明 (在此函数内第一次使用)
pl2303.c:283: 错误: ‘B38400’未声明 (在此函数内第一次使用)
pl2303.c:284: 错误: ‘B57600’未声明 (在此函数内第一次使用)
pl2303.c:285: 错误: ‘B115200’未声明 (在此函数内第一次使用)
pl2303.c:286: 错误: ‘B230400’未声明 (在此函数内第一次使用)
pl2303.c:287: 错误: ‘B460800’未声明 (在此函数内第一次使用)
pl2303.c:303: 错误: ‘CSTOPB’未声明 (在此函数内第一次使用)
pl2303.c:311: 错误: ‘PARENB’未声明 (在此函数内第一次使用)
pl2303.c:317: 错误: ‘PARODD’未声明 (在此函数内第一次使用)
pl2303.c:329: 错误: 提领指向不完全类型的指针
pl2303.c:329: 错误: 提领指向不完全类型的指针
pl2303.c:335: 错误: 提领指向不完全类型的指针
pl2303.c:337: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:339: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:340: 错误: 提领指向不完全类型的指针
pl2303.c:340: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:340: 错误: 提供给函数‘set_control_lines’的实参太多
pl2303.c:345: 错误: 提领指向不完全类型的指针
pl2303.c:345: 错误: 提领指向不完全类型的指针
pl2303.c:351: 错误: ‘CRTSCTS’未声明 (在此函数内第一次使用)
pl2303.c:352: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:353: 错误: 提领指向不完全类型的指针
pl2303.c:353: 错误: 提领指向不完全类型的指针
pl2303.c:358: 错误: 提领指向不完全类型的指针
pl2303.c:358: 错误: 提领指向不完全类型的指针
pl2303.c:365: 警告: 隐式声明函数‘kfree’
pl2303.c: 在文件层:
pl2303.c:369: 警告: ‘struct file’在形参表内部声明
pl2303.c:369: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:370: 错误: 与‘pl2303_open’类型冲突
pl2303.c:102: 错误: ‘pl2303_open’的上一个声明在此
pl2303.c: 在函数‘pl2303_open’中:
pl2303.c:371: 错误: ‘tmp_termios’的存储大小未知
pl2303.c:372: 错误: 提领指向不完全类型的指针
pl2303.c:375: 错误: 提领指向不完全类型的指针
pl2303.c:377: 警告: 隐式声明函数‘port_paranoia_check’
pl2303.c:380: 错误: 提领指向不完全类型的指针
pl2303.c:382: 错误: 提领指向不完全类型的指针
pl2303.c:383: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:384: 错误: 提领指向不完全类型的指针
pl2303.c:385: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:386: 错误: 提领指向不完全类型的指针
pl2303.c:387: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:388: 错误: 提领指向不完全类型的指针
pl2303.c:389: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:391: 警告: 隐式声明函数‘printk’
pl2303.c:391: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:403: 错误: 提领指向不完全类型的指针
pl2303.c:403: 错误: 提领指向不完全类型的指针
pl2303.c:404: 错误: 提领指向不完全类型的指针
pl2303.c:404: 错误: 提领指向不完全类型的指针
pl2303.c:404: 错误: ‘NULL’未声明 (在此函数内第一次使用)
pl2303.c:405: 错误: 提领指向不完全类型的指针
pl2303.c:405: 错误: 提领指向不完全类型的指针
pl2303.c:406: 错误: 提领指向不完全类型的指针
pl2303.c:406: 错误: 提领指向不完全类型的指针
pl2303.c:407: 错误: 提领指向不完全类型的指针
pl2303.c:407: 错误: 提领指向不完全类型的指针
pl2303.c:408: 错误: 提领指向不完全类型的指针
pl2303.c:408: 错误: 提领指向不完全类型的指针
pl2303.c:409: 错误: 提领指向不完全类型的指针
pl2303.c:409: 错误: 提领指向不完全类型的指针
pl2303.c:410: 错误: 提领指向不完全类型的指针
pl2303.c:410: 错误: 提领指向不完全类型的指针
pl2303.c:411: 错误: 提领指向不完全类型的指针
pl2303.c:411: 错误: 提领指向不完全类型的指针
pl2303.c:412: 错误: 提领指向不完全类型的指针
pl2303.c:412: 错误: 提领指向不完全类型的指针
pl2303.c:414: 错误: ‘struct pl2303_private’没有名为‘driverType’的成员
pl2303.c:415: 错误: 提领指向不完全类型的指针
pl2303.c:415: 错误: 提领指向不完全类型的指针
pl2303.c:417: 错误: 提领指向不完全类型的指针
pl2303.c:417: 错误: 提领指向不完全类型的指针
pl2303.c:421: 错误: 提领指向不完全类型的指针
pl2303.c:422: 警告: 传递参数 1 (属于‘pl2303_set_termios’)时在不兼容的指针类型间转换
pl2303.c:428: 错误: 提领指向不完全类型的指针
pl2303.c:428: 错误: 提领指向不完全类型的指针
pl2303.c:429: 错误: 提领指向不完全类型的指针
pl2303.c:432: 警告: 传递参数 1 (属于‘pl2303_close’)时在不兼容的指针类型间转换
pl2303.c:437: 错误: 提领指向不完全类型的指针
pl2303.c:437: 错误: 提领指向不完全类型的指针
pl2303.c:438: 错误: 提领指向不完全类型的指针
pl2303.c:441: 警告: 传递参数 1 (属于‘pl2303_close’)时在不兼容的指针类型间转换
pl2303.c: 在文件层:
pl2303.c:448: 警告: ‘struct file’在形参表内部声明
pl2303.c:448: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:449: 错误: 与‘pl2303_close’类型冲突
pl2303.c:103: 错误: ‘pl2303_close’的上一个声明在此
pl2303.c: 在函数‘pl2303_close’中:
pl2303.c:457: 警告: 隐式声明函数‘get_usb_serial’
pl2303.c:457: 警告: 赋值时将整数赋给指针,未作类型转换
pl2303.c:461: 错误: 提领指向不完全类型的指针
pl2303.c:463: 错误: 提领指向不完全类型的指针
pl2303.c:464: 错误: 提领指向不完全类型的指针
pl2303.c:465: 错误: 提领指向不完全类型的指针
pl2303.c:466: 错误: ‘HUPCL’未声明 (在此函数内第一次使用)
pl2303.c:468: 错误: 提领指向不完全类型的指针
pl2303.c:469: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:470: 错误: 提领指向不完全类型的指针
pl2303.c:471: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:471: 错误: 提供给函数‘set_control_lines’的实参太多
pl2303.c:477: 警告: 隐式声明函数‘usb_unlink_urb’
pl2303.c:477: 错误: 提领指向不完全类型的指针
pl2303.c:483: 错误: 提领指向不完全类型的指针
pl2303.c:489: 错误: 提领指向不完全类型的指针
pl2303.c: 在文件层:
pl2303.c:497: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c: 在函数‘set_modem_info’中:
pl2303.c:499: 错误: 提领指向不完全类型的指针
pl2303.c:506: 错误: ‘TIOCMBIS’未声明 (在此函数内第一次使用)
pl2303.c:507: 错误: ‘TIOCM_RTS’未声明 (在此函数内第一次使用)
pl2303.c:508: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:509: 错误: ‘TIOCM_DTR’未声明 (在此函数内第一次使用)
pl2303.c:510: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:513: 错误: ‘TIOCMBIC’未声明 (在此函数内第一次使用)
pl2303.c:515: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:517: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:520: 错误: ‘TIOCMSET’未声明 (在此函数内第一次使用)
pl2303.c:523: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:524: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:525: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:529: 错误: 提领指向不完全类型的指针
pl2303.c:529: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:529: 错误: 提供给函数‘set_control_lines’的实参太多
pl2303.c: 在文件层:
pl2303.c:532: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c: 在函数‘get_modem_info’中:
pl2303.c:534: 错误: 提领指向不完全类型的指针
pl2303.c:535: 错误: ‘struct pl2303_private’没有名为‘line_control’的成员
pl2303.c:538: 错误: ‘TIOCM_DTR’未声明 (在此函数内第一次使用)
pl2303.c:539: 错误: ‘TIOCM_RTS’未声明 (在此函数内第一次使用)
pl2303.c:543: 警告: 隐式声明函数‘copy_to_user’
pl2303.c: 在文件层:
pl2303.c:548: 警告: ‘struct file’在形参表内部声明
pl2303.c:548: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:549: 错误: 与‘pl2303_ioctl’类型冲突
pl2303.c:107: 错误: ‘pl2303_ioctl’的上一个声明在此
pl2303.c: 在函数‘pl2303_ioctl’中:
pl2303.c:550: 错误: 提领指向不完全类型的指针
pl2303.c:554: 错误: ‘TIOCMGET’未声明 (在此函数内第一次使用)
pl2303.c:555: 错误: 提领指向不完全类型的指针
pl2303.c:556: 警告: 传递参数 1 (属于‘get_modem_info’)时在不兼容的指针类型间转换
pl2303.c:558: 错误: ‘TIOCMBIS’未声明 (在此函数内第一次使用)
pl2303.c:559: 错误: ‘TIOCMBIC’未声明 (在此函数内第一次使用)
pl2303.c:560: 错误: ‘TIOCMSET’未声明 (在此函数内第一次使用)
pl2303.c:561: 错误: 提领指向不完全类型的指针
pl2303.c:562: 警告: 传递参数 1 (属于‘set_modem_info’)时在不兼容的指针类型间转换
pl2303.c:569: 错误: ‘ENOIOCTLCMD’未声明 (在此函数内第一次使用)
pl2303.c: 在文件层:
pl2303.c:573: 警告: ‘struct usb_serial_port’在形参表内部声明
pl2303.c:574: 错误: 与‘pl2303_break_ctl’类型冲突
pl2303.c:113: 错误: ‘pl2303_break_ctl’的上一个声明在此
pl2303.c: 在函数‘pl2303_break_ctl’中:
pl2303.c:575: 错误: 提领指向不完全类型的指针
pl2303.c:576: 错误: ‘u16’未声明 (在此函数内第一次使用)
pl2303.c:576: 错误: expected ‘;’ before ‘state’
pl2303.c:579: 错误: 提领指向不完全类型的指针
pl2303.c:582: 错误: ‘state’未声明 (在此函数内第一次使用)
pl2303.c:587: 错误: 提领指向不完全类型的指针
pl2303.c:587: 错误: 提领指向不完全类型的指针
pl2303.c:589: 错误: ‘NULL’未声明 (在此函数内第一次使用)
pl2303.c: 在文件层:
pl2303.c:595: 警告: ‘struct usb_serial’在形参表内部声明
pl2303.c:596: 错误: 与‘pl2303_shutdown’类型冲突
pl2303.c:115: 错误: ‘pl2303_shutdown’的上一个声明在此
pl2303.c: 在函数‘pl2303_shutdown’中:
pl2303.c:601: 错误: 提领指向不完全类型的指针
pl2303.c:602: 错误: 提领指向不完全类型的指针
pl2303.c: 在文件层:
pl2303.c:606: 警告: ‘struct urb’在形参表内部声明
pl2303.c:607: 错误: 与‘pl2303_read_int_callback’类型冲突
pl2303.c:108: 错误: ‘pl2303_read_int_callback’的上一个声明在此
pl2303.c: 在函数‘pl2303_read_int_callback’中:
pl2303.c:608: 错误: 提领指向不完全类型的指针
pl2303.c:609: 警告: 初始化时将整数赋给指针,未作类型转换
pl2303.c:619: 错误: 提领指向不完全类型的指针
pl2303.c:620: 错误: 提领指向不完全类型的指针
pl2303.c:624: 错误: 提领指向不完全类型的指针
pl2303.c:624: 错误: 提领指向不完全类型的指针
pl2303.c: 在文件层:
pl2303.c:633: 警告: ‘struct urb’在形参表内部声明
pl2303.c:634: 错误: 与‘pl2303_read_bulk_callback’类型冲突
pl2303.c:109: 错误: ‘pl2303_read_bulk_callback’的上一个声明在此
pl2303.c: 在函数‘pl2303_read_bulk_callback’中:
pl2303.c:635: 错误: 提领指向不完全类型的指针
pl2303.c:636: 警告: 初始化时将整数赋给指针,未作类型转换
pl2303.c:638: 错误: 提领指向不完全类型的指针
pl2303.c:645: 错误: 提领指向不完全类型的指针
pl2303.c:652: 错误: 提领指向不完全类型的指针
pl2303.c:653: 错误: 提领指向不完全类型的指针
pl2303.c:654: 错误: 提领指向不完全类型的指针
pl2303.c:658: 错误: 提领指向不完全类型的指针
pl2303.c:661: 错误: 提领指向不完全类型的指针
pl2303.c:662: 错误: 提领指向不完全类型的指针
pl2303.c:662: 错误: 提领指向不完全类型的指针
pl2303.c:672: 错误: 提领指向不完全类型的指针
pl2303.c:674: 错误: 提领指向不完全类型的指针
pl2303.c:675: 错误: 提领指向不完全类型的指针
pl2303.c:676: 错误: 提领指向不完全类型的指针
pl2303.c:677: 错误: 提领指向不完全类型的指针
pl2303.c:677: 错误: ‘TTY_FLIPBUF_SIZE’未声明 (在此函数内第一次使用)
pl2303.c:678: 警告: 隐式声明函数‘tty_flip_buffer_push’
pl2303.c:680: 警告: 隐式声明函数‘tty_insert_flip_char’
pl2303.c:686: 错误: 提领指向不完全类型的指针
pl2303.c:687: 错误: 提领指向不完全类型的指针
pl2303.c:687: 错误: 提领指向不完全类型的指针
pl2303.c: 在文件层:
pl2303.c:698: 警告: ‘struct urb’在形参表内部声明
pl2303.c:699: 错误: 与‘pl2303_write_bulk_callback’类型冲突
pl2303.c:110: 错误: ‘pl2303_write_bulk_callback’的上一个声明在此
pl2303.c: 在函数‘pl2303_write_bulk_callback’中:
pl2303.c:700: 错误: 提领指向不完全类型的指针
pl2303.c:706: 错误: 提领指向不完全类型的指针
pl2303.c:708: 错误: 提领指向不完全类型的指针
pl2303.c:710: 警告: 隐式声明函数‘serial_paranoia_check’
pl2303.c:710: 错误: 提领指向不完全类型的指针
pl2303.c:714: 错误: 提领指向不完全类型的指针
pl2303.c:715: 错误: 提领指向不完全类型的指针
pl2303.c:716: 错误: 提领指向不完全类型的指针
pl2303.c:716: 错误: 提领指向不完全类型的指针
pl2303.c:717: 错误: 提领指向不完全类型的指针
pl2303.c:724: 警告: 隐式声明函数‘queue_task’
pl2303.c:724: 错误: 提领指向不完全类型的指针
pl2303.c:724: 错误: ‘tq_immediate’未声明 (在此函数内第一次使用)
pl2303.c:725: 警告: 隐式声明函数‘mark_bh’
pl2303.c:725: 错误: ‘IMMEDIATE_BH’未声明 (在此函数内第一次使用)
pl2303.c: 在文件层:
pl2303.c:731: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pl2303_init’
pl2303.c:739: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pl2303_exit’
pl2303.c:745: 警告: 数据定义时没有类型或存储类
pl2303.c:745: 警告: 在‘module_init’的声明中,类型默认为‘int’
pl2303.c:745: 警告: 函数声明中出现形参名却未指定类型
pl2303.c:746: 警告: 数据定义时没有类型或存储类
pl2303.c:746: 警告: 在‘module_exit’的声明中,类型默认为‘int’
pl2303.c:746: 警告: 函数声明中出现形参名却未指定类型
pl2303.c:748: 错误: expected declaration specifiers or ‘...’ before string constant
pl2303.c:748: 警告: 数据定义时没有类型或存储类
pl2303.c:748: 警告: 在‘MODULE_DESCRIPTION’的声明中,类型默认为‘int’
pl2303.c:748: 警告: 函数声明不是一个原型
pl2303.c:749: 错误: expected declaration specifiers or ‘...’ before string constant
pl2303.c:749: 警告: 数据定义时没有类型或存储类
pl2303.c:749: 警告: 在‘MODULE_LICENSE’的声明中,类型默认为‘int’
pl2303.c:749: 警告: 函数声明不是一个原型
pl2303.c:751: 错误: expected ‘)’ before string constant
pl2303.c:752: 错误: expected ‘)’ before string constant
make: *** [pl2303.o] 错误 1
hyj@hyj-desktop:~/文档/Redhat9$
linqingzhou
帖子: 16
注册时间: 2008-08-06 21:31

自带了驱动

#3

帖子 linqingzhou » 2008-08-19 22:40

可以参考:viewtopic.php?t=142287
hyz_ub
帖子: 38
注册时间: 2008-07-31 10:53
来自: 福建泉州

#4

帖子 hyz_ub » 2008-08-20 9:43

谢谢,问题已解决。
头像
XEUY
帖子: 247
注册时间: 2007-08-20 8:13
联系:

Re: pl2303有ubuntu下的驱动吗?

#5

帖子 XEUY » 2009-06-01 17:14

请教,我的西门子CX65的数据线芯片是pl2303,在UBUNTU下能直接支持,可以用手机上GPRS网,但是不知道怎么才能在UBUNTU下读出手机的文件,请教~~ :em32
每天都在起步。。。如同起床
stvh
帖子: 3
注册时间: 2008-10-11 19:52

Re: pl2303有ubuntu下的驱动吗?

#6

帖子 stvh » 2009-06-29 22:14

ubuntu下面自带pl2303驱动,我用的是8.04版本
回复