diff options
author | Matthew Allum <breakfast@10.am> | 2003-09-30 22:14:59 +0000 |
---|---|---|
committer | Matthew Allum <breakfast@10.am> | 2003-09-30 22:14:59 +0000 |
commit | a42e31b28c493dc3d6b32cde4e72ff17fc983183 (patch) | |
tree | 738ed41ee26c6052f15586280cdcbb1b06eb8c84 /hw | |
parent | a0876ade6479c40dcef63f70f4c6c5a5988edeba (diff) |
Fixed tslib driver to handle VT switches
Diffstat (limited to 'hw')
-rw-r--r-- | hw/kdrive/linux/tslib.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c index e0731bf70..70d9d5bd0 100644 --- a/hw/kdrive/linux/tslib.c +++ b/hw/kdrive/linux/tslib.c @@ -122,6 +122,29 @@ static char *TsNames[] = { int TsInputType; int +TslibEnable (int not_needed_fd, void *closure) +{ + KdMouseInfo *mi = closure; + int fd = 0; + + if(!(tsDev = ts_open(mi->name, 0))) { + fprintf(stderr, "%s() failed to open %s\n", __func__, mi->name ); + return -1; /* XXX Not sure what to return here */ + } + + ts_config(tsDev); + fd=ts_fd(tsDev); + + return fd; +} + +void +TslibDisable (int fd, void *closure) +{ + ts_close(tsDev); +} + +int TslibInit (void) { int i; @@ -131,7 +154,7 @@ TslibInit (void) if (!TsInputType) TsInputType = KdAllocInputType (); - + for (mi = kdMouseInfo; mi; mi = next) { next = mi->next; @@ -151,14 +174,25 @@ TslibInit (void) break; } } + } else { + + if(!(tsDev = ts_open(mi->name,0))) + continue; + ts_config(tsDev); + fd=ts_fd(tsDev); + } if (fd > 0 && tsDev != 0) { mi->driver = (void *) fd; mi->inputType = TsInputType; - if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi)) - n++; + if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi)) + n++; + + /* Set callbacks for vt switches etc */ + KdRegisterFdEnableDisable (fd, TslibEnable, TslibDisable); + } else if (fd > 0) close(fd); |