---
name: "usb_register_dev"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/usb_register_dev"
---

# usb\_register\_dev(9)

register a USB device, and ask for a minor number

## NAME

usb\_register\_dev - register a USB device, and ask for a minor number

## SYNOPSIS

**int usb\_register\_dev(struct usb\_interface \*** *intf***, struct usb\_class\_driver \*** *class\_driver***);**

## ARGUMENTS

*intf*

pointer to the usb\_interface that is being registered

*class\_driver*

pointer to the usb\_class\_driver for this device

## DESCRIPTION

This should be called by all USB drivers that use the USB major number. If CONFIG\_USB\_DYNAMIC\_MINORS is enabled, the minor number will be dynamically allocated out of the list of available ones. If it is not enabled, the minor number will be based on the next available free minor, starting at the class\_driver-\>minor\_base.

This function also creates a usb class device in the sysfs tree.

**usb\_deregister\_dev** must be called when the driver is done with the minor numbers given out by this function.

## RETURN

\-EINVAL if something bad happens with trying to register a device, and 0 on success.

## COPYRIGHT
