From: Jan Steffens <[email protected]> This implements using 19200 as a default baudrate for some tablets instead of always using 38400.
The baudrate switching logic in isdv4GetRanges is extended to be able to switch to 38400 as well. It also now outputs a warning. My WACf004 needs a baudrate of 19200, and is included in the 0x90 tablet_id. This seemed like the easiest way, but I'm unsure whether all 0x90 tablets use 19200. Signed-off-by: Jan Steffens <[email protected]> Signed-off-by: Peter Hutterer <[email protected]> --- src/wcmISDV4.c | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c index 682c1ff..0c1a695 100644 --- a/src/wcmISDV4.c +++ b/src/wcmISDV4.c @@ -206,7 +206,10 @@ static Bool isdv4ParseOptions(LocalDevicePtr local) wcmISDV4Data *isdv4data; int baud; - baud = xf86SetIntOption(local->options, "BaudRate", 38400); + /* Determine default baud rate */ + baud = (common->tablet_id == 0x90)? 19200 : 38400; + + baud = xf86SetIntOption(local->options, "BaudRate", baud); switch (baud) { @@ -250,7 +253,7 @@ static Bool isdv4Init(LocalDevicePtr local, char* id, float *version) DBG(1, priv, "initializing ISDV4 tablet\n"); - /* Initial baudrate is 38400 */ + /* Set baudrate */ if (xf86SetSerialSpeed(local->fd, isdv4data->baudrate) < 0) return !Success; @@ -337,23 +340,31 @@ static int isdv4GetRanges(LocalDevicePtr local) if (isdv4data->initialized++) return ret; - /* Initial baudrate is 38400 */ + /* Set baudrate to configured value */ if (xf86SetSerialSpeed(local->fd, isdv4data->baudrate) < 0) return !Success; /* Send query command to the tablet */ ret = isdv4Query(local, ISDV4_QUERY, data); - if (ret != Success && isdv4data->baudrate != 19200) + if (ret != Success) { - /* device may be 19200 */ - if (xf86SetSerialSpeed(local->fd, 19200) < 0) + int baud; + + /* Try with the other baudrate */ + baud = (isdv4data->baudrate == 38400)? 19200 : 38400; + + xf86Msg(X_WARNING, "%s: Query failed with %d baud. Trying %d.\n", + local->name, isdv4data->baudrate, baud); + + if (xf86SetSerialSpeed(local->fd, baud) < 0) return !Success; + ret = isdv4Query(local, ISDV4_QUERY, data); if (ret == Success) { - isdv4data->baudrate = 19200; + isdv4data->baudrate = baud; /* xf86OpenSerial() takes the baud rate from the options */ - xf86ReplaceIntOption(local->options, "BaudRate", 19200); + xf86ReplaceIntOption(local->options, "BaudRate", baud); } } -- 1.7.1 ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
