Le 10/12/2016 à 19:01, Petter Reinholdtsen a écrit :
>> With information I found on your blog about chassis type, I think that a
>> list of suitable modalias lines would be:
>>
>> <modalias>dmi:*:ct8:*</modalias> ("Portable")
>> <modalias>dmi:*:ct9:*</modalias> ("Laptop")
>> <modalias>dmi:*:ct10:*</modalias> ("Notebook")
>
> It might make sense, but I do not know what other modalias values might
> make sense. Perhaps something besides dmi info can be used to match
> relevant hardware?Well, I took a look at laptop-detect, and here's what it does: - read /proc/pmu/info (on Macs) and check for the term "Battery" - run `dmidecode --string chassis-type` and check for "Notebook" or "Portable" (it seems to omit "Laptop", weird) - read /sys/class/power_supply/*/type and check for the term "Battery" - checks for the presence of any file in directory /proc/acpi/battery - read /proc/apm and check if the 6th field is not 0xff or 0x80, but this is said to work only if a battery is actually plugged in So, basically, it comes down to check if the system is equipped with a battery (or at least battery slot). The command "modinfo battery" says that it matches "acpi*:PNP0C0A:*". I'll add that. This way (checking the chassis type and the use of the battery kernel module), we'd basically do what laptop-detect does. I'm not sure why modinfo puts a "*" next to "acpi", though. > A goal is to only match relevant hardware, so try to keep matches as > specific as possible. That's the catch. For example, I never used an UPS and I'm not sure that the system doesn't see one as a battery. Thanks a lot for your help ! -- Raphaël Halimi
signature.asc
Description: OpenPGP digital signature

