Merge "Use structured format for verity metadata"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 7f9536e..b3661e4 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -55,3 +55,4 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/lmkd_intermediates/import_includes)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libsysutils_intermediates/import_includes)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/grep $(PRODUCT_OUT)/system/bin/toolbox)
diff --git a/base/Android.mk b/base/Android.mk
index 162c6cb..7bd317b 100644
--- a/base/Android.mk
+++ b/base/Android.mk
@@ -44,6 +44,7 @@
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CPPFLAGS := $(libbase_cppflags)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_STATIC_LIBRARIES := libcutils
LOCAL_MULTILIB := both
include $(BUILD_STATIC_LIBRARY)
@@ -53,6 +54,7 @@
LOCAL_WHOLE_STATIC_LIBRARIES := libbase
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_MULTILIB := both
include $(BUILD_SHARED_LIBRARY)
@@ -64,6 +66,7 @@
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CPPFLAGS := $(libbase_cppflags)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_STATIC_LIBRARIES := libcutils
LOCAL_MULTILIB := both
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -72,6 +75,7 @@
LOCAL_WHOLE_STATIC_LIBRARIES := libbase
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_STATIC_LIBRARIES := libcutils
LOCAL_MULTILIB := both
include $(BUILD_HOST_SHARED_LIBRARY)
diff --git a/base/include/base/strings.h b/base/include/base/strings.h
index 5ddfbbd..ab56aad 100644
--- a/base/include/base/strings.h
+++ b/base/include/base/strings.h
@@ -23,10 +23,15 @@
namespace android {
namespace base {
-// Splits a string using the given separator character into a vector of strings.
-// Empty strings will be omitted.
-void Split(const std::string& s, char separator,
- std::vector<std::string>* result);
+// Splits a string into a vector of strings.
+//
+// The string is split at each occurence of a character in delimiters.
+//
+// Empty splits will be omitted. I.e. Split("a,,b", ",") -> {"a", "b"}
+//
+// The empty string is not a valid delimiter list.
+std::vector<std::string> Split(const std::string& s,
+ const std::string& delimiters);
// Trims whitespace off both ends of the given string.
std::string Trim(const std::string& s);
diff --git a/base/logging.cpp b/base/logging.cpp
index 3d6c0c2..8bfb204 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -23,6 +23,7 @@
#include <vector>
#include "base/strings.h"
+#include "cutils/threads.h"
// Headers for LogMessage::LogLine.
#ifdef __ANDROID__
@@ -33,15 +34,6 @@
#include <unistd.h>
#endif
-// For GetTid.
-#if defined(__APPLE__)
-#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED
-#include <sys/syscall.h>
-#include <sys/time.h>
-#elif !defined(__BIONIC__)
-#include <syscall.h>
-#endif
-
namespace android {
namespace base {
@@ -52,19 +44,6 @@
static std::unique_ptr<std::string> gProgramInvocationName;
static std::unique_ptr<std::string> gProgramInvocationShortName;
-#ifndef __ANDROID__
-static pid_t GetTid() {
-#if defined(__APPLE__)
- uint64_t owner;
- // Requires Mac OS 10.6
- CHECK_PTHREAD_CALL(pthread_threadid_np, (NULL, &owner), __FUNCTION__);
- return owner;
-#else
- return syscall(__NR_gettid);
-#endif
-}
-#endif // __ANDROID__
-
const char* GetCmdLine() {
return (gCmdLine.get() != nullptr) ? gCmdLine->c_str() : nullptr;
}
@@ -108,8 +87,7 @@
return;
}
- std::vector<std::string> specs;
- Split(tags, ' ', &specs);
+ std::vector<std::string> specs = Split(tags, " ");
for (size_t i = 0; i < specs.size(); ++i) {
// "tag-pattern:[vdiwefs]"
std::string spec(specs[i]);
@@ -262,7 +240,7 @@
CHECK_EQ(strlen(log_characters), FATAL + 1U);
char severity = log_characters[log_severity];
fprintf(stderr, "%s %c %5d %5d %s:%u] %s\n", ProgramInvocationShortName(),
- severity, getpid(), GetTid(), file, line, message);
+ severity, getpid(), gettid(), file, line, message);
#endif
}
diff --git a/base/strings.cpp b/base/strings.cpp
index 224a46f..5f7eccc 100644
--- a/base/strings.cpp
+++ b/base/strings.cpp
@@ -16,27 +16,39 @@
#include "base/strings.h"
+#include <stdlib.h>
+
#include <string>
#include <vector>
namespace android {
namespace base {
-void Split(const std::string& s, char separator,
- std::vector<std::string>* result) {
- const char* p = s.data();
- const char* end = p + s.size();
- while (p != end) {
- if (*p == separator) {
- ++p;
- } else {
- const char* start = p;
- while (++p != end && *p != separator) {
- // Skip to the next occurrence of the separator.
- }
- result->push_back(std::string(start, p - start));
- }
+#define CHECK_NE(a, b) \
+ if ((a) == (b)) abort();
+
+std::vector<std::string> Split(const std::string& s,
+ const std::string& delimiters) {
+ CHECK_NE(delimiters.size(), 0U);
+
+ std::vector<std::string> split;
+ if (s.size() == 0) {
+ // Split("", d) returns {} rather than {""}.
+ return split;
}
+
+ size_t base = 0;
+ size_t found;
+ do {
+ found = s.find_first_of(delimiters, base);
+ if (found != base) {
+ split.push_back(s.substr(base, found - base));
+ }
+
+ base = found + 1;
+ } while (found != s.npos);
+
+ return split;
}
std::string Trim(const std::string& s) {
diff --git a/base/strings_test.cpp b/base/strings_test.cpp
index 824598d..1bf07a1 100644
--- a/base/strings_test.cpp
+++ b/base/strings_test.cpp
@@ -22,21 +22,18 @@
#include <vector>
TEST(strings, split_empty) {
- std::vector<std::string> parts;
- android::base::Split("", '\0', &parts);
+ std::vector<std::string> parts = android::base::Split("", ",");
ASSERT_EQ(0U, parts.size());
}
TEST(strings, split_single) {
- std::vector<std::string> parts;
- android::base::Split("foo", ',', &parts);
+ std::vector<std::string> parts = android::base::Split("foo", ",");
ASSERT_EQ(1U, parts.size());
ASSERT_EQ("foo", parts[0]);
}
TEST(strings, split_simple) {
- std::vector<std::string> parts;
- android::base::Split("foo,bar,baz", ',', &parts);
+ std::vector<std::string> parts = android::base::Split("foo,bar,baz", ",");
ASSERT_EQ(3U, parts.size());
ASSERT_EQ("foo", parts[0]);
ASSERT_EQ("bar", parts[1]);
@@ -44,8 +41,30 @@
}
TEST(strings, split_with_empty_part) {
- std::vector<std::string> parts;
- android::base::Split("foo,,bar", ',', &parts);
+ std::vector<std::string> parts = android::base::Split("foo,,bar", ",");
+ ASSERT_EQ(2U, parts.size());
+ ASSERT_EQ("foo", parts[0]);
+ ASSERT_EQ("bar", parts[1]);
+}
+
+TEST(strings, split_null_char) {
+ std::vector<std::string> parts =
+ android::base::Split(std::string("foo\0bar", 7), std::string("\0", 1));
+ ASSERT_EQ(2U, parts.size());
+ ASSERT_EQ("foo", parts[0]);
+ ASSERT_EQ("bar", parts[1]);
+}
+
+TEST(strings, split_any) {
+ std::vector<std::string> parts = android::base::Split("foo:bar,baz", ",:");
+ ASSERT_EQ(3U, parts.size());
+ ASSERT_EQ("foo", parts[0]);
+ ASSERT_EQ("bar", parts[1]);
+ ASSERT_EQ("baz", parts[2]);
+}
+
+TEST(strings, split_any_with_empty_part) {
+ std::vector<std::string> parts = android::base::Split("foo:,bar", ",:");
ASSERT_EQ(2U, parts.size());
ASSERT_EQ("foo", parts[0]);
ASSERT_EQ("bar", parts[1]);
diff --git a/include/cutils/threads.h b/include/cutils/threads.h
index ade9a0c..3133cdb 100644
--- a/include/cutils/threads.h
+++ b/include/cutils/threads.h
@@ -32,14 +32,16 @@
#if !defined(_WIN32)
#include <pthread.h>
+#include <sys/types.h>
typedef struct {
pthread_mutex_t lock;
int has_tls;
pthread_key_t tls;
-
} thread_store_t;
+extern pid_t gettid();
+
#define THREAD_STORE_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0 }
#else // !defined(_WIN32)
@@ -51,7 +53,6 @@
int has_tls;
DWORD tls;
CRITICAL_SECTION lock;
-
} thread_store_t;
#define THREAD_STORE_INITIALIZER { 0, 0, 0, {0, 0, 0, 0, 0, 0} }
diff --git a/include/zipfile/zipfile.h b/include/zipfile/zipfile.h
deleted file mode 100644
index 0ae4ee4..0000000
--- a/include/zipfile/zipfile.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ZIPFILE_ZIPFILE_H
-#define _ZIPFILE_ZIPFILE_H
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void* zipfile_t;
-typedef void* zipentry_t;
-
-// Provide a buffer. Returns NULL on failure.
-zipfile_t init_zipfile(const void* data, size_t size);
-
-// Release the zipfile resources.
-void release_zipfile(zipfile_t file);
-
-// Get a named entry object. Returns NULL if it doesn't exist
-// or if we won't be able to decompress it. The zipentry_t is
-// freed by release_zipfile()
-zipentry_t lookup_zipentry(zipfile_t file, const char* entryName);
-
-// Return the size of the entry.
-size_t get_zipentry_size(zipentry_t entry);
-
-// return the filename of this entry, you own the memory returned
-char* get_zipentry_name(zipentry_t entry);
-
-// The buffer must be 1.001 times the buffer size returned
-// by get_zipentry_size. Returns nonzero on failure.
-int decompress_zipentry(zipentry_t entry, void* buf, int bufsize);
-
-// iterate through the entries in the zip file. pass a pointer to
-// a void* initialized to NULL to start. Returns NULL when done
-zipentry_t iterate_zipfile(zipfile_t file, void** cookie);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _ZIPFILE_ZIPFILE_H
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index 7db203f..57eb299 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -118,6 +118,7 @@
switch (*s++) {
case 'b':
if (!strcmp(s, "ootchart_init")) return K_bootchart_init;
+ break;
case 'c':
if (!strcmp(s, "opy")) return K_copy;
if (!strcmp(s, "apability")) return K_capability;
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 0e03a1d..363b377 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -250,7 +250,7 @@
int property_set(const char* name, const char* value) {
int rc = property_set_impl(name, value);
if (rc == -1) {
- ERROR("property_set(\"%s\", \"%s\" failed\n", name, value);
+ ERROR("property_set(\"%s\", \"%s\") failed\n", name, value);
}
return rc;
}
diff --git a/libcutils/Android.mk b/libcutils/Android.mk
index 2c5e351..d890319 100644
--- a/libcutils/Android.mk
+++ b/libcutils/Android.mk
@@ -64,7 +64,7 @@
endif
-# Static library for host
+# Shared and static library for host
# ========================================================
LOCAL_MODULE := libcutils
LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
@@ -76,6 +76,16 @@
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_HOST_STATIC_LIBRARY)
+include $(CLEAR_VARS)
+LOCAL_MODULE := libcutils
+LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
+LOCAL_SHARED_LIBRARIES := liblog
+ifneq ($(HOST_OS),windows)
+LOCAL_CFLAGS += -Werror
+endif
+LOCAL_MULTILIB := both
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+include $(BUILD_HOST_SHARED_LIBRARY)
# Tests for host
# ========================================================
diff --git a/libcutils/threads.c b/libcutils/threads.c
index ca600b3..5f5577b 100644
--- a/libcutils/threads.c
+++ b/libcutils/threads.c
@@ -14,9 +14,25 @@
** limitations under the License.
*/
-#include <cutils/threads.h>
+#include "cutils/threads.h"
#if !defined(_WIN32)
+
+// For gettid.
+#if defined(__APPLE__)
+#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <sys/time.h>
+#include <unistd.h>
+#elif defined(__linux__) && !defined(__ANDROID__)
+#include <syscall.h>
+#include <unistd.h>
+#elif defined(_WIN32)
+#include <Windows.h>
+#endif
+
void* thread_store_get( thread_store_t* store )
{
if (!store->has_tls)
@@ -42,6 +58,24 @@
pthread_setspecific( store->tls, value );
}
+// No definition needed for Android because we'll just pick up bionic's copy.
+#ifndef __ANDROID__
+pid_t gettid() {
+#if defined(__APPLE__)
+ uint64_t owner;
+ int rc = pthread_threadid_np(NULL, &owner);
+ if (rc != 0) {
+ abort();
+ }
+ return owner;
+#elif defined(__linux__)
+ return syscall(__NR_gettid);
+#elif defined(_WIN32)
+ return (pid_t)GetCurrentThreadId();
+#endif
+}
+#endif // __ANDROID__
+
#else /* !defined(_WIN32) */
void* thread_store_get( thread_store_t* store )
{
diff --git a/liblog/logd_write.c b/liblog/logd_write.c
index 8f8cc3f..dfe34d1 100644
--- a/liblog/logd_write.c
+++ b/liblog/logd_write.c
@@ -90,15 +90,6 @@
return (g_log_status == kLogAvailable);
}
-#if !FAKE_LOG_DEVICE
-/* give up, resources too limited */
-static int __write_to_log_null(log_id_t log_fd __unused, struct iovec *vec __unused,
- size_t nr __unused)
-{
- return -1;
-}
-#endif
-
/* log_init_lock assumed */
static int __write_to_log_initialize()
{
@@ -111,40 +102,32 @@
log_fds[i] = fakeLogOpen(buf, O_WRONLY);
}
#else
- if (logd_fd >= 0) {
- i = logd_fd;
- logd_fd = -1;
- close(i);
+ if (pstore_fd < 0) {
+ pstore_fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY));
}
- if (pstore_fd >= 0) {
- i = pstore_fd;
- pstore_fd = -1;
- close(i);
- }
- pstore_fd = open("/dev/pmsg0", O_WRONLY);
- i = socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
- if (i < 0) {
- ret = -errno;
- write_to_log = __write_to_log_null;
- } else if (fcntl(i, F_SETFL, O_NONBLOCK) < 0) {
- ret = -errno;
- close(i);
- i = -1;
- write_to_log = __write_to_log_null;
- } else {
- struct sockaddr_un un;
- memset(&un, 0, sizeof(struct sockaddr_un));
- un.sun_family = AF_UNIX;
- strcpy(un.sun_path, "/dev/socket/logdw");
-
- if (connect(i, (struct sockaddr *)&un, sizeof(struct sockaddr_un)) < 0) {
+ if (logd_fd < 0) {
+ i = TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0));
+ if (i < 0) {
+ ret = -errno;
+ } else if (TEMP_FAILURE_RETRY(fcntl(i, F_SETFL, O_NONBLOCK)) < 0) {
ret = -errno;
close(i);
- i = -1;
+ } else {
+ struct sockaddr_un un;
+ memset(&un, 0, sizeof(struct sockaddr_un));
+ un.sun_family = AF_UNIX;
+ strcpy(un.sun_path, "/dev/socket/logdw");
+
+ if (TEMP_FAILURE_RETRY(connect(i, (struct sockaddr *)&un,
+ sizeof(struct sockaddr_un))) < 0) {
+ ret = -errno;
+ close(i);
+ } else {
+ logd_fd = i;
+ }
}
}
- logd_fd = i;
#endif
return ret;
@@ -293,6 +276,8 @@
#if !defined(_WIN32)
pthread_mutex_lock(&log_init_lock);
#endif
+ close(logd_fd);
+ logd_fd = -1;
ret = __write_to_log_initialize();
#if !defined(_WIN32)
pthread_mutex_unlock(&log_init_lock);
@@ -351,6 +336,11 @@
#if !defined(_WIN32)
pthread_mutex_unlock(&log_init_lock);
#endif
+#if (FAKE_LOG_DEVICE == 0)
+ if (pstore_fd >= 0) {
+ __write_to_log_daemon(log_id, vec, nr);
+ }
+#endif
return ret;
}
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 6475649..58285f1 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -1123,7 +1123,7 @@
int32_t ExtractEntryToFile(ZipArchiveHandle handle,
ZipEntry* entry, int fd) {
- const int32_t declared_length = entry->uncompressed_length;
+ const uint32_t declared_length = entry->uncompressed_length;
const off64_t current_offset = lseek64(fd, 0, SEEK_CUR);
if (current_offset == -1) {
diff --git a/libzipfile/Android.mk b/libzipfile/Android.mk
deleted file mode 100644
index f054e15..0000000
--- a/libzipfile/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# build host static library
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- centraldir.c \
- zipfile.c
-
-LOCAL_STATIC_LIBRARIES := libz
-
-LOCAL_MODULE:= libzipfile
-
-LOCAL_CFLAGS := -Werror
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# build device static library
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- centraldir.c \
- zipfile.c
-
-LOCAL_STATIC_LIBRARIES := libz
-
-LOCAL_MODULE:= libzipfile
-
-LOCAL_CFLAGS := -Werror
-
-include $(BUILD_STATIC_LIBRARY)
-
-
-# build test_zipfile
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- test_zipfile.c
-
-LOCAL_STATIC_LIBRARIES := libzipfile libz
-
-LOCAL_MODULE := test_zipfile
-
-LOCAL_CFLAGS := -Werror
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/libzipfile/MODULE_LICENSE_APACHE2 b/libzipfile/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libzipfile/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libzipfile/NOTICE b/libzipfile/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/libzipfile/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/libzipfile/centraldir.c b/libzipfile/centraldir.c
deleted file mode 100644
index 69cf47a..0000000
--- a/libzipfile/centraldir.c
+++ /dev/null
@@ -1,222 +0,0 @@
-#include "private.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <utils/Compat.h>
-
-enum {
- // finding the directory
- CD_SIGNATURE = 0x06054b50,
- EOCD_LEN = 22, // EndOfCentralDir len, excl. comment
- MAX_COMMENT_LEN = 65535,
- MAX_EOCD_SEARCH = MAX_COMMENT_LEN + EOCD_LEN,
-
- // central directory entries
- ENTRY_SIGNATURE = 0x02014b50,
- ENTRY_LEN = 46, // CentralDirEnt len, excl. var fields
-
- // local file header
- LFH_SIZE = 30,
-};
-
-unsigned int
-read_le_int(const unsigned char* buf)
-{
- return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
-}
-
-unsigned int
-read_le_short(const unsigned char* buf)
-{
- return buf[0] | (buf[1] << 8);
-}
-
-static int
-read_central_dir_values(Zipfile* file, const unsigned char* buf, int len)
-{
- if (len < EOCD_LEN) {
- // looks like ZIP file got truncated
- fprintf(stderr, " Zip EOCD: expected >= %d bytes, found %d\n",
- EOCD_LEN, len);
- return -1;
- }
-
- file->disknum = read_le_short(&buf[0x04]);
- file->diskWithCentralDir = read_le_short(&buf[0x06]);
- file->entryCount = read_le_short(&buf[0x08]);
- file->totalEntryCount = read_le_short(&buf[0x0a]);
- file->centralDirSize = read_le_int(&buf[0x0c]);
- file->centralDirOffest = read_le_int(&buf[0x10]);
- file->commentLen = read_le_short(&buf[0x14]);
-
- if (file->commentLen > 0) {
- if (EOCD_LEN + file->commentLen > len) {
- fprintf(stderr, "EOCD(%d) + comment(%d) exceeds len (%d)\n",
- EOCD_LEN, file->commentLen, len);
- return -1;
- }
- file->comment = buf + EOCD_LEN;
- }
-
- return 0;
-}
-
-static int
-read_central_directory_entry(Zipfile* file, Zipentry* entry,
- const unsigned char** buf, ssize_t* len)
-{
- const unsigned char* p;
-
- unsigned short extraFieldLength;
- unsigned short fileCommentLength;
- unsigned long localHeaderRelOffset;
- unsigned int dataOffset;
-
- p = *buf;
-
- if (*len < ENTRY_LEN) {
- fprintf(stderr, "cde entry not large enough\n");
- return -1;
- }
-
- if (read_le_int(&p[0x00]) != ENTRY_SIGNATURE) {
- fprintf(stderr, "Whoops: didn't find expected signature\n");
- return -1;
- }
-
- entry->compressionMethod = read_le_short(&p[0x0a]);
- entry->compressedSize = read_le_int(&p[0x14]);
- entry->uncompressedSize = read_le_int(&p[0x18]);
- entry->fileNameLength = read_le_short(&p[0x1c]);
- extraFieldLength = read_le_short(&p[0x1e]);
- fileCommentLength = read_le_short(&p[0x20]);
- localHeaderRelOffset = read_le_int(&p[0x2a]);
-
- p += ENTRY_LEN;
-
- // filename
- if (entry->fileNameLength != 0) {
- entry->fileName = p;
- } else {
- entry->fileName = NULL;
- }
- p += entry->fileNameLength;
-
- // extra field
- p += extraFieldLength;
-
- // comment, if any
- p += fileCommentLength;
-
- *buf = p;
-
- // the size of the extraField in the central dir is how much data there is,
- // but the one in the local file header also contains some padding.
- p = file->buf + localHeaderRelOffset;
- extraFieldLength = read_le_short(&p[0x1c]);
-
- dataOffset = localHeaderRelOffset + LFH_SIZE
- + entry->fileNameLength + extraFieldLength;
- entry->data = file->buf + dataOffset;
-#if 0
- printf("file->buf=%p entry->data=%p dataOffset=%x localHeaderRelOffset=%d "
- "entry->fileNameLength=%d extraFieldLength=%d\n",
- file->buf, entry->data, dataOffset, localHeaderRelOffset,
- entry->fileNameLength, extraFieldLength);
-#endif
- return 0;
-}
-
-/*
- * Find the central directory and read the contents.
- *
- * The fun thing about ZIP archives is that they may or may not be
- * readable from start to end. In some cases, notably for archives
- * that were written to stdout, the only length information is in the
- * central directory at the end of the file.
- *
- * Of course, the central directory can be followed by a variable-length
- * comment field, so we have to scan through it backwards. The comment
- * is at most 64K, plus we have 18 bytes for the end-of-central-dir stuff
- * itself, plus apparently sometimes people throw random junk on the end
- * just for the fun of it.
- *
- * This is all a little wobbly. If the wrong value ends up in the EOCD
- * area, we're hosed. This appears to be the way that everbody handles
- * it though, so we're in pretty good company if this fails.
- */
-int
-read_central_dir(Zipfile *file)
-{
- int err;
-
- const unsigned char* buf = file->buf;
- ZD_TYPE bufsize = file->bufsize;
- const unsigned char* eocd;
- const unsigned char* p;
- const unsigned char* start;
- ssize_t len;
- int i;
-
- // too small to be a ZIP archive?
- if (bufsize < EOCD_LEN) {
- fprintf(stderr, "Length is " ZD " -- too small\n", bufsize);
- goto bail;
- }
-
- // find the end-of-central-dir magic
- if (bufsize > MAX_EOCD_SEARCH) {
- start = buf + bufsize - MAX_EOCD_SEARCH;
- } else {
- start = buf;
- }
- p = buf + bufsize - 4;
- while (p >= start) {
- if (*p == 0x50 && read_le_int(p) == CD_SIGNATURE) {
- eocd = p;
- break;
- }
- p--;
- }
- if (p < start) {
- fprintf(stderr, "EOCD not found, not Zip\n");
- goto bail;
- }
-
- // extract eocd values
- err = read_central_dir_values(file, eocd, (buf+bufsize)-eocd);
- if (err != 0) {
- goto bail;
- }
-
- if (file->disknum != 0
- || file->diskWithCentralDir != 0
- || file->entryCount != file->totalEntryCount) {
- fprintf(stderr, "Archive spanning not supported\n");
- goto bail;
- }
-
- // Loop through and read the central dir entries.
- p = buf + file->centralDirOffest;
- len = (buf+bufsize)-p;
- for (i=0; i < file->totalEntryCount; i++) {
- Zipentry* entry = malloc(sizeof(Zipentry));
- memset(entry, 0, sizeof(Zipentry));
-
- err = read_central_directory_entry(file, entry, &p, &len);
- if (err != 0) {
- fprintf(stderr, "read_central_directory_entry failed\n");
- free(entry);
- goto bail;
- }
-
- // add it to our list
- entry->next = file->entries;
- file->entries = entry;
- }
-
- return 0;
-bail:
- return -1;
-}
diff --git a/libzipfile/private.h b/libzipfile/private.h
deleted file mode 100644
index 06f788d..0000000
--- a/libzipfile/private.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef PRIVATE_H
-#define PRIVATE_H
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-typedef struct Zipentry {
- unsigned long fileNameLength;
- const unsigned char* fileName;
- unsigned short compressionMethod;
- unsigned int uncompressedSize;
- unsigned int compressedSize;
- const unsigned char* data;
-
- struct Zipentry* next;
-} Zipentry;
-
-typedef struct Zipfile
-{
- const unsigned char *buf;
- ssize_t bufsize;
-
- // Central directory
- unsigned short disknum; //mDiskNumber;
- unsigned short diskWithCentralDir; //mDiskWithCentralDir;
- unsigned short entryCount; //mNumEntries;
- unsigned short totalEntryCount; //mTotalNumEntries;
- unsigned int centralDirSize; //mCentralDirSize;
- unsigned int centralDirOffest; // offset from first disk //mCentralDirOffset;
- unsigned short commentLen; //mCommentLen;
- const unsigned char* comment; //mComment;
-
- Zipentry* entries;
-} Zipfile;
-
-int read_central_dir(Zipfile* file);
-
-unsigned int read_le_int(const unsigned char* buf);
-unsigned int read_le_short(const unsigned char* buf);
-
-#endif // PRIVATE_H
-
diff --git a/libzipfile/test_zipfile.c b/libzipfile/test_zipfile.c
deleted file mode 100644
index 1aaa913..0000000
--- a/libzipfile/test_zipfile.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <zipfile/zipfile.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-void dump_zipfile(FILE* to, zipfile_t file);
-
-int
-main(int argc, char** argv)
-{
- FILE* f;
- size_t size, unsize;
- void* buf;
- void* scratch;
- zipfile_t zip;
- zipentry_t entry;
- int err;
- enum { HUH, LIST, UNZIP } what = HUH;
-
- if (strcmp(argv[2], "-l") == 0 && argc == 3) {
- what = LIST;
- }
- else if (strcmp(argv[2], "-u") == 0 && argc == 5) {
- what = UNZIP;
- }
- else {
- fprintf(stderr, "usage: test_zipfile ZIPFILE -l\n"
- " lists the files in the zipfile\n"
- " test_zipfile ZIPFILE -u FILENAME SAVETO\n"
- " saves FILENAME from the zip file into SAVETO\n");
- return 1;
- }
-
- f = fopen(argv[1], "r");
- if (f == NULL) {
- fprintf(stderr, "couldn't open %s\n", argv[1]);
- return 1;
- }
-
- fseek(f, 0, SEEK_END);
- size = ftell(f);
- rewind(f);
-
- buf = malloc(size);
- fread(buf, 1, size, f);
-
- zip = init_zipfile(buf, size);
- if (zip == NULL) {
- fprintf(stderr, "inti_zipfile failed\n");
- return 1;
- }
-
- fclose(f);
-
-
- switch (what)
- {
- case HUH:
- break;
- case LIST:
- dump_zipfile(stdout, zip);
- break;
- case UNZIP:
- entry = lookup_zipentry(zip, argv[3]);
- if (entry == NULL) {
- fprintf(stderr, "zip file '%s' does not contain file '%s'\n",
- argv[1], argv[1]);
- return 1;
- }
- f = fopen(argv[4], "w");
- if (f == NULL) {
- fprintf(stderr, "can't open file for writing '%s'\n", argv[4]);
- return 1;
- }
- unsize = get_zipentry_size(entry);
- size = unsize * 1.001;
- scratch = malloc(size);
- printf("scratch=%p\n", scratch);
- err = decompress_zipentry(entry, scratch, size);
- if (err != 0) {
- fprintf(stderr, "error decompressing file\n");
- return 1;
- }
- fwrite(scratch, unsize, 1, f);
- free(scratch);
- fclose(f);
- break;
- }
-
- free(buf);
-
- return 0;
-}
-
diff --git a/libzipfile/zipfile.c b/libzipfile/zipfile.c
deleted file mode 100644
index 1032ecc..0000000
--- a/libzipfile/zipfile.c
+++ /dev/null
@@ -1,159 +0,0 @@
-#include <zipfile/zipfile.h>
-
-#include "private.h"
-#include <stdlib.h>
-#include <string.h>
-#include <zlib.h>
-#define DEF_MEM_LEVEL 8 // normally in zutil.h?
-
-zipfile_t
-init_zipfile(const void* data, size_t size)
-{
- int err;
-
- Zipfile *file = malloc(sizeof(Zipfile));
- if (file == NULL) return NULL;
- memset(file, 0, sizeof(Zipfile));
- file->buf = data;
- file->bufsize = size;
-
- err = read_central_dir(file);
- if (err != 0) goto fail;
-
- return file;
-fail:
- free(file);
- return NULL;
-}
-
-void
-release_zipfile(zipfile_t f)
-{
- Zipfile* file = (Zipfile*)f;
- Zipentry* entry = file->entries;
- while (entry) {
- Zipentry* next = entry->next;
- free(entry);
- entry = next;
- }
- free(file);
-}
-
-zipentry_t
-lookup_zipentry(zipfile_t f, const char* entryName)
-{
- Zipfile* file = (Zipfile*)f;
- Zipentry* entry = file->entries;
- while (entry) {
- if (0 == memcmp(entryName, entry->fileName, entry->fileNameLength)) {
- return entry;
- }
- entry = entry->next;
- }
- return NULL;
-}
-
-size_t
-get_zipentry_size(zipentry_t entry)
-{
- return ((Zipentry*)entry)->uncompressedSize;
-}
-
-char*
-get_zipentry_name(zipentry_t entry)
-{
- Zipentry* e = (Zipentry*)entry;
- int l = e->fileNameLength;
- char* s = malloc(l+1);
- memcpy(s, e->fileName, l);
- s[l] = '\0';
- return s;
-}
-
-enum {
- STORED = 0,
- DEFLATED = 8
-};
-
-static int
-inflate_wrapper(unsigned char* out, int unlen, const unsigned char* in, int clen)
-{
- z_stream zstream;
- int err = 0;
- int zerr;
-
- memset(&zstream, 0, sizeof(zstream));
- zstream.zalloc = Z_NULL;
- zstream.zfree = Z_NULL;
- zstream.opaque = Z_NULL;
- zstream.next_in = (void*)in;
- zstream.avail_in = clen;
- zstream.next_out = (Bytef*) out;
- zstream.avail_out = unlen;
- zstream.data_type = Z_UNKNOWN;
-
- // Use the undocumented "negative window bits" feature to tell zlib
- // that there's no zlib header waiting for it.
- zerr = inflateInit2(&zstream, -MAX_WBITS);
- if (zerr != Z_OK) {
- return -1;
- }
-
- // uncompress the data
- zerr = inflate(&zstream, Z_FINISH);
- if (zerr != Z_STREAM_END) {
- fprintf(stderr, "zerr=%d Z_STREAM_END=%d total_out=%lu\n", zerr, Z_STREAM_END,
- zstream.total_out);
- err = -1;
- }
-
- inflateEnd(&zstream);
- return err;
-}
-
-int
-decompress_zipentry(zipentry_t e, void* buf, int bufsize)
-{
- Zipentry* entry = (Zipentry*)e;
- switch (entry->compressionMethod)
- {
- case STORED:
- memcpy(buf, entry->data, entry->uncompressedSize);
- return 0;
- case DEFLATED:
- return inflate_wrapper(buf, bufsize, entry->data, entry->compressedSize);
- default:
- return -1;
- }
-}
-
-void
-dump_zipfile(FILE* to, zipfile_t file)
-{
- Zipfile* zip = (Zipfile*)file;
- Zipentry* entry = zip->entries;
- int i;
-
- fprintf(to, "entryCount=%d\n", zip->entryCount);
- for (i=0; i<zip->entryCount; i++) {
- fprintf(to, " file \"");
- fwrite(entry->fileName, entry->fileNameLength, 1, to);
- fprintf(to, "\"\n");
- entry = entry->next;
- }
-}
-
-zipentry_t
-iterate_zipfile(zipfile_t file, void** cookie)
-{
- Zipentry* entry = (Zipentry*)*cookie;
- if (entry == NULL) {
- Zipfile* zip = (Zipfile*)file;
- *cookie = zip->entries;
- return *cookie;
- } else {
- entry = entry->next;
- *cookie = entry;
- return entry;
- }
-}
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index 959dc22..a0a9909 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -59,7 +59,6 @@
renice \
restorecon \
route \
- runcon \
sendevent \
setprop \
start \
@@ -103,6 +102,14 @@
$(TOOLS_H):
$(transform-generated-source)
+$(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
+
+INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
+$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py > $@
+$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py
+$(INPUT_H_LABELS_H):
+ $(transform-generated-source)
# We only want 'r' on userdebug and eng builds.
include $(CLEAR_VARS)
diff --git a/toolbox/generate-input.h-labels.py b/toolbox/generate-input.h-labels.py
new file mode 100755
index 0000000..ebb9588
--- /dev/null
+++ b/toolbox/generate-input.h-labels.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# pylint: disable=bad-indentation,bad-continuation
+
+import os
+import re
+
+input_prop_list = []
+ev_list = []
+syn_list = []
+key_list = []
+rel_list = []
+abs_list = []
+sw_list = []
+msc_list = []
+led_list = []
+rep_list = []
+snd_list = []
+mt_tool_list = []
+ff_status_list = []
+ff_list = []
+
+r = re.compile(r'#define\s+(\S+)\s+((?:0x)?\d+)')
+
+with open('bionic/libc/kernel/uapi/linux/input.h', 'r') as f:
+ for line in f:
+ m = r.match(line)
+ if m:
+ name = m.group(1)
+ if name.startswith("INPUT_PROP_"):
+ input_prop_list.append(name)
+ elif name.startswith("EV_"):
+ ev_list.append(name)
+ elif name.startswith("SYN_"):
+ syn_list.append(name)
+ elif name.startswith("KEY_") or name.startswith("BTN_"):
+ key_list.append(name)
+ elif name.startswith("REL_"):
+ rel_list.append(name)
+ elif name.startswith("ABS_"):
+ abs_list.append(name)
+ elif name.startswith("SW_"):
+ sw_list.append(name)
+ elif name.startswith("MSC_"):
+ msc_list.append(name)
+ elif name.startswith("LED_"):
+ led_list.append(name)
+ elif name.startswith("REP_"):
+ rep_list.append(name)
+ elif name.startswith("SND_"):
+ snd_list.append(name)
+ elif name.startswith("MT_TOOL_"):
+ mt_tool_list.append(name)
+ elif name.startswith("FF_STATUS_"):
+ ff_status_list.append(name)
+ elif name.startswith("FF_"):
+ ff_list.append(name)
+
+def Dump(struct_name, values):
+ print 'static struct label %s[] = {' % (struct_name)
+ for value in values:
+ print ' LABEL(%s),' % (value)
+ print ' LABEL_END,'
+ print '};'
+
+Dump("input_prop_labels", input_prop_list)
+Dump("ev_labels", ev_list)
+Dump("syn_labels", syn_list)
+Dump("key_labels", key_list)
+Dump("rel_labels", rel_list)
+Dump("abs_labels", abs_list)
+Dump("sw_labels", sw_list)
+Dump("msc_labels", msc_list)
+Dump("led_labels", led_list)
+Dump("rep_labels", rep_list)
+Dump("snd_labels", snd_list)
+Dump("mt_tool_labels", mt_tool_list)
+Dump("ff_status_labels", ff_status_list)
+Dump("ff_labels", ff_list)
diff --git a/toolbox/getevent.c b/toolbox/getevent.c
index c58eb5d..30053af 100644
--- a/toolbox/getevent.c
+++ b/toolbox/getevent.c
@@ -12,7 +12,25 @@
#include <errno.h>
#include <unistd.h>
-#include "getevent.h"
+struct label {
+ const char *name;
+ int value;
+};
+
+#define LABEL(constant) { #constant, constant }
+#define LABEL_END { NULL, -1 }
+
+static struct label key_value_labels[] = {
+ { "UP", 0 },
+ { "DOWN", 1 },
+ { "REPEAT", 2 },
+ LABEL_END,
+};
+
+#include "input.h-labels.h"
+
+#undef LABEL
+#undef LABEL_END
static struct pollfd *ufds;
static char **device_names;
diff --git a/toolbox/getevent.h b/toolbox/getevent.h
deleted file mode 100644
index 0482d04..0000000
--- a/toolbox/getevent.h
+++ /dev/null
@@ -1,727 +0,0 @@
-#include <linux/input.h>
-
-struct label {
- const char *name;
- int value;
-};
-
-#define LABEL(constant) { #constant, constant }
-#define LABEL_END { NULL, -1 }
-
-static struct label input_prop_labels[] = {
- LABEL(INPUT_PROP_POINTER),
- LABEL(INPUT_PROP_DIRECT),
- LABEL(INPUT_PROP_BUTTONPAD),
- LABEL(INPUT_PROP_SEMI_MT),
- LABEL_END,
-};
-
-static struct label ev_labels[] = {
- LABEL(EV_SYN),
- LABEL(EV_KEY),
- LABEL(EV_REL),
- LABEL(EV_ABS),
- LABEL(EV_MSC),
- LABEL(EV_SW),
- LABEL(EV_LED),
- LABEL(EV_SND),
- LABEL(EV_REP),
- LABEL(EV_FF),
- LABEL(EV_PWR),
- LABEL(EV_FF_STATUS),
- LABEL_END,
-};
-
-static struct label syn_labels[] = {
- LABEL(SYN_REPORT),
- LABEL(SYN_CONFIG),
- LABEL(SYN_MT_REPORT),
- LABEL(SYN_DROPPED),
- LABEL_END,
-};
-
-static struct label key_labels[] = {
- LABEL(KEY_RESERVED),
- LABEL(KEY_ESC),
- LABEL(KEY_1),
- LABEL(KEY_2),
- LABEL(KEY_3),
- LABEL(KEY_4),
- LABEL(KEY_5),
- LABEL(KEY_6),
- LABEL(KEY_7),
- LABEL(KEY_8),
- LABEL(KEY_9),
- LABEL(KEY_0),
- LABEL(KEY_MINUS),
- LABEL(KEY_EQUAL),
- LABEL(KEY_BACKSPACE),
- LABEL(KEY_TAB),
- LABEL(KEY_Q),
- LABEL(KEY_W),
- LABEL(KEY_E),
- LABEL(KEY_R),
- LABEL(KEY_T),
- LABEL(KEY_Y),
- LABEL(KEY_U),
- LABEL(KEY_I),
- LABEL(KEY_O),
- LABEL(KEY_P),
- LABEL(KEY_LEFTBRACE),
- LABEL(KEY_RIGHTBRACE),
- LABEL(KEY_ENTER),
- LABEL(KEY_LEFTCTRL),
- LABEL(KEY_A),
- LABEL(KEY_S),
- LABEL(KEY_D),
- LABEL(KEY_F),
- LABEL(KEY_G),
- LABEL(KEY_H),
- LABEL(KEY_J),
- LABEL(KEY_K),
- LABEL(KEY_L),
- LABEL(KEY_SEMICOLON),
- LABEL(KEY_APOSTROPHE),
- LABEL(KEY_GRAVE),
- LABEL(KEY_LEFTSHIFT),
- LABEL(KEY_BACKSLASH),
- LABEL(KEY_Z),
- LABEL(KEY_X),
- LABEL(KEY_C),
- LABEL(KEY_V),
- LABEL(KEY_B),
- LABEL(KEY_N),
- LABEL(KEY_M),
- LABEL(KEY_COMMA),
- LABEL(KEY_DOT),
- LABEL(KEY_SLASH),
- LABEL(KEY_RIGHTSHIFT),
- LABEL(KEY_KPASTERISK),
- LABEL(KEY_LEFTALT),
- LABEL(KEY_SPACE),
- LABEL(KEY_CAPSLOCK),
- LABEL(KEY_F1),
- LABEL(KEY_F2),
- LABEL(KEY_F3),
- LABEL(KEY_F4),
- LABEL(KEY_F5),
- LABEL(KEY_F6),
- LABEL(KEY_F7),
- LABEL(KEY_F8),
- LABEL(KEY_F9),
- LABEL(KEY_F10),
- LABEL(KEY_NUMLOCK),
- LABEL(KEY_SCROLLLOCK),
- LABEL(KEY_KP7),
- LABEL(KEY_KP8),
- LABEL(KEY_KP9),
- LABEL(KEY_KPMINUS),
- LABEL(KEY_KP4),
- LABEL(KEY_KP5),
- LABEL(KEY_KP6),
- LABEL(KEY_KPPLUS),
- LABEL(KEY_KP1),
- LABEL(KEY_KP2),
- LABEL(KEY_KP3),
- LABEL(KEY_KP0),
- LABEL(KEY_KPDOT),
- LABEL(KEY_ZENKAKUHANKAKU),
- LABEL(KEY_102ND),
- LABEL(KEY_F11),
- LABEL(KEY_F12),
- LABEL(KEY_RO),
- LABEL(KEY_KATAKANA),
- LABEL(KEY_HIRAGANA),
- LABEL(KEY_HENKAN),
- LABEL(KEY_KATAKANAHIRAGANA),
- LABEL(KEY_MUHENKAN),
- LABEL(KEY_KPJPCOMMA),
- LABEL(KEY_KPENTER),
- LABEL(KEY_RIGHTCTRL),
- LABEL(KEY_KPSLASH),
- LABEL(KEY_SYSRQ),
- LABEL(KEY_RIGHTALT),
- LABEL(KEY_LINEFEED),
- LABEL(KEY_HOME),
- LABEL(KEY_UP),
- LABEL(KEY_PAGEUP),
- LABEL(KEY_LEFT),
- LABEL(KEY_RIGHT),
- LABEL(KEY_END),
- LABEL(KEY_DOWN),
- LABEL(KEY_PAGEDOWN),
- LABEL(KEY_INSERT),
- LABEL(KEY_DELETE),
- LABEL(KEY_MACRO),
- LABEL(KEY_MUTE),
- LABEL(KEY_VOLUMEDOWN),
- LABEL(KEY_VOLUMEUP),
- LABEL(KEY_POWER),
- LABEL(KEY_KPEQUAL),
- LABEL(KEY_KPPLUSMINUS),
- LABEL(KEY_PAUSE),
- LABEL(KEY_SCALE),
- LABEL(KEY_KPCOMMA),
- LABEL(KEY_HANGEUL),
- LABEL(KEY_HANGUEL),
- LABEL(KEY_HANJA),
- LABEL(KEY_YEN),
- LABEL(KEY_LEFTMETA),
- LABEL(KEY_RIGHTMETA),
- LABEL(KEY_COMPOSE),
- LABEL(KEY_STOP),
- LABEL(KEY_AGAIN),
- LABEL(KEY_PROPS),
- LABEL(KEY_UNDO),
- LABEL(KEY_FRONT),
- LABEL(KEY_COPY),
- LABEL(KEY_OPEN),
- LABEL(KEY_PASTE),
- LABEL(KEY_FIND),
- LABEL(KEY_CUT),
- LABEL(KEY_HELP),
- LABEL(KEY_MENU),
- LABEL(KEY_CALC),
- LABEL(KEY_SETUP),
- LABEL(KEY_SLEEP),
- LABEL(KEY_WAKEUP),
- LABEL(KEY_FILE),
- LABEL(KEY_SENDFILE),
- LABEL(KEY_DELETEFILE),
- LABEL(KEY_XFER),
- LABEL(KEY_PROG1),
- LABEL(KEY_PROG2),
- LABEL(KEY_WWW),
- LABEL(KEY_MSDOS),
- LABEL(KEY_COFFEE),
- LABEL(KEY_SCREENLOCK),
- LABEL(KEY_DIRECTION),
- LABEL(KEY_CYCLEWINDOWS),
- LABEL(KEY_MAIL),
- LABEL(KEY_BOOKMARKS),
- LABEL(KEY_COMPUTER),
- LABEL(KEY_BACK),
- LABEL(KEY_FORWARD),
- LABEL(KEY_CLOSECD),
- LABEL(KEY_EJECTCD),
- LABEL(KEY_EJECTCLOSECD),
- LABEL(KEY_NEXTSONG),
- LABEL(KEY_PLAYPAUSE),
- LABEL(KEY_PREVIOUSSONG),
- LABEL(KEY_STOPCD),
- LABEL(KEY_RECORD),
- LABEL(KEY_REWIND),
- LABEL(KEY_PHONE),
- LABEL(KEY_ISO),
- LABEL(KEY_CONFIG),
- LABEL(KEY_HOMEPAGE),
- LABEL(KEY_REFRESH),
- LABEL(KEY_EXIT),
- LABEL(KEY_MOVE),
- LABEL(KEY_EDIT),
- LABEL(KEY_SCROLLUP),
- LABEL(KEY_SCROLLDOWN),
- LABEL(KEY_KPLEFTPAREN),
- LABEL(KEY_KPRIGHTPAREN),
- LABEL(KEY_NEW),
- LABEL(KEY_REDO),
- LABEL(KEY_F13),
- LABEL(KEY_F14),
- LABEL(KEY_F15),
- LABEL(KEY_F16),
- LABEL(KEY_F17),
- LABEL(KEY_F18),
- LABEL(KEY_F19),
- LABEL(KEY_F20),
- LABEL(KEY_F21),
- LABEL(KEY_F22),
- LABEL(KEY_F23),
- LABEL(KEY_F24),
- LABEL(KEY_PLAYCD),
- LABEL(KEY_PAUSECD),
- LABEL(KEY_PROG3),
- LABEL(KEY_PROG4),
- LABEL(KEY_DASHBOARD),
- LABEL(KEY_SUSPEND),
- LABEL(KEY_CLOSE),
- LABEL(KEY_PLAY),
- LABEL(KEY_FASTFORWARD),
- LABEL(KEY_BASSBOOST),
- LABEL(KEY_PRINT),
- LABEL(KEY_HP),
- LABEL(KEY_CAMERA),
- LABEL(KEY_SOUND),
- LABEL(KEY_QUESTION),
- LABEL(KEY_EMAIL),
- LABEL(KEY_CHAT),
- LABEL(KEY_SEARCH),
- LABEL(KEY_CONNECT),
- LABEL(KEY_FINANCE),
- LABEL(KEY_SPORT),
- LABEL(KEY_SHOP),
- LABEL(KEY_ALTERASE),
- LABEL(KEY_CANCEL),
- LABEL(KEY_BRIGHTNESSDOWN),
- LABEL(KEY_BRIGHTNESSUP),
- LABEL(KEY_MEDIA),
- LABEL(KEY_SWITCHVIDEOMODE),
- LABEL(KEY_KBDILLUMTOGGLE),
- LABEL(KEY_KBDILLUMDOWN),
- LABEL(KEY_KBDILLUMUP),
- LABEL(KEY_SEND),
- LABEL(KEY_REPLY),
- LABEL(KEY_FORWARDMAIL),
- LABEL(KEY_SAVE),
- LABEL(KEY_DOCUMENTS),
- LABEL(KEY_BATTERY),
- LABEL(KEY_BLUETOOTH),
- LABEL(KEY_WLAN),
- LABEL(KEY_UWB),
- LABEL(KEY_UNKNOWN),
- LABEL(KEY_VIDEO_NEXT),
- LABEL(KEY_VIDEO_PREV),
- LABEL(KEY_BRIGHTNESS_CYCLE),
- LABEL(KEY_BRIGHTNESS_ZERO),
- LABEL(KEY_DISPLAY_OFF),
- LABEL(KEY_WIMAX),
- LABEL(KEY_RFKILL),
- LABEL(BTN_0),
- LABEL(BTN_1),
- LABEL(BTN_2),
- LABEL(BTN_3),
- LABEL(BTN_4),
- LABEL(BTN_5),
- LABEL(BTN_6),
- LABEL(BTN_7),
- LABEL(BTN_8),
- LABEL(BTN_9),
- LABEL(BTN_LEFT),
- LABEL(BTN_RIGHT),
- LABEL(BTN_MIDDLE),
- LABEL(BTN_SIDE),
- LABEL(BTN_EXTRA),
- LABEL(BTN_FORWARD),
- LABEL(BTN_BACK),
- LABEL(BTN_TASK),
- LABEL(BTN_JOYSTICK),
- LABEL(BTN_TRIGGER),
- LABEL(BTN_THUMB),
- LABEL(BTN_THUMB2),
- LABEL(BTN_TOP),
- LABEL(BTN_TOP2),
- LABEL(BTN_PINKIE),
- LABEL(BTN_BASE),
- LABEL(BTN_BASE2),
- LABEL(BTN_BASE3),
- LABEL(BTN_BASE4),
- LABEL(BTN_BASE5),
- LABEL(BTN_BASE6),
- LABEL(BTN_DEAD),
- LABEL(BTN_A),
- LABEL(BTN_B),
- LABEL(BTN_C),
- LABEL(BTN_X),
- LABEL(BTN_Y),
- LABEL(BTN_Z),
- LABEL(BTN_TL),
- LABEL(BTN_TR),
- LABEL(BTN_TL2),
- LABEL(BTN_TR2),
- LABEL(BTN_SELECT),
- LABEL(BTN_START),
- LABEL(BTN_MODE),
- LABEL(BTN_THUMBL),
- LABEL(BTN_THUMBR),
- LABEL(BTN_TOOL_PEN),
- LABEL(BTN_TOOL_RUBBER),
- LABEL(BTN_TOOL_BRUSH),
- LABEL(BTN_TOOL_PENCIL),
- LABEL(BTN_TOOL_AIRBRUSH),
- LABEL(BTN_TOOL_FINGER),
- LABEL(BTN_TOOL_MOUSE),
- LABEL(BTN_TOOL_LENS),
- LABEL(BTN_TOUCH),
- LABEL(BTN_STYLUS),
- LABEL(BTN_STYLUS2),
- LABEL(BTN_TOOL_DOUBLETAP),
- LABEL(BTN_TOOL_TRIPLETAP),
- LABEL(BTN_TOOL_QUADTAP),
- LABEL(BTN_GEAR_DOWN),
- LABEL(BTN_GEAR_UP),
- LABEL(KEY_OK),
- LABEL(KEY_SELECT),
- LABEL(KEY_GOTO),
- LABEL(KEY_CLEAR),
- LABEL(KEY_POWER2),
- LABEL(KEY_OPTION),
- LABEL(KEY_INFO),
- LABEL(KEY_TIME),
- LABEL(KEY_VENDOR),
- LABEL(KEY_ARCHIVE),
- LABEL(KEY_PROGRAM),
- LABEL(KEY_CHANNEL),
- LABEL(KEY_FAVORITES),
- LABEL(KEY_EPG),
- LABEL(KEY_PVR),
- LABEL(KEY_MHP),
- LABEL(KEY_LANGUAGE),
- LABEL(KEY_TITLE),
- LABEL(KEY_SUBTITLE),
- LABEL(KEY_ANGLE),
- LABEL(KEY_ZOOM),
- LABEL(KEY_MODE),
- LABEL(KEY_KEYBOARD),
- LABEL(KEY_SCREEN),
- LABEL(KEY_PC),
- LABEL(KEY_TV),
- LABEL(KEY_TV2),
- LABEL(KEY_VCR),
- LABEL(KEY_VCR2),
- LABEL(KEY_SAT),
- LABEL(KEY_SAT2),
- LABEL(KEY_CD),
- LABEL(KEY_TAPE),
- LABEL(KEY_RADIO),
- LABEL(KEY_TUNER),
- LABEL(KEY_PLAYER),
- LABEL(KEY_TEXT),
- LABEL(KEY_DVD),
- LABEL(KEY_AUX),
- LABEL(KEY_MP3),
- LABEL(KEY_AUDIO),
- LABEL(KEY_VIDEO),
- LABEL(KEY_DIRECTORY),
- LABEL(KEY_LIST),
- LABEL(KEY_MEMO),
- LABEL(KEY_CALENDAR),
- LABEL(KEY_RED),
- LABEL(KEY_GREEN),
- LABEL(KEY_YELLOW),
- LABEL(KEY_BLUE),
- LABEL(KEY_CHANNELUP),
- LABEL(KEY_CHANNELDOWN),
- LABEL(KEY_FIRST),
- LABEL(KEY_LAST),
- LABEL(KEY_AB),
- LABEL(KEY_NEXT),
- LABEL(KEY_RESTART),
- LABEL(KEY_SLOW),
- LABEL(KEY_SHUFFLE),
- LABEL(KEY_BREAK),
- LABEL(KEY_PREVIOUS),
- LABEL(KEY_DIGITS),
- LABEL(KEY_TEEN),
- LABEL(KEY_TWEN),
- LABEL(KEY_VIDEOPHONE),
- LABEL(KEY_GAMES),
- LABEL(KEY_ZOOMIN),
- LABEL(KEY_ZOOMOUT),
- LABEL(KEY_ZOOMRESET),
- LABEL(KEY_WORDPROCESSOR),
- LABEL(KEY_EDITOR),
- LABEL(KEY_SPREADSHEET),
- LABEL(KEY_GRAPHICSEDITOR),
- LABEL(KEY_PRESENTATION),
- LABEL(KEY_DATABASE),
- LABEL(KEY_NEWS),
- LABEL(KEY_VOICEMAIL),
- LABEL(KEY_ADDRESSBOOK),
- LABEL(KEY_MESSENGER),
- LABEL(KEY_DISPLAYTOGGLE),
- LABEL(KEY_SPELLCHECK),
- LABEL(KEY_LOGOFF),
- LABEL(KEY_DOLLAR),
- LABEL(KEY_EURO),
- LABEL(KEY_FRAMEBACK),
- LABEL(KEY_FRAMEFORWARD),
- LABEL(KEY_CONTEXT_MENU),
- LABEL(KEY_MEDIA_REPEAT),
- LABEL(KEY_10CHANNELSUP),
- LABEL(KEY_10CHANNELSDOWN),
- LABEL(KEY_IMAGES),
- LABEL(KEY_DEL_EOL),
- LABEL(KEY_DEL_EOS),
- LABEL(KEY_INS_LINE),
- LABEL(KEY_DEL_LINE),
- LABEL(KEY_FN),
- LABEL(KEY_FN_ESC),
- LABEL(KEY_FN_F1),
- LABEL(KEY_FN_F2),
- LABEL(KEY_FN_F3),
- LABEL(KEY_FN_F4),
- LABEL(KEY_FN_F5),
- LABEL(KEY_FN_F6),
- LABEL(KEY_FN_F7),
- LABEL(KEY_FN_F8),
- LABEL(KEY_FN_F9),
- LABEL(KEY_FN_F10),
- LABEL(KEY_FN_F11),
- LABEL(KEY_FN_F12),
- LABEL(KEY_FN_1),
- LABEL(KEY_FN_2),
- LABEL(KEY_FN_D),
- LABEL(KEY_FN_E),
- LABEL(KEY_FN_F),
- LABEL(KEY_FN_S),
- LABEL(KEY_FN_B),
- LABEL(KEY_BRL_DOT1),
- LABEL(KEY_BRL_DOT2),
- LABEL(KEY_BRL_DOT3),
- LABEL(KEY_BRL_DOT4),
- LABEL(KEY_BRL_DOT5),
- LABEL(KEY_BRL_DOT6),
- LABEL(KEY_BRL_DOT7),
- LABEL(KEY_BRL_DOT8),
- LABEL(KEY_BRL_DOT9),
- LABEL(KEY_BRL_DOT10),
- LABEL(KEY_NUMERIC_0),
- LABEL(KEY_NUMERIC_1),
- LABEL(KEY_NUMERIC_2),
- LABEL(KEY_NUMERIC_3),
- LABEL(KEY_NUMERIC_4),
- LABEL(KEY_NUMERIC_5),
- LABEL(KEY_NUMERIC_6),
- LABEL(KEY_NUMERIC_7),
- LABEL(KEY_NUMERIC_8),
- LABEL(KEY_NUMERIC_9),
- LABEL(KEY_NUMERIC_STAR),
- LABEL(KEY_NUMERIC_POUND),
- LABEL(KEY_CAMERA_FOCUS),
- LABEL(KEY_WPS_BUTTON),
- LABEL(KEY_TOUCHPAD_TOGGLE),
- LABEL(KEY_TOUCHPAD_ON),
- LABEL(KEY_TOUCHPAD_OFF),
- LABEL(KEY_CAMERA_ZOOMIN),
- LABEL(KEY_CAMERA_ZOOMOUT),
- LABEL(KEY_CAMERA_UP),
- LABEL(KEY_CAMERA_DOWN),
- LABEL(KEY_CAMERA_LEFT),
- LABEL(KEY_CAMERA_RIGHT),
- LABEL(BTN_TRIGGER_HAPPY1),
- LABEL(BTN_TRIGGER_HAPPY2),
- LABEL(BTN_TRIGGER_HAPPY3),
- LABEL(BTN_TRIGGER_HAPPY4),
- LABEL(BTN_TRIGGER_HAPPY5),
- LABEL(BTN_TRIGGER_HAPPY6),
- LABEL(BTN_TRIGGER_HAPPY7),
- LABEL(BTN_TRIGGER_HAPPY8),
- LABEL(BTN_TRIGGER_HAPPY9),
- LABEL(BTN_TRIGGER_HAPPY10),
- LABEL(BTN_TRIGGER_HAPPY11),
- LABEL(BTN_TRIGGER_HAPPY12),
- LABEL(BTN_TRIGGER_HAPPY13),
- LABEL(BTN_TRIGGER_HAPPY14),
- LABEL(BTN_TRIGGER_HAPPY15),
- LABEL(BTN_TRIGGER_HAPPY16),
- LABEL(BTN_TRIGGER_HAPPY17),
- LABEL(BTN_TRIGGER_HAPPY18),
- LABEL(BTN_TRIGGER_HAPPY19),
- LABEL(BTN_TRIGGER_HAPPY20),
- LABEL(BTN_TRIGGER_HAPPY21),
- LABEL(BTN_TRIGGER_HAPPY22),
- LABEL(BTN_TRIGGER_HAPPY23),
- LABEL(BTN_TRIGGER_HAPPY24),
- LABEL(BTN_TRIGGER_HAPPY25),
- LABEL(BTN_TRIGGER_HAPPY26),
- LABEL(BTN_TRIGGER_HAPPY27),
- LABEL(BTN_TRIGGER_HAPPY28),
- LABEL(BTN_TRIGGER_HAPPY29),
- LABEL(BTN_TRIGGER_HAPPY30),
- LABEL(BTN_TRIGGER_HAPPY31),
- LABEL(BTN_TRIGGER_HAPPY32),
- LABEL(BTN_TRIGGER_HAPPY33),
- LABEL(BTN_TRIGGER_HAPPY34),
- LABEL(BTN_TRIGGER_HAPPY35),
- LABEL(BTN_TRIGGER_HAPPY36),
- LABEL(BTN_TRIGGER_HAPPY37),
- LABEL(BTN_TRIGGER_HAPPY38),
- LABEL(BTN_TRIGGER_HAPPY39),
- LABEL(BTN_TRIGGER_HAPPY40),
- LABEL_END,
-};
-
-static struct label rel_labels[] = {
- LABEL(REL_X),
- LABEL(REL_Y),
- LABEL(REL_Z),
- LABEL(REL_RX),
- LABEL(REL_RY),
- LABEL(REL_RZ),
- LABEL(REL_HWHEEL),
- LABEL(REL_DIAL),
- LABEL(REL_WHEEL),
- LABEL(REL_MISC),
- LABEL_END,
-};
-
-static struct label abs_labels[] = {
- LABEL(ABS_X),
- LABEL(ABS_Y),
- LABEL(ABS_Z),
- LABEL(ABS_RX),
- LABEL(ABS_RY),
- LABEL(ABS_RZ),
- LABEL(ABS_THROTTLE),
- LABEL(ABS_RUDDER),
- LABEL(ABS_WHEEL),
- LABEL(ABS_GAS),
- LABEL(ABS_BRAKE),
- LABEL(ABS_HAT0X),
- LABEL(ABS_HAT0Y),
- LABEL(ABS_HAT1X),
- LABEL(ABS_HAT1Y),
- LABEL(ABS_HAT2X),
- LABEL(ABS_HAT2Y),
- LABEL(ABS_HAT3X),
- LABEL(ABS_HAT3Y),
- LABEL(ABS_PRESSURE),
- LABEL(ABS_DISTANCE),
- LABEL(ABS_TILT_X),
- LABEL(ABS_TILT_Y),
- LABEL(ABS_TOOL_WIDTH),
- LABEL(ABS_VOLUME),
- LABEL(ABS_MISC),
- LABEL(ABS_MT_SLOT),
- LABEL(ABS_MT_TOUCH_MAJOR),
- LABEL(ABS_MT_TOUCH_MINOR),
- LABEL(ABS_MT_WIDTH_MAJOR),
- LABEL(ABS_MT_WIDTH_MINOR),
- LABEL(ABS_MT_ORIENTATION),
- LABEL(ABS_MT_POSITION_X),
- LABEL(ABS_MT_POSITION_Y),
- LABEL(ABS_MT_TOOL_TYPE),
- LABEL(ABS_MT_BLOB_ID),
- LABEL(ABS_MT_TRACKING_ID),
- LABEL(ABS_MT_PRESSURE),
- LABEL(ABS_MT_DISTANCE),
- LABEL_END,
-};
-
-static struct label sw_labels[] = {
- LABEL(SW_LID),
- LABEL(SW_TABLET_MODE),
- LABEL(SW_HEADPHONE_INSERT),
- LABEL(SW_RFKILL_ALL),
- LABEL(SW_RADIO),
- LABEL(SW_MICROPHONE_INSERT),
- LABEL(SW_DOCK),
- LABEL(SW_LINEOUT_INSERT),
- LABEL(SW_JACK_PHYSICAL_INSERT),
- LABEL(SW_VIDEOOUT_INSERT),
- LABEL(SW_CAMERA_LENS_COVER),
- LABEL(SW_KEYPAD_SLIDE),
- LABEL(SW_FRONT_PROXIMITY),
- LABEL(SW_ROTATE_LOCK),
- LABEL_END,
-};
-
-static struct label msc_labels[] = {
- LABEL(MSC_SERIAL),
- LABEL(MSC_PULSELED),
- LABEL(MSC_GESTURE),
- LABEL(MSC_RAW),
- LABEL(MSC_SCAN),
- LABEL_END,
-};
-
-static struct label led_labels[] = {
- LABEL(LED_NUML),
- LABEL(LED_CAPSL),
- LABEL(LED_SCROLLL),
- LABEL(LED_COMPOSE),
- LABEL(LED_KANA),
- LABEL(LED_SLEEP),
- LABEL(LED_SUSPEND),
- LABEL(LED_MUTE),
- LABEL(LED_MISC),
- LABEL(LED_MAIL),
- LABEL(LED_CHARGING),
- LABEL_END,
-};
-
-static struct label rep_labels[] = {
- LABEL(REP_DELAY),
- LABEL(REP_PERIOD),
- LABEL_END,
-};
-
-static struct label snd_labels[] = {
- LABEL(SND_CLICK),
- LABEL(SND_BELL),
- LABEL(SND_TONE),
- LABEL_END,
-};
-
-#if 0
-static struct label id_labels[] = {
- LABEL(ID_BUS),
- LABEL(ID_VENDOR),
- LABEL(ID_PRODUCT),
- LABEL(ID_VERSION),
- LABEL_END,
-};
-
-static struct label bus_labels[] = {
- LABEL(BUS_PCI),
- LABEL(BUS_ISAPNP),
- LABEL(BUS_USB),
- LABEL(BUS_HIL),
- LABEL(BUS_BLUETOOTH),
- LABEL(BUS_VIRTUAL),
- LABEL(BUS_ISA),
- LABEL(BUS_I8042),
- LABEL(BUS_XTKBD),
- LABEL(BUS_RS232),
- LABEL(BUS_GAMEPORT),
- LABEL(BUS_PARPORT),
- LABEL(BUS_AMIGA),
- LABEL(BUS_ADB),
- LABEL(BUS_I2C),
- LABEL(BUS_HOST),
- LABEL(BUS_GSC),
- LABEL(BUS_ATARI),
- LABEL(BUS_SPI),
- LABEL_END,
-};
-#endif
-
-static struct label mt_tool_labels[] = {
- LABEL(MT_TOOL_FINGER),
- LABEL(MT_TOOL_PEN),
- LABEL(MT_TOOL_MAX),
- LABEL_END,
-};
-
-static struct label ff_status_labels[] = {
- LABEL(FF_STATUS_STOPPED),
- LABEL(FF_STATUS_PLAYING),
- LABEL(FF_STATUS_MAX),
- LABEL_END,
-};
-
-static struct label ff_labels[] = {
- LABEL(FF_RUMBLE),
- LABEL(FF_PERIODIC),
- LABEL(FF_CONSTANT),
- LABEL(FF_SPRING),
- LABEL(FF_FRICTION),
- LABEL(FF_DAMPER),
- LABEL(FF_INERTIA),
- LABEL(FF_RAMP),
- LABEL(FF_SQUARE),
- LABEL(FF_TRIANGLE),
- LABEL(FF_SINE),
- LABEL(FF_SAW_UP),
- LABEL(FF_SAW_DOWN),
- LABEL(FF_CUSTOM),
- LABEL(FF_GAIN),
- LABEL(FF_AUTOCENTER),
- LABEL_END,
-};
-
-static struct label key_value_labels[] = {
- { "UP", 0 },
- { "DOWN", 1 },
- { "REPEAT", 2 },
- LABEL_END,
-};
diff --git a/toolbox/runcon.c b/toolbox/runcon.c
deleted file mode 100644
index 4a57bf3..0000000
--- a/toolbox/runcon.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <selinux/selinux.h>
-
-int runcon_main(int argc, char **argv)
-{
- int rc;
-
- if (argc < 3) {
- fprintf(stderr, "usage: %s context program args...\n", argv[0]);
- exit(1);
- }
-
- rc = setexeccon(argv[1]);
- if (rc < 0) {
- fprintf(stderr, "Could not set context to %s: %s\n", argv[1], strerror(errno));
- exit(2);
- }
-
- argv += 2;
- argc -= 2;
- execvp(argv[0], argv);
- fprintf(stderr, "Could not exec %s: %s\n", argv[0], strerror(errno));
- exit(3);
-}