החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
hw_module_t Struct Reference
#include <
hardware.h
>
לכל מודול חומרה צריך להיות מבנה נתונים בשם HAL_MODULE_INFO_SYM, והשדות של מבנה הנתונים הזה צריכים להתחיל ב-
hw_module_t
ולאחר מכן במידע ספציפי למודול.
ההגדרה מופיעה בשורה
86
בקובץ
hardware.h
.
המחבר/הבעלים/המפתח של המודול
ההגדרה מופיעה בשורה
139
בקובץ
hardware.h
.
ההגדרות version_major/version_minor מוצגות כאן לצורך תאימות זמנית של קוד המקור. הם יוסרו בגרסה הבאה. כל הלקוחות חייבים להמיר את הפורמט לגרסה החדשה. גרסת ה-API של ממשק המודול HAL. המטרה של האפשרות הזו היא לשייך גרסה למבנים ולהגדרות של
hw_module_t
,
hw_module_methods_t
ו-
hw_device_t
.
השדה הזה בבעלות ממשק HAL. משתמשים/הטמעות של המודול לא יכולים להסתמך על הערך הזה למידע על הגרסה.
בשלב זה, 0 הוא הערך החוקי היחיד.
ההגדרה מופיעה בשורה
129
בקובץ
hardware.h
.
uint16_t module_api_version
|
גרסת ה-API של המודול שהוטמע. בעלי המודול אחראים לעדכן את הגרסה כשממשק המודול השתנה.
המודולים המשניים, כמו gralloc ו-audio, הם הבעלים של השדה הזה ומנהלים אותו. משתמש המודול צריך לפרש את שדה הגרסה כדי להחליט אם לבצע פעולות משותפות עם הטמעת המודול שסופקה או לא. לדוגמה, SurfaceFlinger אחראי לוודא שהוא יודע לנהל גרסאות שונות של gralloc-module API, ו-AudioFlinger חייב לדעת לעשות את אותו הדבר עבור audio-module API.
גרסת ה-API של המודול צריכה לכלול רכיב ראשי ורכיב משני. לדוגמה, גרסת 1.0 יכולה להיות מיוצגת כ-0x0100. הפורמט הזה מרמז שכל הגרסאות 0x0100-0x01ff תואמות ל-API.
בעתיד, libhardware תציג את הפונקציה hw_get_module_version() (או פונקציה מקבילה) שתקבל גרסאות מינימליות/מקסימליות נתמכות כארגומנטים, ותוכל לדחות מודולים עם גרסאות מחוץ לטווח שסופק.
ההגדרה מופיעה בשורה
111
בקובץ
hardware.h
.
מילוי עד 128 בייטים, שמור לשימוש עתידי
ההגדרה מופיעה בשורה
151
בקובץ
hardware.h
.
צריך לאתחל את התג לערך HARDWARE_MODULE_TAG
ההגדרה מופיעה בשורה
88
בקובץ
hardware.h
.
התיעוד של המבנה הזה נוצר מהקובץ הבא:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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)"]]