diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-28 15:10:25 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-28 15:10:25 +0200 |
commit | c471639adfba3e7c24c95b24da287147f86bd3d1 (patch) | |
tree | dc12c0b801f7c614e52731c157e527928711be27 /src | |
parent | 81e37b4b042b824654b4bf2353732741cf49bce7 (diff) |
NOTAVAIL macro to check if errno means device not available.
Define (and use) a NOTAVAIL macro that checks errno against ENODEV, ENXIO and ENOENT, instead of checking manually against ENODEV only.
Diffstat (limited to 'src')
-rw-r--r-- | src/acecad.c | 2 | ||||
-rw-r--r-- | src/acecad.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/acecad.c b/src/acecad.c index f5d4f25..bd23bf9 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -830,7 +830,7 @@ USBReadInput (LocalDevicePtr local) if (len <= 0) { xf86Msg(X_ERROR, "%s: error reading device: %s\n", local->name, strerror(errno)); - if ((errno == ENODEV) && (priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) { + if (NOTAVAIL && (priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) { DeviceOff(local->dev); DeviceOn(local->dev); } diff --git a/src/acecad.h b/src/acecad.h index 79618ae..e1552df 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -60,6 +60,8 @@ #define USB_FLAG 2 #define AUTODEV_FLAG 4 +#define NOTAVAIL ((errno == ENODEV) || (errno == ENXIO) || (errno == ENOENT)) + #define milisleep(ms) xf86usleep (ms * 1000) #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) |