From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH RFC V3.5] leds: trigger: Introduce an USB port trigger Date: Mon, 29 Aug 2016 10:41:27 +0200 Message-ID: <20160829084127.GA10529@amd> References: <57BF3D64.3090402@gmail.com> <25cdf5e1-c3b5-e8a3-8213-f35a6f6160c2@samsung.com> <20160829080551.GA7987@amd> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:55697 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750860AbcH2Ilb (ORCPT ); Mon, 29 Aug 2016 04:41:31 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-leds-owner@vger.kernel.org List-Id: linux-leds@vger.kernel.org To: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= Cc: Jacek Anaszewski , Jacek Anaszewski , Alan Stern , Richard Purdie , Felipe Balbi , Greg KH , Peter Chen , "linux-usb@vger.kernel.org" , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jonathan Corbet , Ezequiel Garcia , Stephan Linz , Matthias Brugger , Boris Brezillon , Geert Uytterhoeven , "open list:DOCUMENTATION" , open list "open list:LED SUBSYSTEM" On Mon 2016-08-29 10:21:48, Rafał Miłecki wrote: > On 29 August 2016 at 10:05, Pavel Machek wrote: > >> >2) Having "ports" subdir with RW files, one per each existing physical port > >> >In this situation we don't need "new_port" or "remove_port". If we > >> >want port to be observable we just do: > >> >echo 1 > 1-1 > >> >Implementing this solution needs reading more details from USB subsystem. > >> > >> The situation here is clear IMO - the number of USB ports in the system > >> can change dynamically. I'm not sure if this can be handled easily with > >> sysfs, where we usually expose an interface for known set of settings. > >> struct attribute arrays are usually defined statically at the compile > >> time and filled with the variables, that are created with DEVICE_ATTR > >> macro. > > > > sysfs already exposes current view of all usb devices. Just use it. > > We're talking about USB ports not devices, but this is still true. You > can find them in > /sys/bus/usb/devices/*/*-port* > > I can't see how we could use them. How could I develop sysfs interface > in /sys/class/leds/*/ to allow userspace assigning USB ports to the > LED trigger? Create /sys/bus/usb/devices/*/*-port*/led_trigger file? (Do you plan one USB trigger, or multiple ones?) Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html