Closed cdlscpmv closed 5 years ago
It is not hard to do, but it will free the user from the small nuances.
How exactly are you going to do that? Simply checking once if the files are present would be slightly incorrect: the whole device directory may be temporary absent, e.g. when the machine has just been awakened from hibernation or something. (I personally fell into this pitfall when tried to write a script to adjust some power-saving options depending on whether the laptop is on battery or not.)
Can it be absent?
Yes, my older laptop with Linux 3.10 lacked that particular file.
Simply checking once if the files are present would be slightly incorrect.
It won't incur any significant overhead if we check it every time (that is, the presence of a single file).
Yes, my older laptop with Linux 3.10 lacked that particular file.
Do you think it was caused by the old version of the kernel or by the laptop battery?
It won't incur any significant overhead if we check it every time (that is, the presence of a single file).
I definitely don’t like this. Some form of caching the results would probably be OK, but such a change certainly would not be a “simplification”.
Do you think it was caused by the old version of the kernel or by the laptop battery?
Most likely by the battery driver.
I definitely don’t like this. Some form of caching the results would probably be OK, but such a change certainly would not be a “simplification”.
One or more files are read on every invocation anyway. Adding one more file to this list doesn't make much difference.
Regarding the uevent
file, the same checking mechanism can be applied. It doesn't cost anything in the code, but simplifies the interface. Or maybe it's not worth bothering with the uevent
file at all since all that data is available in other files.
How about removing
use_props_naming_scheme
and detecting the naming scheme in the plugin itself? It is not hard to do, but it will free the user from the small nuances.Is there a particular reason not to use
uevent
? Can it be absent? If not, then maybe theno_uevent
option is unnecessary.I can come up with a pull request, but I think it is better to discuss these things.