Welcome to the Linux Foundation Forum!

USB Linux API: call ioctl requests from user space app

I want to create Linux app responsible to get/set some usb settings especially settings responsible of followings:

  1. USB ports
  2.  
  3. USB Host controller and USB driver
  4.  
  5. USB devices

I followed the linux api document: https://www.kernel.org/doc/html/v4.14/driver-api/usb/usb.html I found that it can be done through ioctl I found a list of ioctl requests, for example USBDEVFS_GETDRIVER.

I found that if I want a first small test it can be like that:

  1. struct usbdevfs_getdriver usbdriver;
  2. int fd = open("device_file_name", O_RDWR);
  3. ioctl(fd, USBDEVFS_GETDRIVER, (struct usbdevfs_getdriver*) &usbdriver);

So my question is: is that the right way? What should be the device_file_name in the second line of my code?

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training