Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
sysfs.c File Reference
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/usb.h>
#include <linux/usb/quirks.h>
#include "usb.h"

Go to the source code of this file.

Macros

#define usb_actconfig_show(field, multiplier, format_string)
 
#define usb_actconfig_attr(field, multiplier, format_string)
 
#define usb_string_attr(name)
 
#define add_persist_attributes(dev)   0
 
#define remove_persist_attributes(dev)   do {} while (0)
 
#define add_power_attributes(dev)   0
 
#define remove_power_attributes(dev)   do {} while (0)
 
#define usb_descriptor_attr_le16(field, format_string)
 
#define usb_descriptor_attr(field, format_string)
 
#define usb_intf_assoc_attr(field, format_string)
 
#define usb_intf_attr(field, format_string)
 

Functions

 usb_actconfig_attr (bNumInterfaces, usb_actconfig_attr(1,"%2d\n")
 
 usb_actconfig_show (bConfigurationValue, 1,"%u\n")
 
 usb_string_attr (product)
 
 usb_string_attr (manufacturer)
 
 usb_string_attr (serial)
 
 usb_descriptor_attr_le16 (idVendor,"%04x\n")
 
int usb_create_sysfs_dev_files (struct usb_device *udev)
 
void usb_remove_sysfs_dev_files (struct usb_device *udev)
 
 usb_intf_assoc_attr (bFirstInterface,"%02x\n")
 
void usb_create_sysfs_intf_files (struct usb_interface *intf)
 
void usb_remove_sysfs_intf_files (struct usb_interface *intf)
 

Variables

struct attribute_groupusb_device_groups []
 
struct attribute_groupusb_interface_groups []
 

Macro Definition Documentation

#define add_persist_attributes (   dev)    0

Definition at line 323 of file sysfs.c.

#define add_power_attributes (   dev)    0

Definition at line 531 of file sysfs.c.

#define remove_persist_attributes (   dev)    do {} while (0)

Definition at line 324 of file sysfs.c.

#define remove_power_attributes (   dev)    do {} while (0)

Definition at line 532 of file sysfs.c.

#define usb_actconfig_attr (   field,
  multiplier,
  format_string 
)
Value:
usb_actconfig_show(field, multiplier, format_string) \
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);

Definition at line 36 of file sysfs.c.

#define usb_actconfig_show (   field,
  multiplier,
  format_string 
)
Value:
static ssize_t show_##field(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct usb_device *udev; \
struct usb_host_config *actconfig; \
\
udev = to_usb_device(dev); \
actconfig = udev->actconfig; \
if (actconfig) \
return sprintf(buf, format_string, \
actconfig->desc.field * multiplier); \
else \
return 0; \
} \

Definition at line 20 of file sysfs.c.

#define usb_descriptor_attr (   field,
  format_string 
)
Value:
static ssize_t \
show_##field(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct usb_device *udev; \
\
udev = to_usb_device(dev); \
return sprintf(buf, format_string, udev->descriptor.field); \
} \
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
#define usb_descriptor_attr_le16 (   field,
  format_string 
)
Value:
static ssize_t \
show_##field(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct usb_device *udev; \
\
udev = to_usb_device(dev); \
return sprintf(buf, format_string, \
le16_to_cpu(udev->descriptor.field)); \
} \
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);

Definition at line 538 of file sysfs.c.

#define usb_intf_assoc_attr (   field,
  format_string 
)
Value:
static ssize_t \
show_iad_##field(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct usb_interface *intf = to_usb_interface(dev); \
\
return sprintf(buf, format_string, \
intf->intf_assoc->field); \
} \
static DEVICE_ATTR(iad_##field, S_IRUGO, show_iad_##field, NULL);

Definition at line 787 of file sysfs.c.

#define usb_intf_attr (   field,
  format_string 
)
Value:
static ssize_t \
show_##field(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct usb_interface *intf = to_usb_interface(dev); \
\
return sprintf(buf, format_string, \
intf->cur_altsetting->desc.field); \
} \
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
#define usb_string_attr (   name)
Value:
static ssize_t show_##name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct usb_device *udev; \
int retval; \
\
udev = to_usb_device(dev); \
usb_lock_device(udev); \
retval = sprintf(buf, "%s\n", udev->name); \
usb_unlock_device(udev); \
return retval; \
} \
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);

Definition at line 80 of file sysfs.c.

Function Documentation

usb_actconfig_attr ( bNumInterfaces  ,
usb_actconfig_attr(  1,
"%2d\n"   
)

Definition at line 40 of file sysfs.c.

usb_actconfig_show ( bConfigurationValue  ,
,
"%u\n"   
)
int usb_create_sysfs_dev_files ( struct usb_device *  udev)

Definition at line 755 of file sysfs.c.

void usb_create_sysfs_intf_files ( struct usb_interface intf)

Definition at line 936 of file sysfs.c.

usb_descriptor_attr_le16 ( idVendor  ,
"%04x\n"   
)

Definition at line 551 of file sysfs.c.

usb_intf_assoc_attr ( bFirstInterface  ,
"%02x\n"   
)

Definition at line 799 of file sysfs.c.

void usb_remove_sysfs_dev_files ( struct usb_device *  udev)

Definition at line 777 of file sysfs.c.

void usb_remove_sysfs_intf_files ( struct usb_interface intf)

Definition at line 951 of file sysfs.c.

usb_string_attr ( product  )
usb_string_attr ( manufacturer  )
usb_string_attr ( serial  )

Variable Documentation

struct attribute_group* usb_device_groups[]
Initial value:
= {
&dev_attr_grp,
&dev_string_attr_grp,
}

Definition at line 702 of file sysfs.c.

struct attribute_group* usb_interface_groups[]
Initial value:
= {
&intf_attr_grp,
&intf_assoc_attr_grp,
}

Definition at line 930 of file sysfs.c.