From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754106AbcIILFH (ORCPT ); Fri, 9 Sep 2016 07:05:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59764 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753460AbcIILFE (ORCPT ); Fri, 9 Sep 2016 07:05:04 -0400 Date: Fri, 9 Sep 2016 13:05:09 +0200 From: Greg KH To: Peter Chen Cc: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Richard Purdie , Jacek Anaszewski , Felipe Balbi , linux-usb@vger.kernel.org, =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jonathan Corbet , Ezequiel Garcia , Matthias Brugger , Pavel Machek , Stephan Linz , Boris Brezillon , open list , "open list:DOCUMENTATION" , "open list:LED SUBSYSTEM" Subject: Re: [PATCH V5] leds: trigger: Introduce a USB port trigger Message-ID: <20160909110509.GB6356@kroah.com> References: <20160908160904.31719-1-zajec5@gmail.com> <20160909093440.GF15637@b29397-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160909093440.GF15637@b29397-desktop> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 09, 2016 at 05:34:40PM +0800, Peter Chen wrote: > On Thu, Sep 08, 2016 at 06:08:24PM +0200, Rafał Miłecki wrote: > > From: Rafał Miłecki > > > > This commit adds a new trigger responsible for turning on LED when USB > > device gets connected to the selected USB port. This can can useful for > > various home routers that have USB port(s) and a proper LED telling user > > a device is connected. > > > > The trigger gets its documentation file but basically it just requires > > enabling it and selecting USB ports (e.g. echo 1 > ports/usb1-1). > > > > There was a long discussion on design of this driver. Its current state > > is a result of picking them most adjustable solution as others couldn't > > handle all cases. > > > > 1) It wasn't possible for the driver to register separated trigger for > > each USB port. Some physical USB ports are handled by more than one > > controller and so by more than one USB port. E.g. USB 2.0 physical > > port may be handled by OHCI's port and EHCI's port. > > It's also not possible to assign more than 1 trigger to a single LED > > and implementing such feature would be tricky due to syncing triggers > > and sysfs conflicts with old triggers. > > > > 2) Another idea was to register trigger per USB hub. This wouldn't allow > > handling devices with multiple USB LEDs and controllers (hubs) > > controlling more than 1 physical port. It's common for hubs to have > > few ports and each may have its own LED. > > > > This final trigger is highly flexible. It allows selecting any USB ports > > for any LED. It was also modified (compared to the initial version) to > > allow choosing ports rather than having user /guess/ proper names. It > > was successfully tested on SmartRG SR400ac which has 3 USB LEDs, > > 2 physical ports and 3 controllers. > > > > Another planned feature is support for LED reacting to the USB activity. > > This can be implemented with another sysfs file for setting mode. The > > default mode wouldn't change so there won't be ABI breakage and such > > feature can be safely implemented later. > > > > It has such driver at: drivers/usb/common/led.c Ugh, I thought I had seen something like this before... Rafał, can you just use this in-kernel code instead? thanks, greg k-h