public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Alex Hung <alex.hung@canonical.com>
Cc: Darren Hart <dvhart@infradead.org>,
	Corentin Chary <corentin.chary@gmail.com>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	acpi4asus-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][v2] asus-rbtn: new driver for asus radio button for Windows 8
Date: Tue, 30 Jun 2015 19:04:40 +0200	[thread overview]
Message-ID: <201506301904.41039@pali> (raw)
In-Reply-To: <CAJ=jquYNQ=R0K+OR538_Tm-E0sNbL6VcAvN_zc99-Z5X1WmCmA@mail.gmail.com>

[-- Attachment #1: Type: Text/Plain, Size: 5498 bytes --]

Hello, you can create new trigger and use that...

On Tuesday 30 June 2015 18:09:41 Alex Hung wrote:
> Thanks for the information, and I really appreciate it.
> 
> I took a quick look at my HP laptop and it has a led as below:
> 
> /sys/class/leds/hp::hddprotect$ cat trigger
> [none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full
> BAT0-charging-blink-full-solid usb-gadget usb-host cpu0 cpu1 cpu2
> cpu3 cpu4 cpu5 cpu6 cpu7 mmc0 rfkill1 rfkill2 rfkill8
> 
> and I learned that LED can be triggered by rfkill.  I also checked
> asus-wmi and its default_trigger is its rfkill name "asus-wlan".
> 
> ATK4001 is an independent ACPI device, and Method(HSWC) is its method
> to control LED (actually it has other functions but only LED is
> needed so far). asus-rbtn does not have anything to be triggered
> because it only translate an ACPI event to KEY_RFKILL unless a
> rfkill is created, but this wouldn't make sense that I use both
> rfkill and led when I can only use one.
> 
> The other concern is that I'd like the LED to be ORed by both WLAN
> and BT in long term.  default_trigger seems to be linked to one
> trigger.
> 
> On Tue, Jun 30, 2015 at 4:58 PM, Pali Rohár <pali.rohar@gmail.com>
> wrote:
> > Hi!
> > 
> > Ideally, try to touch led trigger configuration from userspace
> > yourself, so you will see how it works. Take some machine which
> > has some configurable led exported in /sys/class/leds/ and try to
> > set some trigger via "trigger" entry.
> > 
> > I think that default trigger for led device (from kernel) can be
> > set via "default_trigger" property in struct led_classdev. See
> > file linux/leds.h
> > 
> > On Tuesday 30 June 2015 16:38:18 Alex Hung wrote:
> >> Pali,
> >> 
> >> Thanks for comments, but will you be able to provide more details
> >> so it is more clear how this works?
> >> 
> >> On Mon, Jun 29, 2015 at 8:29 PM, Pali Rohár <pali.rohar@gmail.com>
> >> wrote:
> >> > On Friday 26 June 2015 23:24:10 Alex Hung wrote:
> >> >> On Fri, Jun 26, 2015 at 10:56 PM, Pali Rohár
> >> >> <pali.rohar@gmail.com> wrote:
> >> >> > Hi!
> >> >> > 
> >> >> > On Wednesday 24 June 2015 10:57:51 Alex Hung wrote:
> >> >> >> ASUS introduced a new approach to handle wireless hotkey
> >> >> >> since Windows 8.  When the hotkey is pressed, BIOS generates
> >> >> >> a notification 0x88 to a new ACPI device, ATK4001.  This
> >> >> >> new driver not only translates the notification to
> >> >> >> KEY_RFKILL but also toggles its LED accordingly.
> >> >> >> 
> >> >> >> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> >> >> > 
> >> >> > ...
> >> >> > 
> >> >> >> +static int asus_radio_led_set(bool blocked)
> >> >> >> +{
> >> >> >> +     acpi_status status;
> >> >> >> +     union acpi_object arg0 = { ACPI_TYPE_INTEGER };
> >> >> >> +     struct acpi_object_list args = { 1, &arg0 };
> >> >> >> +     unsigned long long output;
> >> >> >> +
> >> >> >> +     arg0.integer.value = blocked;
> >> >> >> +     status =
> >> >> >> acpi_evaluate_integer(asus_rbtn_device->handle, "HSWC", +  
> >> >> >>                                  &args, &output);
> >> >> > 
> >> >> > What is this ACPI call doing? Just set LED control? Or
> >> >> > something more?
> >> >> > 
> >> >> >> +     if (!ACPI_SUCCESS(status) || output == 0) {
> >> >> >> +             pr_err("fail to change wireless LED.\n");
> >> >> >> +             return -EINVAL;
> >> >> >> +     }
> >> >> >> +
> >> >> >> +     return 0;
> >> >> >> +}
> >> >> >> +
> >> >> >> +static int asus_rfkill_set(void *data, bool blocked)
> >> >> >> +{
> >> >> >> +     radio_led_state = blocked ? 0 : 1;
> >> >> >> +
> >> >> >> +     return asus_radio_led_set(radio_led_state);
> >> >> >> +}
> >> >> > 
> >> >> > In my opinion this is not good idea that "rfkill block" call
> >> >> > from userspace just change LED on/off state and nothing
> >> >> > more...
> >> >> > 
> >> >> > If above ACPI call just change LED, then should not be this
> >> >> > in LED subsystem instead rfkill one? Or why do you prefer to
> >> >> > use rfkill interface instead led?
> >> >> 
> >> >> It indeed controls LED only at the moment.  My intention was to
> >> >> have have everything work without the need to modify any
> >> >> userspace applications.  Current it is 1) aus-rbtn issues
> >> >> KEY_RFKILL 2) an userspace application changes rfkill states,
> >> >> and 3) both radio and LED work.  It will also work when a user
> >> >> enable/disable wireless devices on a user application which
> >> >> uses rfkill interface.
> >> >> 
> >> >> Come to think about it now, I may have to handle LED with WLAN
> >> >> and BT but I will have to find a system with both devices
> >> >> later.
> >> >> 
> >> >> I am not too familiar with userspace applications v.s. LED.  Is
> >> >> it possible to do the same (i.e. without touching userspace)?
> >> >> I think rfkill is good interface to handle whatever needs
> >> >> doing when changing wireless states, such as LED controls. 
> >> >> However, if other approach can meet the need I am happy to
> >> >> investigate.
> >> > 
> >> > There are triggers for led which automatically enable/disable
> >> > led. I think that configuring default wifi/bluetooth trigger
> >> > for that new led could work...
> >> > 
> >> > --
> >> > Pali Rohár
> >> > pali.rohar@gmail.com
> > 
> > --
> > Pali Rohár
> > pali.rohar@gmail.com

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2015-06-30 17:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  2:57 [PATCH][v2] asus-rbtn: new driver for asus radio button for Windows 8 Alex Hung
2015-06-25  4:04 ` Darren Hart
2015-06-25  6:58 ` Paul Bolle
2015-06-25 20:00   ` Darren Hart
2015-06-26 14:56 ` Pali Rohár
2015-06-26 15:24   ` Alex Hung
2015-06-29 12:29     ` Pali Rohár
2015-06-30  8:38       ` Alex Hung
2015-06-30  8:58         ` Pali Rohár
2015-06-30 16:09           ` Alex Hung
2015-06-30 17:04             ` Pali Rohár [this message]
2015-07-01 11:48             ` Pali Rohár
2015-07-02  7:10               ` Alex Hung
2015-07-03  7:25                 ` Pali Rohár
2015-07-06  1:35                   ` Alex Hung
2015-07-06 22:43                     ` Darren Hart
2015-07-07 14:25                       ` Pali Rohár
2015-07-09 20:52                         ` Darren Hart
2015-07-10  1:52                           ` Alex Hung
2015-07-12 13:02                             ` Corentin Chary
2015-06-30 16:17       ` Darren Hart

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=201506301904.41039@pali \
    --to=pali.rohar@gmail.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=alex.hung@canonical.com \
    --cc=corentin.chary@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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