हमारा सुझाव है कि 27 मार्च, 2025 से AOSP को बनाने और उसमें योगदान देने के लिए, aosp-main
के बजाय android-latest-release
का इस्तेमाल करें. ज़्यादा जानकारी के लिए, AOSP में हुए बदलाव लेख पढ़ें.
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
hw_module_t स्ट्रक्चर का रेफ़रंस
#include <
hardware.h
>
हर हार्डवेयर मॉड्यूल में, HAL_MODULE_INFO_SYM नाम का डेटा स्ट्रक्चर होना चाहिए. साथ ही, इस डेटा स्ट्रक्चर के फ़ील्ड,
hw_module_t
से शुरू होने चाहिए. इसके बाद, मॉड्यूल की खास जानकारी होनी चाहिए.
परिभाषा,
hardware.h
फ़ाइल की लाइन
86
पर दी गई है.
मॉड्यूल का लेखक/मालिक/इंप्लिकेटर
परिभाषा,
hardware.h
फ़ाइल की लाइन
139
पर दी गई है.
मॉड्यूल का डीएसओ
परिभाषा,
hardware.h
फ़ाइल की लाइन
145
पर दी गई है
.
सोर्स कोड के साथ कुछ समय के लिए काम करने के लिए, version_major/version_minor की वैल्यू यहां दी गई हैं. इन्हें अगले वर्शन में हटा दिया जाएगा. सभी क्लाइंट को नए वर्शन के फ़ॉर्मैट में बदलना होगा. एचएएल मॉड्यूल इंटरफ़ेस का एपीआई वर्शन. इसका मतलब है कि
hw_module_t
,
hw_module_methods_t
, और
hw_device_t
के स्ट्रक्चर और डेफ़िनिशन का वर्शन तय करना है.
इस फ़ील्ड का मालिकाना हक, HAL इंटरफ़ेस के पास है. मॉड्यूल के उपयोगकर्ताओं/इंप्लिकेशन को वर्शन की जानकारी के लिए, इस वैल्यू पर भरोसा नहीं करना चाहिए.
फ़िलहाल, सिर्फ़ 0 वैल्यू मान्य है.
परिभाषा,
hardware.h
फ़ाइल की लाइन
129
पर दी गई है.
मॉड्यूल का आइडेंटिफ़ायर
परिभाषा,
hardware.h
फ़ाइल की पंक्ति
133
पर दी गई है.
मॉड्यूल के तरीके
परिभाषा,
hardware.h
फ़ाइल की लाइन
142
पर दी गई है.
uint16_t module_api_version
|
लागू किए गए मॉड्यूल का एपीआई वर्शन. मॉड्यूल के इंटरफ़ेस में बदलाव होने पर, मॉड्यूल के मालिक को वर्शन अपडेट करना होता है.
gralloc और ऑडियो जैसे मॉड्यूल के पास इस फ़ील्ड का मालिकाना हक होता है और वे इसे मैनेज करते हैं. मॉड्यूल के उपयोगकर्ता को वर्शन फ़ील्ड का मतलब समझना होगा, ताकि यह तय किया जा सके कि दिए गए मॉड्यूल को लागू करना है या नहीं. उदाहरण के लिए, SurfaceFlinger यह पक्का करता है कि उसे gralloc-module API के अलग-अलग वर्शन मैनेज करने का तरीका पता हो. साथ ही, AudioFlinger को यह पता होना चाहिए कि audio-module API के लिए भी ऐसा कैसे किया जा सकता है.
मॉड्यूल एपीआई वर्शन में एक मेजर और एक माइनर कॉम्पोनेंट शामिल होना चाहिए. उदाहरण के लिए, वर्शन 1.0 को 0x0100 के तौर पर दिखाया जा सकता है. इस फ़ॉर्मैट से पता चलता है कि 0x0100 से 0x01ff तक के सभी वर्शन, एपीआई के साथ काम करते हैं.
आने वाले समय में, libhardware में hw_get_module_version() (या मिलता-जुलता) फ़ंक्शन उपलब्ध कराया जाएगा. यह फ़ंक्शन, काम करने वाले कम से कम/ज़्यादा से ज़्यादा वर्शन को आर्ग्युमेंट के तौर पर लेगा. साथ ही, तय की गई रेंज से बाहर के वर्शन वाले मॉड्यूल को अस्वीकार कर पाएगा.
परिभाषा,
hardware.h
फ़ाइल की लाइन
111
पर दी गई है
.
इस मॉड्यूल का नाम
परिभाषा,
hardware.h
फ़ाइल की लाइन
136
पर दी गई है.
128 बाइट तक पैडिंग, आने वाले समय में इस्तेमाल के लिए रिज़र्व है
परिभाषा,
hardware.h
फ़ाइल की लाइन
151
पर दी गई है.
tag को HARDWARE_MODULE_TAG पर शुरू किया जाना चाहिए
परिभाषा,
hardware.h
फ़ाइल की लाइन
88
पर दी गई है.
इस स्ट्रक्चर का दस्तावेज़, इस फ़ाइल से जनरेट किया गया था:
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. 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)"]]