Re: [PATCH] HID: apple: Add support for magic keyboard backlight on T2 Macs
From: Aditya Garg
Date: Wed Jul 03 2024 - 07:24:24 EST
> On 2 Jul 2024, at 4:27 AM, Orlando Chamberlain <orlandoch.dev@xxxxxxxxx> wrote:
>
>
>
>> On 2 Jul 2024, at 8:48 AM, Orlando Chamberlain <orlandoch.dev@xxxxxxxxx> wrote:
>>
>>> On 2 Jul 2024, at 4:19 AM, Aditya Garg <gargaditya08@xxxxxxxx> wrote:
>>> Apparently this patch is breaking touchbar functionality is some cases.
>>
>> I think this is because apple_magic_backlight_init will return an error when it finds the touchbar interface, but this return value is not checked, so hid-apple still binds to the touchbar backlight.
>
> We may also need to make sure hid_hw_stop is called in this case. Perhaps we can move this logic from apple_magic_backlight_init to apple_probe?
>
Thanks for your help Orlando. Sending a working and well tested version 2
>>
>> This should be fixable so I don't think we need to still have the separate driver.
>>
>>>>
>>>> static int apple_probe(struct hid_device *hdev,
>>>> const struct hid_device_id *id)
>>>> {
>>>> @@ -860,6 +940,9 @@ static int apple_probe(struct hid_device *hdev,
>>>> if (quirks & APPLE_BACKLIGHT_CTL)
>>>> apple_backlight_init(hdev);
>>>>
>>>> + if (quirks & APPLE_MAGIC_BACKLIGHT)
>>>> + apple_magic_backlight_init(hdev);
>>
>> return value isn't checked here ^, we return 0 unconditionally below.
>>
>>>> +
>>>> return 0;
>>>> }