diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-28 03:43:04 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-28 03:43:04 +0200 |
commit | 838980da1cf5073ce0d532f94358cfc951e3b1c4 (patch) | |
tree | 8d45064645ee3a77593db924bcb45bc0800c3708 | |
parent | dba3190cb5e5c041c6b5811fa9efd1f0a5931fb6 (diff) |
Re-probe for device if DeviceOn fails and auto-dev is active.
If DeviceOn does not find the device and auto-dev is active, run the probe
again to try to find the new location of the device (if present).
-rw-r--r-- | src/acecad.c | 10 | ||||
-rw-r--r-- | src/acecad.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/acecad.c b/src/acecad.c index 3e17205..cf8489f 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -366,10 +366,12 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86OptionListReport(local->options); priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 ); + priv->acecadAutoDev = FALSE; s = xf86FindOptionValue(local->options, "Device"); if (!s || (s && (xf86NameCmp(s, "auto-dev") == 0))) { #ifdef LINUX_INPUT + priv->acecadAutoDev = TRUE; if (!AceCadAutoDevProbe(local)) { xf86Msg(X_ERROR, "%s: unable to find device\n", local->name); @@ -536,8 +538,12 @@ DeviceOn (DeviceIntPtr dev) local->fd = xf86OpenSerial(local->options); if (local->fd == -1) { - xf86Msg(X_WARNING, "%s: cannot open input device\n", local->name); - /* TODO rescan if auto-dev */ + xf86Msg(X_WARNING, "%s: cannot open input device %s\n", local->name, xf86FindOptionValue(local->options, "Device")); +#ifdef LINUX_INPUT + if (priv->acecadAutoDev && AceCadAutoDevProbe(local)) + local->fd = xf86OpenSerial(local->options); + if (local->fd == -1) +#endif return (!Success); } diff --git a/src/acecad.h b/src/acecad.h index 2fd9430..41470bc 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -78,6 +78,7 @@ typedef struct int acecadMaxZ; /* max Y value */ char acecadReportSpeed; /* report speed */ int acecadUSB; /*USB flag*/ + BOOL acecadAutoDev; /* are using auto-dev */ int flags; /* various flags */ int packeti; /* number of bytes read */ int PacketSize; /* number of bytes read */ |