Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Muni Sekhar <munisekharrms@gmail.com>
Cc: linux-usb@vger.kernel.org,
	kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: Seeking Assistance: Implementing USB Device Suspend/Resume in User Space Driver
Date: Mon, 13 May 2024 14:09:24 -0400	[thread overview]
Message-ID: <d1cf7350-10d3-4dd4-a93e-94aff2a5c913@rowland.harvard.edu> (raw)
In-Reply-To: <CAHhAz+jWrJBgAkZ6XmyEMdR-BT0GUmew0RqBGVsrenOVo5vcaw@mail.gmail.com>

On Mon, May 13, 2024 at 11:14:44PM +0530, Muni Sekhar wrote:
> In the context of the Linux kernel and USB devices, what are the
> similarities and differences between usbfs and sysfs?

They are totally different.  usbfs gives you direct communication with 
the various USB devices on your system.  sysfs presents interfaces for 
monitoring and controlling your entire system (including information 
about how it manages its USB devices) but doesn't provide a way to 
communicate with the devices.

> Before invoking the ioctl() system call, we need to obtain a file
> descriptor by invoking the open() system call. How do we identify the
> device node in the usbfs interface?
> For example, can you please explain how to identify the device node
> location of a Human Interface Device(shown below in lsusb -t output)
> as the first argument in the open() system call.
> 
> $ lsusb -t
> /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=uhci_hcd/2p, 12M
> /:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
>     |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/8p, 480M
> /:  Bus 003.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/4p, 480M
> /:  Bus 004.Port 001: Dev 001, Class=root_hub, Driver=ehci-pci/3p, 480M
>     |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/6p, 480M
>         |__ Port 002: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
> /:  Bus 005.Port 001: Dev 001, Class=root_hub, Driver=uhci_hcd/2p, 12M
> /:  Bus 006.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/15p, 480M
> /:  Bus 007.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p, 5000M

The Human Interface Device is Device 003 on Bus 004.  Therefore the 
device node is /dev/bus/usb/004/003.

Alan Stern

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2024-05-13 18:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 11:14 Seeking Assistance: Implementing USB Device Suspend/Resume in User Space Driver Muni Sekhar
2024-05-06 14:29 ` Alan Stern
2024-05-06 16:03   ` Muni Sekhar
2024-05-06 16:14   ` Muni Sekhar
2024-05-06 19:50     ` Alan Stern
2024-05-07 11:44       ` Muni Sekhar
2024-05-07 14:20         ` Alan Stern
2024-05-07 16:38           ` Muni Sekhar
2024-05-07 17:51             ` Alan Stern
2024-05-08  5:38               ` Muni Sekhar
2024-05-08 13:58                 ` Alan Stern
2024-05-13 17:44         ` Muni Sekhar
2024-05-13 18:09           ` Alan Stern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1cf7350-10d3-4dd4-a93e-94aff2a5c913@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=munisekharrms@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).