À partir du 27 mars 2025, nous vous recommandons d'utiliser android-latest-release
au lieu de aosp-main
pour créer et contribuer à AOSP. Pour en savoir plus, consultez la section Modifications apportées à AOSP.
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Documentation de référence sur la struct hw_module_t
#include <
hardware.h
>
Chaque module matériel doit avoir une structure de données nommée HAL_MODULE_INFO_SYM, et les champs de cette structure de données doivent commencer par
hw_module_t
suivi d'informations spécifiques au module.
Définition à la ligne
86
du fichier
hardware.h
.
Auteur/Propriétaire/Implémentateur du module
Définition à la ligne
139
du fichier
hardware.h
.
Les définitions version_major/version_minor sont fournies ici pour la compatibilité temporaire du code source. Elles seront supprimées dans la prochaine version. TOUS les clients doivent convertir leurs fichiers au nouveau format. Version de l'API de l'interface du module HAL. Il s'agit de versionner les structures et les définitions
hw_module_t
,
hw_module_methods_t
et
hw_device_t
.
L'interface HAL est propriétaire de ce champ. Les utilisateurs/implémentations du module ne doivent PAS s'appuyer sur cette valeur pour obtenir des informations sur la version.
Actuellement, 0 est la seule valeur valide.
Définition à la ligne
129
du fichier
hardware.h
.
Identifiant du module
Définition à la ligne
133
du fichier
hardware.h
.
Méthodes des modules
Définition à la ligne
142
du fichier
hardware.h
.
uint16_t module_api_version
|
Version de l'API du module implémenté. Le propriétaire du module est chargé de mettre à jour la version lorsqu'une interface de module a changé.
Les modules dérivés tels que gralloc et audio possèdent et gèrent ce champ. L'utilisateur du module doit interpréter le champ de version pour décider s'il doit ou non interagir avec l'implémentation du module fournie. Par exemple, SurfaceFlinger doit s'assurer qu'il sait gérer différentes versions de l'API gralloc-module, et AudioFlinger doit savoir faire de même pour l'API audio-module.
La version de l'API du module doit inclure un composant majeur et un composant mineur. Par exemple, la version 1.0 peut être représentée par 0x0100. Ce format implique que les versions 0x0100 à 0x01ff sont toutes compatibles avec l'API.
À l'avenir, libhardware exposera une fonction hw_get_module_version() (ou équivalente) qui prendra les versions minimales/maximales compatibles comme arguments et pourra refuser les modules dont les versions ne correspondent pas à la plage fournie.
Définition à la ligne
111
du fichier
hardware.h
.
Nom de ce module
Définition à la ligne
136
du fichier
hardware.h
.
remplissage à 128 octets, réservé pour une utilisation ultérieure
Définition à la ligne
151
du fichier
hardware.h
.
La balise doit être initialisée sur HARDWARE_MODULE_TAG.
Définition à la ligne
88
du fichier
hardware.h
.
La documentation de ce struct a été générée à partir du fichier suivant :
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/27 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/27 (UTC)."],[],[],null,["# Android Hardware Abstraction Layer: hw_module_t Struct Reference\n\nhw_module_t Struct Reference\n============================\n\n[Data Fields](#pub-attribs) \nhw_module_t Struct Reference \n\n`\n#include \u003c\n`[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)`\n\u003e\n`\n\n|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| uint32_t | [tag](/reference/hal/structhw__module__t#a1c50fcd1195659821729f52af8f3bb7d) |\n| ||\n| uint16_t | [module_api_version](/reference/hal/structhw__module__t#a5b80425dcc298281d75edaa9a8083ccb) |\n| ||\n| uint16_t | [hal_api_version](/reference/hal/structhw__module__t#ab37ccc85f1197981a04116244354874f) |\n| ||\n| const char \\* | [id](/reference/hal/structhw__module__t#aeffa2f0815ce90fecbda9aac199143db) |\n| ||\n| const char \\* | [name](/reference/hal/structhw__module__t#a8f8f80d37794cde9472343e4487ba3eb) |\n| ||\n| const char \\* | [author](/reference/hal/structhw__module__t#adc89bc26ec139d32e904360eeef3cca8) |\n| ||\n| struct [hw_module_methods_t](/reference/hal/structhw__module__methods__t) \\* | [methods](/reference/hal/structhw__module__t#ae5b7afff8f18102ffd7577cd95e0ad83) |\n| ||\n| void \\* | [dso](/reference/hal/structhw__module__t#a8586652230f2639b4ee04adaf37e8348) |\n| ||\n| uint32_t | [reserved](/reference/hal/structhw__module__t#a41d9ba252fcb951e005e4b8c3bfc6803) \\[32-7\\] |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nEvery hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with\n[hw_module_t](/reference/hal/structhw__module__t)\nfollowed by module specific information.\n\n\nDefinition at line\n[86](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\nField Documentation\n-------------------\n\n\n|---------------------|\n| const char\\* author |\n\n\nAuthor/owner/implementor of the module\n\n\nDefinition at line\n[139](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|------------|\n| void\\* dso |\n\n\nmodule's dso\n\n\nDefinition at line\n[145](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|--------------------------|\n| uint16_t hal_api_version |\n\n\nversion_major/version_minor defines are supplied here for temporary source code compatibility. They will be removed in the next version. ALL clients must convert to the new version format. The API version of the HAL module interface. This is meant to version the\n[hw_module_t](/reference/hal/structhw__module__t)\n,\n[hw_module_methods_t](/reference/hal/structhw__module__methods__t)\n, and\n[hw_device_t](/reference/hal/structhw__device__t)\nstructures and definitions.\n\n\nThe HAL interface owns this field. Module users/implementations must NOT rely on this value for version information.\n\n\nPresently, 0 is the only valid value.\n\n\nDefinition at line\n[129](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|-----------------|\n| const char\\* id |\n\n\nIdentifier of module\n\n\nDefinition at line\n[133](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|--------------------------------------------------------------------------------------|\n| struct [hw_module_methods_t](/reference/hal/structhw__module__methods__t) \\* methods |\n\n\nModules methods\n\n\nDefinition at line\n[142](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|-----------------------------|\n| uint16_t module_api_version |\n\n\nThe API version of the implemented module. The module owner is responsible for updating the version when a module interface has changed.\n\n\nThe derived modules such as gralloc and audio own and manage this field. The module user must interpret the version field to decide whether or not to inter-operate with the supplied module implementation. For example, SurfaceFlinger is responsible for making sure that it knows how to manage different versions of the gralloc-module API, and AudioFlinger must know how to do the same for audio-module API.\n\n\nThe module API version should include a major and a minor component. For example, version 1.0 could be represented as 0x0100. This format implies that versions 0x0100-0x01ff are all API-compatible.\n\n\nIn the future, libhardware will expose a hw_get_module_version() (or equivalent) function that will take minimum/maximum supported versions as arguments and would be able to reject modules with versions outside of the supplied range.\n\n\nDefinition at line\n[111](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|-------------------|\n| const char\\* name |\n\n\nName of this module\n\n\nDefinition at line\n[136](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|---------------------------|\n| uint32_t reserved\\[32-7\\] |\n\n\npadding to 128 bytes, reserved for future use\n\n\nDefinition at line\n[151](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n|--------------|\n| uint32_t tag |\n\n\ntag must be initialized to HARDWARE_MODULE_TAG\n\n\nDefinition at line\n[88](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\nof file\n[hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [hardware.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hardware.h)"]]