On 22/10/2015 10:51, Pali Rohár wrote:
On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem,
dell-laptop can detect the presence of an hardware switch.

dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or
toggle key.

And rfkill implementation in dell-laptop.ko does not work correctly on
XPS machines. And because userspace implementation of smbios works fine,
I think that problem is in kernel driver rather in BIOS/firmware...

I was thinking about something such as the following, which should favor
the hardware slider when available. This should work if my assumption is
correct, that is the laptops with a working RBTN method are the ones
having problems.

diff --git a/drivers/platform/x86/dell-rbtn.c b/drivers/platform/x86/dell-rbtn.c
index cd410e3..cf3c11c 100644
--- a/drivers/platform/x86/dell-rbtn.c
+++ b/drivers/platform/x86/dell-rbtn.c
@@ -321,6 +321,7 @@ static int rbtn_add(struct acpi_device *device)
        struct rbtn_data *rbtn_data;
        enum rbtn_type type;
        int ret = 0;
+       bool has_hardware_slider; /* get this with SMI */

        type = rbtn_check(device);
        if (type == RBTN_UNKNOWN) {
@@ -328,7 +329,7 @@ static int rbtn_add(struct acpi_device *device)
                return -EINVAL;
        }

-       ret = rbtn_acquire(device, true);
+       ret = rbtn_acquire(device, !has_hardware_slider);
        if (ret < 0) {
                dev_err(&device->dev, "Cannot enable device\n");
                return ret;
@@ -343,7 +344,10 @@ static int rbtn_add(struct acpi_device *device)

        switch (rbtn_data->type) {
        case RBTN_TOGGLE:
-               ret = rbtn_input_init(rbtn_data);
+               if (has_hardware_slider)
+                       ret = 0;
+               else
+                       ret = rbtn_input_init(rbtn_data);
                break;
        case RBTN_SLIDER:
                if (auto_remove_rfkill && rbtn_chain_head.head)
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to