こんにちは、
ルート化された Android フォンで uinput を使用して仮想タッチスクリーンを作成しようとしています。
デバイスを作成することはできますが、
New device: id=88, fd=170, path='/dev/input/event6', name='uinput-eve',
classes=0x4, configuration='', keyLayout='', keyCharacterMap='',
builtinKeyboard=false, usingSuspendBlockIoctl=true, usingClockIoctl=false
Touch device 'uinput-eve' did not report support for X or Y axis!
The device will be inoperable.
Device added: id=88, name='uinput-eve', sources=0x00002002
デバイスが動作不能になり、正常に作成できません。誰もが光を当てることができると思っていました。
これは、常にそのメッセージにつながる私の多くの試みの 1 つです。
struct uinput_user_dev uidev;
struct input_event ev;
int dx, dy;
int fd;
fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
if (fd < 0) {
die("error: open");
}
memset(&uidev, 0, sizeof(uidev));
snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "uinput-eve");
uidev.id.bustype = BUS_VIRTUAL;
uidev.id.vendor = 0x1;
uidev.id.product = 0x1;
uidev.id.version = 1;
if (write(fd, &uidev, sizeof(uidev)) < 0) {
die("error: write");
}
/* touch screen event */
ioctl(fd, UI_SET_EVBIT, EV_ABS);
ioctl(fd, UI_SET_ABSBIT, ABS_X);
ioctl(fd, UI_SET_ABSBIT, ABS_Y);
ioctl(fd, UI_SET_EVBIT, EV_KEY);
ioctl(fd, UI_SET_KEYBIT, BTN_TOUCH);
if (ioctl(fd, UI_DEV_CREATE,0) < 0) {
die("error: ioctl");
}
Edit1: もう少し深く掘り下げて、問題は明らかに mRawPointerAxes が設定されていないことです。誰もそれらを設定する方法を知っていますか? 次のコードは、services/input/InputReader.cpp からのものです。
// Ensure we have valid X and Y axes.
if (!mRawPointerAxes.x.valid || !mRawPointerAxes.y.valid) {
LOGW(INDENT "Touch device '%s' did not report support for X or Y axis! "
"The device will be inoperable.", getDeviceName().string());
mDeviceMode = DEVICE_MODE_DISABLED;
return;
}
よろしくお願いいたします。