Beispiel #1
0
int usb_create_sysfs_dev_files(struct usb_device *udev)
{
    struct device *dev = &udev->dev;
    int retval;

    /* Unforunately these attributes cannot be created before
     * the uevent is broadcast.
     */
    retval = device_create_bin_file(dev, &dev_bin_attr_descriptors);
    if (retval)
        goto error;

    retval = add_persist_attributes(dev);
    if (retval)
        goto error;

    retval = add_power_attributes(dev);
    if (retval)
        goto error;

    retval = usb_create_ep_files(dev, &udev->ep0, udev);
    if (retval)
        goto error;
    return 0;
error:
    usb_remove_sysfs_dev_files(udev);
    return retval;
}
static void generic_disconnect(struct usb_device *udev)
{
        printk("[K] generic disconnect:%d\n", g3_flag); // tmp test

        if(g3_flag == 1)
        {
/*
		if(usb_plug_flag == HUB_RE_ENABLE)
		{
			printk("[K] hub re_enable, ignore sending event\n");	// tmp test
		} 
		else
		{
*/
		printk("[K] send 3g plug-off event\n");	// tmp test
        	usb_plug_flag = G3_PLUG_OFF;        // ASUS PLUG
        	kill_proc(1, SIGTTIN, 1);
//		}
        }

	usb_notify_remove_device(udev);

	/* if this is only an unbind, not a physical disconnect, then
	 * unconfigure the device */
	if (udev->actconfig)
		usb_set_configuration(udev, -1);

	usb_remove_sysfs_dev_files(udev);
}
static void generic_disconnect(struct usb_device *udev)
{
	usb_notify_remove_device(udev);

	/* if this is only an unbind, not a physical disconnect, then
	 * unconfigure the device */
	if (udev->actconfig)
		usb_set_configuration(udev, -1);

	usb_remove_sysfs_dev_files(udev);
}
Beispiel #4
0
int usb_create_sysfs_dev_files(struct usb_device *udev)
{
	struct device *dev = &udev->dev;
	int retval;

	retval = device_create_bin_file(dev, &dev_bin_attr_descriptors);
	if (retval)
		goto error;

	retval = add_persist_attributes(dev);
	if (retval)
		goto error;

	retval = add_power_attributes(dev);
	if (retval)
		goto error;
	return retval;
error:
	usb_remove_sysfs_dev_files(udev);
	return retval;
}
Beispiel #5
0
int usb_create_sysfs_dev_files(struct usb_device *udev)
{
	struct device *dev = &udev->dev;
	int retval;

	retval = sysfs_create_group(&dev->kobj, &dev_attr_grp);
	if (retval)
		return retval;

	retval = device_create_bin_file(dev, &dev_bin_attr_descriptors);
	if (retval)
		goto error;

	retval = add_power_attributes(dev);
	if (retval)
		goto error;

	if (udev->manufacturer) {
		retval = device_create_file(dev, &dev_attr_manufacturer);
		if (retval)
			goto error;
	}
	if (udev->product) {
		retval = device_create_file(dev, &dev_attr_product);
		if (retval)
			goto error;
	}
	if (udev->serial) {
		retval = device_create_file(dev, &dev_attr_serial);
		if (retval)
			goto error;
	}
	retval = usb_create_ep_files(dev, &udev->ep0, udev);
	if (retval)
		goto error;
	return 0;
error:
	usb_remove_sysfs_dev_files(udev);
	return retval;
}
Beispiel #6
0
/*
 * Notifications of device and interface registration
 */
static int usb_bus_notify(struct notifier_block *nb, unsigned long action,
		void *data)
{
	struct device *dev = data;

	switch (action) {
	case BUS_NOTIFY_ADD_DEVICE:
		if (dev->type == &usb_device_type)
			(void) usb_create_sysfs_dev_files(to_usb_device(dev));
		else if (dev->type == &usb_if_device_type)
			usb_create_sysfs_intf_files(to_usb_interface(dev));
		break;

	case BUS_NOTIFY_DEL_DEVICE:
		if (dev->type == &usb_device_type)
			usb_remove_sysfs_dev_files(to_usb_device(dev));
		else if (dev->type == &usb_if_device_type)
			usb_remove_sysfs_intf_files(to_usb_interface(dev));
		break;
	}
	return 0;
}