Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1473797

Re: [PATCH V4] leds: trigger: Introduce an USB port trigger

From Rafał Miłecki <zajec5@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH V4] leds: trigger: Introduce an USB port trigger
Date 2016-08-31 21:20 +0200
Message-ID <scjdf-6oB-1@gated-at.bofh.it> (permalink)
References <sbYBP-1MV-11@gated-at.bofh.it> <sciqR-5Th-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 31 August 2016 at 20:23, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Tue, 30 Aug 2016, Rafał Miłecki wrote:
>
>> >> As you quite often need more complex LED management, there are
>> >> triggers that were introduced in 2006 by c3bc9956ec52f ("[PATCH] LED:
>> >> add LED trigger tupport"). Some triggers are trivial and could be
>> >> implemented in userspace as well (e.g. "timer"). Some had to be
>> >> implemented in kernelspace (CPU activity, MTD activity, etc.). Having
>> >> few triggers compiled, you can assign them to LEDs at it pleases you.
>> >> Your hardware may have generic LED (not labeled) and you can
>> >> dynamically assign various triggers to it, depending e.g. on user
>> >> actions. E.g. if user (using GUI or whatever) wants to see flash
>> >> activity, your userspace script should do:
>> >> echo mtd > /sys/class/leds/foo/trigger
>> >
>> > So for example, you might want to do:
>> >
>> >         echo usb1-4 >/sys/class/leds/foo/trigger
>> >
>> > and then have the "foo" LED toggle whenever an URB was submitted or
>> > completed for a device attached to the 1-4 port.  Right?
>>
>> Not really as it won't cover some pretty common use cases. Many home
>> routers have few USB ports (2-5) and only 1 USB LED. It has to be
>> possible to assign few USB ports to a single LED (trigger). That way
>> LED should be turned on (and kept on) if there is at least 1 USB
>> device connected. You obviously can't do:
>> echo "usb1-1 usb1-2 usb2-1" > /sys/class/leds/foo/trigger
>>
>> This was already brought up by Rob (who mentioned CPU trigger) and I
>> replied him pretty much the same way in:
>> https://lkml.org/lkml/2016/7/29/38
>> (reply starts with "Anyway, the serious limitation I see").
>
> The code for a bunch of triggers must already be written.  What would
> the user do if he wanted to flash a single LED in response to both
> CPU activity and MTD activity?  If not
>
>         echo "cpu mtd" >/sys/class/leds/foo/trigger
>
> then what?

Well, it sounds like a new feature then. Shall we add an extra API
with a request function for turning LED on? It could internally count
how many requests were raised and keep LED on as long as there is at
least 1 left. I guess we should implement it in trigger "subsystem"
(if I can call it so). Does it sound like a good plan?

-- 
Rafał

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Greg KH <gregkh@linuxfoundation.org> - 2016-08-25 15:00 +0200
  Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-08-26 17:40 +0200
    Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Greg KH <gregkh@linuxfoundation.org> - 2016-08-30 14:10 +0200
      Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-08-30 22:30 +0200
        Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Alan Stern <stern@rowland.harvard.edu> - 2016-08-30 23:00 +0200
          Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-08-30 23:20 +0200
            Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Alan Stern <stern@rowland.harvard.edu> - 2016-08-31 20:30 +0200
              Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-08-31 21:20 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-09-01 07:30 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-09-01 09:30 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Alan Stern <stern@rowland.harvard.edu> - 2016-09-01 16:40 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-09-02 09:00 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Alan Stern <stern@rowland.harvard.edu> - 2016-09-02 16:40 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Jacek Anaszewski <jacek.anaszewski@gmail.com> - 2016-09-03 17:20 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Alan Stern <stern@rowland.harvard.edu> - 2016-09-03 17:20 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Jacek Anaszewski <jacek.anaszewski@gmail.com> - 2016-09-03 21:20 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Alan Stern <stern@rowland.harvard.edu> - 2016-09-04 02:30 +0200
                Re: [PATCH V4] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-09-05 11:30 +0200

csiph-web