Windows Management Instrumentation - WMI

Définition tirée du wiki Ubuntu référencé ci-dessous : Windows Management Instrumentation (WMI) is a complex set of proprietary extensions to the Windows Driver Model that provides an OS interface to allow instrumented components to provide information and notifications. Typically we are interested in WMI if a laptop or netbook has implemented hotkey events using WMI.

https://wiki.ubuntu.com/Kernel/Reference/WMI

1 - Recherche dans dmesg

# dmesg |grep wmi
[ 2.329394] wmi: Mapper loaded
[ 2.379295] asus_wmi: ASUS WMI generic driver loaded
[ 2.380564] asus_wmi: Initialization: 0x1
[ 2.380622] asus_wmi: BIOS WMI version: 7.6
[ 2.380701] asus_wmi: SFUN value: 0xa0877
[ 2.382440] input: Asus WMI hotkeys as /devices/platform/asus-nb-wmi/input/input18
[ 2.422028] asus_wmi: Number of fans: 1

Le noyau a automatiquement chargé les modules wmi (wrapper wmi), asus_wmi et asus_nb_wmi (gestion des touches spéciales et du ventilateur)

2 - Recherche dans sysfs

La suite FWTS permet une analyse fine des erreurs wmi : voir Firmware Test Suite

Il est toutefois possible d'obtenir quelques informations directement, à partir des informations remontées par le noyau.

# find /sys -name modalias -exec cat '{}' \; |grep wmi
platform:asus-nb-wmi
wmi:C12AD361-9FA9-4C74-901F-95CB0945CF3E
wmi:921A2F40-0DC4-402D-AC18-B48444EF9ED2
wmi:0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C
wmi:E06BDE62-EE75-48F4-A583-B23E69ABF891
wmi:EF4F3564-48C8-4894-85C8-B46C26B842C0
wmi:3ADEBD0F-0C5F-46ED-AB2E-04962B4FDCBC
wmi:42848006-8886-490E-8C72-2BDCA93A8A09
wmi:05901221-D566-11D1-B2F0-00A0C9062910
wmi:F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0
wmi:97845ED0-4E6D-11DE-8A39-0800200C9A66

2 - Modules wmis

2.1 - Modules reconnus par le noyau

A partir des modalias, les noms des fichiers des modules sont fournis par :

# modinfo  $(find /sys -name modalias -exec cat {} \;) |& grep wmi: -B1
filename: /lib/mmodinfo: ERROR: Module dmi:bvnAmericanMegatrendsInc.:bvrN55SL.204:bd10/24/2012:svnASUSTeKComputerInc.:pnN55SL:pvr1.0:rvnASUSTeKComputerInc.:rnN55SL:rvr1.0:cvnASUSTeKComputerInc.:ct10:cvr1.0: not found.
modinfo: ERROR: Module wmi:C12AD361-9FA9-4C74-901F-95CB0945CF3E not found.
modinfo: ERROR: Module wmi:921A2F40-0DC4-402D-AC18-B48444EF9ED2 not found.
modinfo: ERROR: Module wmi:E06BDE62-EE75-48F4-A583-B23E69ABF891 not found.
modinfo: ERROR: Module wmi:EF4F3564-48C8-4894-85C8-B46C26B842C0 not found.
modinfo: ERROR: Module wmi:3ADEBD0F-0C5F-46ED-AB2E-04962B4FDCBC not found.
modinfo: ERROR: Module wmi:42848006-8886-490E-8C72-2BDCA93A8A09 not found.
modinfo: ERROR: Module wmi:05901221-D566-11D1-B2F0-00A0C9062910 not found.
modinfo: ERROR: Module wmi:97845ED0-4E6D-11DE-8A39-0800200C9A66 not found.
--
filename: /lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/asus-nb-wmi.ko
alias: wmi:0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C
--
filename: /lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/mxm-wmi.ko
alias: wmi:F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0

Deux WMIs seulement sont pris en compte par des modules.

Note : La suite FWTS en relève 3 wmi:05901221-D566-11D1-B2F0-00A0C9062910, pris en compte par asus-wmi

2.2 - Fonctions des modules

On peut vérifier l'effet d'un module, en chargeant / déchargeant un module, par exemple asus_nb_wmi :

# modprobe -r asus_nb_wmi && modprobe asus_nb_wmi

2.2.1 - Détection par dmesg

# dmesg tail |tail -7
[ 2830.702666] asus_wmi: ASUS WMI generic driver unloaded
[ 2840.119762] asus_wmi: ASUS WMI generic driver loaded
[ 2840.120101] asus_wmi: Initialization: 0x1
[ 2840.120132] asus_wmi: BIOS WMI version: 7.6
[ 2840.120178] asus_wmi: SFUN value: 0xa0877
[ 2840.120896] input: Asus WMI hotkeys as /devices/platform/asus-nb-wmi/input/input22
[ 2840.151310] asus_wmi: Number of fans: 1

2.2.2 - Détection par udev

# udevadm monitor -k
monitor will print the received events for:
KERNEL - the kernel uevent

KERNEL[4655.544343] remove /devices/platform/asus-nb-wmi/input/input24/event9 (input)
KERNEL[4655.564132] remove /devices/platform/asus-nb-wmi/input/input24 (input)
KERNEL[4655.564174] remove /devices/platform/asus-nb-wmi/rfkill/rfkill7 (rfkill)
KERNEL[4655.564343] remove /devices/platform/asus-nb-wmi/rfkill/rfkill8 (rfkill)
KERNEL[4655.564895] remove /devices/platform/asus-nb-wmi (platform)
KERNEL[4655.564954] remove /bus/platform/drivers/asus-nb-wmi (drivers)
KERNEL[4655.565130] remove /module/asus_nb_wmi (module)
KERNEL[4655.588532] remove /module/asus_wmi (module)
KERNEL[4655.616534] remove /module/sparse_keymap (module)
KERNEL[4655.642376] add /module/sparse_keymap (module)
KERNEL[4655.642787] add /module/asus_wmi (module)
KERNEL[4655.642972] add /module/asus_nb_wmi (module)
KERNEL[4655.643015] add /devices/platform/asus-nb-wmi (platform)
KERNEL[4655.643763] add /devices/platform/asus-nb-wmi/input/input25 (input)
KERNEL[4655.643827] add /devices/platform/asus-nb-wmi/input/input25/event9 (input)
KERNEL[4655.808371] add /devices/platform/asus-nb-wmi/hwmon/hwmon6 (hwmon)
KERNEL[4655.808926] add /devices/platform/asus-nb-wmi/rfkill/rfkill9 (rfkill)
KERNEL[4655.809181] add /devices/platform/asus-nb-wmi/rfkill/rfkill10 (rfkill)
KERNEL[4655.809958] add /bus/platform/drivers/asus-nb-wmi (drivers)

2.2.3 - Modules wmi disponibles

# find /lib/modules/$(uname -r)/kernel/drivers/platform -name *.ko | grep wmi
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/msi-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/asus-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/mxm-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/acer-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/eeepc-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/alienware-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/dell-wmi-aio.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/dell-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/hp-wmi.ko
/lib/modules/4.9.0-0.bpo.1-amd64/kernel/drivers/platform/x86/asus-nb-wmi.ko

2.2.4 - Modules wmi chargés

$ lsmod |grep wmi
asus_nb_wmi 28672 0
asus_wmi 28672 1 asus_nb_wmi
sparse_keymap 16384 1 asus_wmi
mxm_wmi 16384 0
rfkill 24576 3 asus_wmi,cfg80211
wmi 16384 2 asus_wmi,mxm_wmi
video 40960 2 asus_wmi,i915