From c471639adfba3e7c24c95b24da287147f86bd3d1 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 28 Apr 2007 15:10:25 +0200 Subject: [PATCH] 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. --- src/acecad.c | 2 +- src/acecad.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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)) -- 2.32.0.93.g670b81a890