大家下午好,虛擬觸摸屏設備未報告對X或Y軸的支持?
我正在嘗試在rooted 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
我不能因爲設備不能工作正確地創建它。跳過任何人都可以擺脫一些光。
這是我的許多嘗試之一,總是導致這個消息。
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: 挖得更深一些,問題是,aparently 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;
}
預先感謝您的時間。
它看起來像x/y軸是從設備資源建立的。它看起來像從這裏查看一些觸摸屏驅動程序代碼:http://lxr.free-electrons.com/source/drivers/input/touchscreen/?a=arm –