diff options
Diffstat (limited to '')
-rw-r--r-- | libgamepad.h | 6 | ||||
-rw-r--r-- | libgamepad_open_device.c | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libgamepad.h b/libgamepad.h index cd574b0..f77e16b 100644 --- a/libgamepad.h +++ b/libgamepad.h @@ -1526,17 +1526,23 @@ struct libgamepad_device { /** * Human-readable device (sub- or superdevice) name + * + * Empty if not available */ char *name; /** * ID that is supposted to be unique to the device * (sub- or superdevice) + * + * Empty if not available */ char *unique_id; /** * The location if the device + * + * Empty if not available */ char *physical_location; diff --git a/libgamepad_open_device.c b/libgamepad_open_device.c index 27c5600..9fa438e 100644 --- a/libgamepad_open_device.c +++ b/libgamepad_open_device.c @@ -166,7 +166,18 @@ libgamepad_open_device(struct libgamepad_device *devicep, int dirfd, const char #define GET_STRING(EVIOCMACRO, OUTPUT)\ do {\ for (;;) {\ - DEFER_EINTR((r = ioctl(devicep->fd, EVIOCMACRO(bufsize), buf)) < 0, fail_free_buf);\ + while ((r = ioctl(devicep->fd, EVIOCMACRO(bufsize), buf)) < 0) {\ + if (errno == EINTR) {\ + devicep->internals->deferred_error = EINTR;\ + continue;\ + } else if (errno == ENOENT) {\ + if (bufsize)\ + r = 0;\ + break;\ + } else {\ + goto fail_free_buf;\ + }\ + }\ if ((size_t)r < bufsize)\ break;\ new = realloc(buf, bufsize += 32);\ |