Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #170
Difficulty: Easy
RedHat became a subsidiary of IBM in 2019.
True or False?
Linux & Unix Commands - Search Man Pages

usb_ifnum_to_if(9) [centos man page]

USB_IFNUM_TO_IF(9)						   USB Core APIs						USB_IFNUM_TO_IF(9)

NAME
usb_ifnum_to_if - get the interface object with a given interface number SYNOPSIS
struct usb_interface * usb_ifnum_to_if(const struct usb_device * dev, unsigned ifnum); ARGUMENTS
dev the device whose current configuration is considered ifnum the desired interface DESCRIPTION
This walks the device descriptor for the currently active configuration to find the interface object with the particular interface number. Note that configuration descriptors are not required to assign interface numbers sequentially, so that it would be incorrect to assume that the first interface in that descriptor corresponds to interface zero. This routine helps device drivers avoid such mistakes. However, you should make sure that you do the right thing with any alternate settings available for this interfaces. Don't call this function unless you are bound to one of the interfaces on this device or you have locked the device! RETURN
A pointer to the interface that has ifnum as interface number, if found. NULL otherwise. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 USB_IFNUM_TO_IF(9)

Check Out this Related Man Page

STRUCT 
USB_HOST_CONF(9) Host-Side Data Types and Macro STRUCT USB_HOST_CONF(9) NAME
struct_usb_host_config - representation of a device's configuration SYNOPSIS
struct usb_host_config { struct usb_config_descriptor desc; char * string; struct usb_interface_assoc_descriptor * intf_assoc[USB_MAXIADS]; struct usb_interface * interface[USB_MAXINTERFACES]; struct usb_interface_cache * intf_cache[USB_MAXINTERFACES]; unsigned char * extra; int extralen; }; MEMBERS
desc the device's configuration descriptor. string pointer to the cached version of the iConfiguration string, if present for this configuration. intf_assoc[USB_MAXIADS] list of any interface association descriptors in this config interface[USB_MAXINTERFACES] array of pointers to usb_interface structures, one for each interface in the configuration. The number of interfaces is stored in desc.bNumInterfaces. These pointers are valid only while the the configuration is active. intf_cache[USB_MAXINTERFACES] array of pointers to usb_interface_cache structures, one for each interface in the configuration. These structures exist for the entire life of the device. extra pointer to buffer containing all extra descriptors associated with this configuration (those preceding the first interface descriptor). extralen length of the extra descriptors buffer. DESCRIPTION
USB devices may have multiple configurations, but only one can be active at any time. Each encapsulates a different operational environment; for example, a dual-speed device would have separate configurations for full-speed and high-speed operation. The number of configurations available is stored in the device descriptor as bNumConfigurations. A configuration can contain multiple interfaces. Each corresponds to a different function of the USB device, and all are available whenever the configuration is active. The USB standard says that interfaces are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot of devices get this wrong. In addition, the interface array is not guaranteed to be sorted in numerical order. Use usb_ifnum_to_if to look up an interface entry based on its number. Device drivers should not attempt to activate configurations. The choice of which configuration to install is a policy decision based on such considerations as available power, functionality provided, and the user's desires (expressed through userspace tools). However, drivers can call usb_reset_configuration to reinitialize the current configuration and all its interfaces. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 STRUCT USB_HOST_CONF(9)

Featured Tech Videos