Android-x86
Fork

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-extras: コミット

system/extras


コミットメタ情報

リビジョン4749fb4cfb27117729455347ae7d10d8046a8717 (tree)
日時2011-06-27 02:04:25
作者Jim Huang <jserv@0xla...>
コミッターChih-Wei Huang

ログメッセージ

Added fake touchscreen daemon to make builtin apk work

Several Android builtin packages would pick up the system resources
about touchscreen. If there is no touchscreen, the ones suffixing
with '-notouch' would be taken. However, by default, resource layout
doesn't come with '-notouch', and Beagleboard has no touchscreen on
board physically. Thus, Android core will crash due to lacking of
proper resources.

Our solution is to write a dedicated daemon to register userspace
input device as a fake touchscreen device. EventHub would regard
it as one of the input source, and no Android packages would complain.
(cherry picked from commit 641356fa32226baa8beb12d54160103063c7c8d4)

Signed-off-by: Tick Chen <tick@0xlab.org>

[faketsd] Run fake touch screen driver for res
DO NOT MERGE: Demo purpose only.

Running faketsd before system runs and Android will think the system
having resource of touchscreen, and will try to access resource of
fingers.

変更サマリ

差分

--- /dev/null
+++ b/faketsd/Android.mk
@@ -0,0 +1,9 @@
1+LOCAL_PATH := $(call my-dir)
2+include $(CLEAR_VARS)
3+
4+LOCAL_SRC_FILES := fake-ts.c
5+
6+LOCAL_MODULE := faketsd
7+LOCAL_MODULE_TAGS := optional
8+
9+include $(BUILD_EXECUTABLE)
--- /dev/null
+++ b/faketsd/fake-ts.c
@@ -0,0 +1,76 @@
1+/* ------------------------------------------------------------------
2+ * Copyright (C) 2009 0xlab.org - http://0xlab.org/
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13+ * express or implied.
14+ * See the License for the specific language governing permissions
15+ * and limitations under the License.
16+ * -------------------------------------------------------------------
17+ */
18+
19+#include <stdio.h>
20+#include <fcntl.h>
21+#include <unistd.h>
22+#include <string.h>
23+
24+#include <linux/uinput.h>
25+
26+/* look up source file system/core/init/devices.c for exact node */
27+#define UINPUT_DEV "/dev/uinput"
28+
29+#define DEV_NAME "Fake Touchscreen"
30+
31+static int uinput_fd = 0;
32+
33+static void uinput_touch_init(const char* uinput_dev,
34+ const char* dev_name)
35+{
36+ struct uinput_user_dev dev;
37+
38+ uinput_fd = open(uinput_dev, O_WRONLY);
39+ if (uinput_fd <= 0) {
40+ perror("Error opening uinput device.\n");
41+ return;
42+ }
43+ memset(&dev, 0, sizeof(dev));
44+ strcpy(dev.name, dev_name);
45+ write(uinput_fd, &dev, sizeof(dev));
46+
47+ /* touch screen event */
48+ ioctl(uinput_fd, UI_SET_EVBIT, EV_ABS);
49+ ioctl(uinput_fd, UI_SET_ABSBIT, ABS_X);
50+ ioctl(uinput_fd, UI_SET_ABSBIT, ABS_Y);
51+ ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY);
52+ ioctl(uinput_fd, UI_SET_KEYBIT, BTN_TOUCH);
53+
54+ /* register userspace input device */
55+ ioctl(uinput_fd, UI_DEV_CREATE, 0);
56+}
57+
58+static void uinput_touch_deinit()
59+{
60+ if (uinput_fd > 0) {
61+ close(uinput_fd);
62+ }
63+}
64+
65+int main(int argc, char* argv[])
66+{
67+ uinput_touch_init(UINPUT_DEV, DEV_NAME);
68+
69+ while (1) {
70+ sleep(60);
71+ }
72+
73+ uinput_touch_deinit();
74+
75+ return 0;
76+}
旧リポジトリブラウザで表示