usbatm xusbatm.c,NONE,1.1

kagan at infradead.org kagan at infradead.org
Sat Apr 2 15:12:56 EST 2005


Update of /home/cvs/usbatm
In directory phoenix.infradead.org:/tmp/cvs-serv15535

Added Files:
	xusbatm.c 
Log Message:
Initial revision.

--- NEW FILE xusbatm.c ---
/******************************************************************************
 *  xusbatm.c -	dumb usbatm-based driver for modems initialized in userspace
 *
 *  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.
 *
 *  This program is distributed in the hope that it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 *  more details.
 *
 *  You should have received a copy of the GNU General Public License along with
 *  this program; if not, write to the Free Software Foundation, Inc., 59
 *  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ******************************************************************************/

#include <linux/delay.h>
#include <linux/module.h>

#include "usbatm.h"


static struct usb_device_id xusbatm_usb_ids[] = {
	{
		.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
	},
	{}
};

static uint vendor;
module_param(vendor, uint, 0444);
MODULE_PARM_DESC(vendor, "USB device vendor");
static uint product;
module_param(product, uint, 0444);
MODULE_PARM_DESC(product, "USB device product");

static uint rx_intf;
module_param(rx_intf, uint, 0444);
MODULE_PARM_DESC(rx_intf, "rx interface number (default 0)");
static uint tx_intf;
module_param(tx_intf, uint, 0444);
MODULE_PARM_DESC(tx_intf, "tx interface number (default 0)");

static const char xusbatm_driver_name[] = "xusbatm";

static struct usbatm_driver xusbatm_driver = {
        .owner          = THIS_MODULE,
        .driver_name    = xusbatm_driver_name,
/*
        .bind           = xusbatm_bind,
        .unbind         = xusbatm_unbind,
*/
        .in             = -1,
        .out            = -1,
};

module_param_named(rx_endpoint, xusbatm_driver.in, int, 0444);
MODULE_PARM_DESC(rx_endpoint, "rx endpoint number");
module_param_named(tx_endpoint, xusbatm_driver.out, int, 0444);
MODULE_PARM_DESC(tx_endpoint, "tx endpoint number");
module_param_named(rx_padding, xusbatm_driver.rx_padding, uint, 0444);
MODULE_PARM_DESC(rx_padding, "rx padding (default 0)");
module_param_named(tx_padding, xusbatm_driver.tx_padding, uint, 0444);
MODULE_PARM_DESC(tx_padding, "tx padding (default 0)");

/*
static int xusbatm_bind(struct usbatm_data *usbatm_instance,
			struct usb_interface *intf, const struct usb_device_id *id,
			int *need_heavy_init)
{
	dbg("xusbatm_bind");

	return 0;
}

static void xusbatm_unbind(struct usbatm_data *usbatm_instance,
			   struct usb_interface *intf)
{
	dbg("xusbatm_unbind");
}
*/

static int xusbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
        return usbatm_usb_probe(intf, id, &xusbatm_driver);
}

static struct usb_driver xusbatm_usb_driver = {
	.owner		= THIS_MODULE,
        .name		= xusbatm_driver_name,
	.probe		= xusbatm_usb_probe,
	.disconnect	= usbatm_usb_disconnect,
	.id_table	= xusbatm_usb_ids
};

static int __init xusbatm_init(void)
{
	dbg("xusbatm_init");

	if (xusbatm_driver.in < 0 || xusbatm_driver.out < 0) {
		warn("indicate the endpoints with `rx_endpoint' and `tx_endpoint' module parameters");
		return -EINVAL;
	}

	xusbatm_usb_ids[0].idVendor = vendor;
	xusbatm_usb_ids[0].idProduct = product;

	return usb_register(&xusbatm_usb_driver);
}
module_init(xusbatm_init);

static void __exit xusbatm_exit(void)
{
	dbg("xusbatm_exit entered");

	usb_deregister(&xusbatm_usb_driver);
}
module_exit(xusbatm_exit);

MODULE_LICENSE("GPL");




More information about the Usbatm-commits mailing list