diff options
| author | Marco Nelissen <marcone@google.com> | 2009-08-13 07:53:33 -0700 |
|---|---|---|
| committer | Marco Nelissen <marcone@google.com> | 2009-08-13 09:00:38 -0700 |
| commit | 500248f5ccd913f8a5a8e597d6a109061f9bd724 (patch) | |
| tree | a61d71f714b3847d198e29709372237c7904d00c /simulator | |
| parent | 69b2b48e076209c0bf63ea88008ba3e36391060c (diff) | |
| download | android_development-500248f5ccd913f8a5a8e597d6a109061f9bd724.tar.gz android_development-500248f5ccd913f8a5a8e597d6a109061f9bd724.tar.bz2 android_development-500248f5ccd913f8a5a8e597d6a109061f9bd724.zip | |
Fix the way the simulator reports the capabilities of the input device.
This makes it no longer pretend it has as a multitouch display, trackball, etc.
Diffstat (limited to 'simulator')
| -rw-r--r-- | simulator/wrapsim/DevEvent.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/simulator/wrapsim/DevEvent.c b/simulator/wrapsim/DevEvent.c index 692856ecd..60060f496 100644 --- a/simulator/wrapsim/DevEvent.c +++ b/simulator/wrapsim/DevEvent.c @@ -31,14 +31,34 @@ typedef struct EventState { * (For now, just pretend to be a "goldfish" like the emulator.) */ static const unsigned char gKeyBitMask[64] = { + // These bits indicate which keys the device has 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + // These bits indicate other capabilities, such + // as whether it's a trackball or a touchscreen + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // touchscreen + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * Abs bit mask, for EVIOCGBIT(EV_ABS). + * + * Pretend to be a normal single touch panel + */ +static const unsigned char gAbsBitMask[64] = { + // these bits indicate the capabilities of the touch screen + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ABS_X, ABS_Y + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* @@ -193,7 +213,9 @@ static int ioctlEvent(FakeDev* dev, int fd, int request, void* argp) } else if (!getenv("NOTOUCH") && _IOC_NR(urequest) == _IOC_NR(EVIOCGBIT(EV_ABS,0))) { // absolute controllers (touch screen) int maxLen = _IOC_SIZE(urequest); - memset(argp, 0xff, maxLen); + if (maxLen > (int) sizeof(gAbsBitMask)) + maxLen = sizeof(gAbsBitMask); + memcpy(argp, gAbsBitMask, maxLen); } else if (_IOC_NR(urequest) >= _IOC_NR(EVIOCGABS(ABS_X)) && _IOC_NR(urequest) <= _IOC_NR(EVIOCGABS(ABS_MAX))) |
