diff options
Diffstat (limited to 'light/2.0/default/Light.cpp')
-rw-r--r-- | light/2.0/default/Light.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/light/2.0/default/Light.cpp b/light/2.0/default/Light.cpp index cde15366..5484d2db 100644 --- a/light/2.0/default/Light.cpp +++ b/light/2.0/default/Light.cpp | |||
@@ -18,6 +18,8 @@ | |||
18 | 18 | ||
19 | #include <log/log.h> | 19 | #include <log/log.h> |
20 | 20 | ||
21 | #include <stdio.h> | ||
22 | |||
21 | #include "Light.h" | 23 | #include "Light.h" |
22 | 24 | ||
23 | namespace android { | 25 | namespace android { |
@@ -107,6 +109,28 @@ const static std::map<Type, const char*> kLogicalLights = { | |||
107 | {Type::WIFI, LIGHT_ID_WIFI} | 109 | {Type::WIFI, LIGHT_ID_WIFI} |
108 | }; | 110 | }; |
109 | 111 | ||
112 | Return<void> Light::debug(const hidl_handle& handle, const hidl_vec<hidl_string>& /* options */) { | ||
113 | if (handle == nullptr || handle->numFds < 1) { | ||
114 | ALOGE("debug called with no handle\n"); | ||
115 | return Void(); | ||
116 | } | ||
117 | |||
118 | int fd = handle->data[0]; | ||
119 | if (fd < 0) { | ||
120 | ALOGE("invalid FD: %d\n", handle->data[0]); | ||
121 | return Void(); | ||
122 | } | ||
123 | |||
124 | dprintf(fd, "The following lights are registered: "); | ||
125 | for (auto const& pair : mLights) { | ||
126 | const Type type = pair.first; | ||
127 | dprintf(fd, "%s,", kLogicalLights.at(type)); | ||
128 | } | ||
129 | dprintf(fd, ".\n"); | ||
130 | fsync(fd); | ||
131 | return Void(); | ||
132 | } | ||
133 | |||
110 | light_device_t* getLightDevice(const char* name) { | 134 | light_device_t* getLightDevice(const char* name) { |
111 | light_device_t* lightDevice; | 135 | light_device_t* lightDevice; |
112 | const hw_module_t* hwModule = NULL; | 136 | const hw_module_t* hwModule = NULL; |