The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Venkata Swamy Kassa <venkatswamy7@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Venkata Swamy Kassa <venkata.swamy.kassa@hexagon.com>,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH] usb: typec: hd3ss3220: Add sysfs attribute for USB role state
Date: Mon, 2 Mar 2026 12:35:33 +0200	[thread overview]
Message-ID: <f3b17482-0358-443b-a8f1-1da3d3b2a4b9@linux.intel.com> (raw)
In-Reply-To: <20260227182454.761925-1-venkata.swamy.kassa@hexagon.com>

> The HD3SS3220 driver correctly detects USB Type-C cable attach/detach
> events and propagates the role to the USB controller. However, there is
> no way for userspace to query the current role state (device/host/none).
> 
> This becomes problematic when using udev rules to trigger scripts on
> role changes. The driver generates kobject change events, but the event
> itself doesn't contain the role information. Userspace needs to read
> the current state to determine the appropriate action.
> 
> Add a 'usb_role' sysfs attribute that exposes the current USB role as
> a string ("device", "host", or "none"). Also ensure sysfs_notify() and
> kobject_uevent() are called when the role changes, enabling userspace
> applications to poll() on the sysfs file or receive udev events.
> 
> This is useful for systems that need to:
> - Start/stop USB gadget functions based on cable connection
> - Switch between host and device modes dynamically
> - Monitor USB Type-C port state from userspace
You use the "data_role" sysfs attribute file for this.

--
heikki

  parent reply	other threads:[~2026-03-02 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 18:24 [PATCH] usb: typec: hd3ss3220: Add sysfs attribute for USB role state Venkata Swamy Kassa
2026-02-27 20:26 ` Greg KH
2026-03-02 10:35 ` Heikki Krogerus [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-02-27 18:23 Venkata Swamy Kassa

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=f3b17482-0358-443b-a8f1-1da3d3b2a4b9@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=venkata.swamy.kassa@hexagon.com \
    --cc=venkatswamy7@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