Linux usb device filesystem

USB Device Filesystem

The USB device filesystem is a dynamically generated filesystem, similar to the /proc filesystem. This filesystem can be mounted just about anywhere, however it is customarily mounted on /proc/bus/usb , which is an entry node created by the USB code, intended to be used as a mount point for this system. Mounting in other locations may break user space utilities, but should not affect the kernel support.

You need to select «Preliminary USB Device Filesystem» to make this work. You also need to enable general /proc support, and to have it mounted (normally automatic).

To mount the filesystem, you need to be root. Use the mount command: mount -t usbdevfs none /proc/bus/usb . Note that the none keyword is arbitrary — you can use anything, and some people prefer to use usbdevfs , as it makes the mount output look better.

If you do not want to have to mount the filesystem each time you reboot the system, you can add the following to /etc/fstab after the /proc entry:

none /proc/bus/usb usbdevfs defaults 0 0

This has the same effect as the mount command.

After you have mounted the filesystem, the contents of /proc/bus/usb should look something like:

dr-xr-xr-x 1 root root 0 Jan 26 10:40 001 -r—r—r— 1 root root 0 Jan 26 10:40 devices -r—r—r— 1 root root 0 Jan 26 10:40 drivers

. You may have more than one numbered directory entry if your machine has more than one universal serial bus controller.

Full interpretation of the devices and drivers files is provided later in this guide, in the user’s section. The numbered entries are machine readable, but are not usually of any use to a user.

Home Next >>>
How to get USB devices working under Linux Up USB Human Interface Device (HID) Configuration

Источник

USB Device Filesystem

The USB device filesystem is a dynamically generated filesystem, similar to the /proc filesystem. This filesystem can be mounted just about anywhere, however it is customarily mounted on /proc/bus/usb , which is an entry node created by the USB code, intended to be used as a mount point for this system. Mounting in other locations may break utilities.

You need to select «Preliminary USB Device Filesystem» to make this work. You also need to enable general /proc support, and to have it mounted (normally automatic).

To mount the filesystem, you need to be root. Use the mount command: mount -t usbdevfs none /proc/bus/usb . Note that the none keyword is arbitrary — you can use anything, and some people prefer to use usbdevfs , as it makes the mount output look better.

If you do not want to have to mount the filesystem everytime you reboot the system, you can add the following to /etc/fstab after the /proc entry:

none /proc/bus/usb usbdevfs defaults 0 0

This has the same effect as the mount command.

After you have mounted the filesystem, the contents of /proc/bus/usb should look something like:

dr-xr-xr-x 1 root root 0 Jan 26 10:40 001 -r—r—r— 1 root root 0 Jan 26 10:40 devices -r—r—r— 1 root root 0 Jan 26 10:40 drivers

. You may have more than one numbered entry if your machine has more than one universal serial bus controller.

Full interpretation of the devices and drivers files is provided later in this guide, in the user’s section. Use of the numbered entries is provided later in this guide, in the programmer’s guide.

Prev Home Next
How to get USB devices working under Linux Up USB Human Interface Device (HID) Configuration

Источник

Linux usb device filesystem

This chapter presents the Linux usbfs . You may prefer to avoid writing new kernel code for your USB driver; that’s the problem that usbfs set out to solve. User mode device drivers are usually packaged as applications or libraries, and may use usbfs through some programming library that wraps it. Such libraries include libusb for C/C++, and jUSB for Java.

Unfinished

This particular documentation is incomplete, especially with respect to the asynchronous mode. As of kernel 2.5.66 the code and this (new) documentation need to be cross-reviewed.

Configure usbfs into Linux kernels by enabling the USB filesystem option (CONFIG_USB_DEVICEFS), and you get basic support for user mode USB device drivers. Until relatively recently it was often (confusingly) called usbdevfs although it wasn’t solving what devfs was. Every USB device will appear in usbfs, regardless of whether or not it has a kernel driver.

What files are in «usbfs»?

Conventionally mounted at /proc/bus/usb , usbfs features include:

  • /proc/bus/usb/devices . a text file showing each of the USB devices on known to the kernel, and their configuration descriptors. You can also poll() this to learn about new devices.
  • /proc/bus/usb/BBB/DDD . magic files exposing the each device’s configuration descriptors, and supporting a series of ioctls for making device requests, including I/O to devices. (Purely for access by programs.)

Each bus is given a number (BBB) based on when it was enumerated; within each bus, each device is given a similar number (DDD). Those BBB/DDD paths are not «stable» identifiers; expect them to change even if you always leave the devices plugged in to the same hub port. Don’t even think of saving these in application configuration files. Stable identifiers are available, for user mode applications that want to use them. HID and networking devices expose these stable IDs, so that for example you can be sure that you told the right UPS to power down its second server. «usbfs» doesn’t (yet) expose those IDs.

Источник

What kind of FileSystem do you recommend for USB Flash Drive?

This is a problem I’m having when using Ubuntu: I have two computers that have Ubuntu installed on them (comp1 and comp2). I create a document with Ubuntu on comp1 and then copy the file onto a FAT formatted USB flash drive. Via the flash drive I paste the document onto comp2. The problem is that the file-permissions are never preserved during the transfer. I’m assuming because the FAT is not supporting the permissions. Is there a solution to this? Should I continue to use FAT file system for USB flash drives (because FAT is best for flash drives) and just live with this permissions issue? Or is it recommended to reformat my flash drive with a more «Ubuntu Friendly» file system that will preserve the permissions?

5 Answers 5

ext4 is a journalling filesystem which means that if the device is unplugged prematurely it stands more of a chance of recovering the damaged filesystem. The journal part of the write contains information about what is about to be done and it gets cleared after the operation is completed. If it is found that there is an uncompleted journal on a device when it is mounted, the filesystem can be reverted to it’s previous state thereby preserving its integrity.

While there is some extra overhead in terms of space involved in having a journalling filesystem on a USB stick, it’s actually a good choice for most things.

Obviously, if you need a device that can also plug into any computer at any time then FAT would be the way to go. If you want a device that needs to be plugged into one Windows computer only occasionally, then it’s possible to install ext2 device drivers in Windows that will allow it to read any and all ext(x) drives. Of course, since Windows doesn’t know about Linux permissions and ownership these will not be handled as well.

Источник

Читайте также:  Zip and tar in linux
Оцените статью
Adblock
detector