summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@bitmath.org>2011-04-21 10:49:45 +0200
committerHenrik Rydberg <rydberg@bitmath.org>2011-04-21 10:49:45 +0200
commit1a7320fd41a636481b2d456c1009407d4fc1f5e8 (patch)
tree0c80b183457d02fbc1f1d7861d865119728736d9
parentcf1793779f9665034a7308e22d391cf8be178236 (diff)
Allow spaces in device names
The current code only reads a single word as the device name, and the extract function replaces spaces with hyphens to match that. This patch modifies the scan code to allow for a full line of name data, and removes the name modification during extraction. Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
-rw-r--r--src/evemu.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/evemu.c b/src/evemu.c
index 4b20576..21187af 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -219,9 +219,6 @@ int evemu_extract(struct evemu_device *dev, int fd)
SYSCALL(rc = ioctl(fd, EVIOCGNAME(sizeof(dev->name)), dev->name));
if (rc < 0)
return rc;
- for (i = 0; i < sizeof(dev->name); i++)
- if (isspace(dev->name[i]))
- dev->name[i] = '-';
SYSCALL(rc = ioctl(fd, EVIOCGID, &dev->id));
if (rc < 0)
@@ -339,7 +336,8 @@ int evemu_read(struct evemu_device *dev, FILE *fp)
memset(dev, 0, sizeof(*dev));
- ret = fscanf(fp, "N: %s\n", dev->name);
+ /* limited by UINPUT_MAX_NAME_SIZE */
+ ret = fscanf(fp, "N: %79[^\n]\n", dev->name);
if (ret <= 0)
return ret;