예제 #1
0
파일: sysfs.c 프로젝트: ECRS/Asus-RT-N16
int usb_create_sysfs_intf_files(struct usb_interface *intf)
{
    struct usb_device *udev = interface_to_usbdev(intf);
    struct usb_host_interface *alt = intf->cur_altsetting;
    int i;
    int retval;

    if (intf->unregistering)
        return 0;

    if (intf->sysfs_files_created)
        return 0;

    /* The interface string may be present in some altsettings
     * and missing in others.  Hence its attribute cannot be created
     * before the uevent is broadcast.
     */
    if (alt->string == NULL &&
            !(udev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
        alt->string = usb_cache_string(udev, alt->desc.iInterface);
    if (alt->string)
        retval = device_create_file(&intf->dev, &dev_attr_interface);
    for (i = 0; i < alt->desc.bNumEndpoints; ++i)
        usb_create_ep_files(&intf->dev, &alt->endpoint[i], udev);
    intf->sysfs_files_created = 1;
    return 0;
}
예제 #2
0
파일: sysfs.c 프로젝트: ECRS/Asus-RT-N16
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;
}
예제 #3
0
static inline void usb_create_intf_ep_files(struct usb_interface *intf,
		struct usb_device *udev)
{
	struct usb_host_interface *iface_desc;
	int i;

	iface_desc = intf->cur_altsetting;
	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
		usb_create_ep_files(&intf->dev, &iface_desc->endpoint[i],
				udev);
}
예제 #4
0
void usb_create_sysfs_dev_files (struct usb_device *udev)
{
	struct device *dev = &udev->dev;

	sysfs_create_group(&dev->kobj, &dev_attr_grp);

	if (udev->manufacturer)
		device_create_file (dev, &dev_attr_manufacturer);
	if (udev->product)
		device_create_file (dev, &dev_attr_product);
	if (udev->serial)
		device_create_file (dev, &dev_attr_serial);
	device_create_file (dev, &dev_attr_configuration);
	usb_create_ep_files(dev, &udev->ep0, udev);
}
예제 #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;
}