Re: Adding a new platform driver samsung-galaxybook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Den mån 25 nov. 2024 kl 18:20 skrev Armin Wolf <W_Armin@xxxxxx>:
>
> For the LED class device: you can use led_init_data to set default_label and
> devicename (just copy the platform device name for devicename). By setting
> devname_mandatory to true the resulting led class device should have a unique
> name.
>

Thank you, this was excellent guidance as usual! I tested a few
variations and found that it is possible to match existing platform
drivers with the format of <name>::kbd_backlight and here is how this
change looks in the branch I am using to make these adjustments in:

https://github.com/joshuagrisham/samsung-galaxybook-extras/commit/20f28efed07fb04b7c5397e709bbd00772bdf4fb

As a summary I am basically setting the following:

init_data.devicename = "samsung-galaxybook";
init_data.default_label = ":kbd_backlight";
init_data.devname_mandatory = true;

This results in the name of the first added LED device to still be
"samsung-galaxybook::kbd_backlight" which also matches the pattern
that exists in basically every other currently existing x86 Platform
driver.

I "mocked" having multiple existing by temporarily removing the
unregister step and then removing and re-probing the module several
times. What happens is that the string is just appended with a rolling
number like this: samsung-galaxybook::kbd_backlight_1,
samsung-galaxybook::kbd_backlight_2, etc.

I then checked in the code of both udev and upower to ensure that
these names would still work with the features in those services, and
in both places they are looking for the existence of the string
"kbd_backlight" anywhere within the name, so it should still work with
this implementation as well.. To be sure that it does in fact work, I
forced the name to be exactly samsung-galaxybook::kbd_backlight_1 and
rebooted, and everything seemed to be working fine / automatically
within GNOME and otherwise--so far, so good, there!

I am quite pleased with this solution as it should give the originally
intended name in all existing known cases and additional names would
be added only in super weird circumstances, yet will still handle
multiple names in a graceful way.

> I am CCing the LED maintainers so they can give us some advise on how to handle
> this the best way.
>

Amazing, thank you! How does it look with the change I mentioned
here--does it seem like this is matching the desired outcome, or is
there anything that should be changed?

Thank you again!

Best,
Joshua

> [...]





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux