diff options
author | Tim Kilbourn <tkilbourn@google.com> | 2015-04-06 13:49:40 -0700 |
---|---|---|
committer | Tim Kilbourn <tkilbourn@google.com> | 2015-04-16 13:21:39 -0700 |
commit | 6fa82480aeb702ca60bc20d5c8df3c4a62904e3b (patch) | |
tree | fd192f04871fa0a8848cf4b09e181001e5948d48 /modules/input/evdev/InputHost.cpp | |
parent | 7771e6c52188dae295524088e577b0db64869b17 (diff) | |
download | hardware_libhardware-6fa82480aeb702ca60bc20d5c8df3c4a62904e3b.zip hardware_libhardware-6fa82480aeb702ca60bc20d5c8df3c4a62904e3b.tar.gz hardware_libhardware-6fa82480aeb702ca60bc20d5c8df3c4a62904e3b.tar.bz2 |
Add input HAL methods for getting device properties.
A property map holds the collection of the properties for a given
device identifier. HAL modules allocate and release these property maps
to control the lifetime of the data. The host will typically open and
read the corresponding idc file on allocation, and release these
resources when it is freed.
Change-Id: Ia13ec7b7abf1a79eeed87dc744c174a37f1fb8a9
Diffstat (limited to 'modules/input/evdev/InputHost.cpp')
-rw-r--r-- | modules/input/evdev/InputHost.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/input/evdev/InputHost.cpp b/modules/input/evdev/InputHost.cpp index 0903f47..6a65fcd 100644 --- a/modules/input/evdev/InputHost.cpp +++ b/modules/input/evdev/InputHost.cpp @@ -47,6 +47,27 @@ void InputDeviceDefinition::addReport(InputReportDefinition r) { mCallbacks.input_device_definition_add_report(mHost, mDeviceDefinition, r); } +InputProperty::~InputProperty() { + mCallbacks.input_free_device_property(mHost, mProperty); +} + +const char* InputProperty::getKey() { + return mCallbacks.input_get_property_key(mHost, mProperty); +} + +const char* InputProperty::getValue() { + return mCallbacks.input_get_property_value(mHost, mProperty); +} + +InputPropertyMap::~InputPropertyMap() { + mCallbacks.input_free_device_property_map(mHost, mMap); +} + +InputProperty InputPropertyMap::getDeviceProperty(const char* key) { + return InputProperty(mHost, mCallbacks, + mCallbacks.input_get_device_property(mHost, mMap, key)); +} + InputDeviceIdentifier InputHost::createDeviceIdentifier(const char* name, int32_t productId, int32_t vendorId, InputBus bus, const char* uniqueId) { return mCallbacks.create_device_identifier(mHost, name, productId, vendorId, bus, uniqueId); @@ -75,4 +96,9 @@ void InputHost::unregisterDevice(InputDeviceHandle handle) { return mCallbacks.unregister_device(mHost, handle); } +InputPropertyMap InputHost::getDevicePropertyMap(InputDeviceIdentifier id) { + return InputPropertyMap(mHost, mCallbacks, + mCallbacks.input_get_device_property_map(mHost, id)); +} + } // namespace android |