Merge lp:~ace17/wizardpen/trunk into lp:wizardpen

Proposed by Sebastien Alaiwan
Status: Needs review
Proposed branch: lp:~ace17/wizardpen/trunk
Merge into: lp:wizardpen
Diff against target: 127 lines (+9/-52)
1 file modified
src/wizardpen.c (+9/-52)
To merge this branch: bzr merge lp:~ace17/wizardpen/trunk
Reviewer Review Type Date Requested Status
Wizardpen Developers Pending
Review via email: mp+220680@code.launchpad.net

Description of the change

Cleanup dead code + set default value for MouseSpeed, otherwise it defaults to zero, making the mouse impossible to move.

To post a comment you must log in.

Unmerged revisions

58. By Sebastien Alaiwan

Cleanup unused default options

57. By Sebastien Alaiwan

Set a non-zero default value for MouseSpeed.

56. By Sebastien Alaiwan

Remove dead code

55. By Sebastien Alaiwan

Fix warning about 'const'

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/wizardpen.c'
--- src/wizardpen.c 2011-11-11 00:49:02 +0000
+++ src/wizardpen.c 2014-05-22 16:01:51 +0000
@@ -92,13 +92,8 @@
9292
93static const char *default_options[] =93static const char *default_options[] =
94{94{
95 "BaudRate", "9600",95 "MouseSpeed", "24",
96 "StopBits", "1",96 "MouseAccel", "1",
97 "DataBits", "8",
98 "Parity", "Odd",
99 "Vmin", "1",
100 "Vtime", "10",
101 "FlowControl", "Xoff",
102 NULL97 NULL
103};98};
10499
@@ -186,7 +181,7 @@
186 snprintf(str, EV_DEV_NAME_MAXLEN, "%s%d", DEV_INPUT_EVENT, num)181 snprintf(str, EV_DEV_NAME_MAXLEN, "%s%d", DEV_INPUT_EVENT, num)
187182
188static Bool183static Bool
189fd_query_wizardpen(int fd, char *wizardpen_name) {184fd_query_wizardpen(int fd, const char *wizardpen_name) {
190 char name[256] = "Unknown";185 char name[256] = "Unknown";
191 int cmp_at = strlen(wizardpen_name);186 int cmp_at = strlen(wizardpen_name);
192 if (cmp_at > 255)187 if (cmp_at > 255)
@@ -208,7 +203,7 @@
208 Bool have_evdev = FALSE;203 Bool have_evdev = FALSE;
209 int noent_cnt = 0;204 int noent_cnt = 0;
210 const int max_skip = 10;205 const int max_skip = 10;
211 char *wizardpen_name = xf86FindOptionValue(local->options, "Name");206 const char *wizardpen_name = xf86FindOptionValue(local->options, "Name");
212 char fname[EV_DEV_NAME_MAXLEN];207 char fname[EV_DEV_NAME_MAXLEN];
213 int np;208 int np;
214209
@@ -337,7 +332,7 @@
337{332{
338 WizardPenPrivatePtr priv = calloc (1, sizeof(WizardPenPrivateRec));333 WizardPenPrivatePtr priv = calloc (1, sizeof(WizardPenPrivateRec));
339 int msgtype;334 int msgtype;
340 char *s;335 const char *s;
341 int rc = Success;336 int rc = Success;
342337
343 if (!priv) {338 if (!priv) {
@@ -466,7 +461,7 @@
466 if (s && strlen(s) > 0) {461 if (s && strlen(s) > 0) {
467 priv->bottomZ = parsePercentage(s, priv->maxZ);462 priv->bottomZ = parsePercentage(s, priv->maxZ);
468 }463 }
469 464
470 s = xf86FindOptionValue(local->options, "KeepShape");465 s = xf86FindOptionValue(local->options, "KeepShape");
471 if (s && strlen(s) > 0) {466 if (s && strlen(s) > 0) {
472 priv->keepShape = parseBool(s);467 priv->keepShape = parseBool(s);
@@ -535,7 +530,7 @@
535 priv->mouseAccel = parseBool(s);530 priv->mouseAccel = parseBool(s);
536 xf86Msg(X_CONFIG, "%s: MouseAccel = %d\n", local->name, priv->mouseAccel);531 xf86Msg(X_CONFIG, "%s: MouseAccel = %d\n", local->name, priv->mouseAccel);
537 }532 }
538 533
539 s = xf86FindOptionValue(local->options, "ReportScreen");534 s = xf86FindOptionValue(local->options, "ReportScreen");
540 if (s && strlen(s) > 0) {535 if (s && strlen(s) > 0) {
541 priv->reportScreen = parseBool(s);536 priv->reportScreen = parseBool(s);
@@ -1125,7 +1120,7 @@
1125 if(event->value)1120 if(event->value)
1126 priv->activeButtons |= WIZARDPEN_BTN_TOUCH;1121 priv->activeButtons |= WIZARDPEN_BTN_TOUCH;
1127 else1122 else
1128 priv->activeButtons &= ~WIZARDPEN_BTN_TOUCH; 1123 priv->activeButtons &= ~WIZARDPEN_BTN_TOUCH;
1129 if(!event->value)1124 if(!event->value)
1130 {1125 {
1131 buttons = set_bit(buttons, 2, 0); /* try to clear events to prevent some becoming 'locked' in the active state */1126 buttons = set_bit(buttons, 2, 0); /* try to clear events to prevent some becoming 'locked' in the active state */
@@ -1292,44 +1287,6 @@
1292}1287}
1293#endif // #ifdef LINUX_INPUT1288#endif // #ifdef LINUX_INPUT
12941289
1295#define WriteString(str)\
1296 XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str))
1297
1298static Bool
1299QueryHardware (WizardPenPrivatePtr priv)
1300{
1301 /* Reset */
1302 WriteString(WIZARDPEN_RESET);
1303
1304 /* Wait */
1305 milisleep (250);
1306
1307 /* Prompt Mode in order to not be disturbed */
1308 WriteString(WIZARDPEN_PROMPT_MODE);
1309
1310 /* Flush */
1311 while (XisbRead(priv->buffer) >= 0);
1312
1313 /* Ask for Config packet*/
1314 WriteString(WIZARDPEN_CONFIG);
1315
1316 /* Read the packet */
1317 XisbBlockDuration (priv->buffer, 1000000);
1318 NewPacket (priv);
1319
1320 if ((WizardPenGetPacket (priv) == Success))
1321 {
1322 priv->maxX = (int)priv->packet[1] + ((int)priv->packet[2] << 7);
1323 priv->maxY = (int)priv->packet[3] + ((int)priv->packet[4] << 7);
1324 priv->maxZ = 512; // FIXME: some tablets go to 1024
1325 xf86Msg(X_PROBED, "Wizardpen Tablet MaxX:%d MaxY:%d\n", priv->maxX, priv->maxY);
1326 }
1327 else
1328 return !Success;
1329
1330 return Success;
1331}
1332
1333#define BITS_PER_LONG (sizeof(long) * 8)1290#define BITS_PER_LONG (sizeof(long) * 8)
1334#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)1291#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
1335#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)1292#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
@@ -1383,7 +1340,7 @@
1383 }1340 }
1384 }1341 }
1385 }1342 }
1386 1343
1387 // FIXME: do we need to check this or is it always the same?1344 // FIXME: do we need to check this or is it always the same?
1388 if (aX + aY > bX + bY)1345 if (aX + aY > bX + bY)
1389 {1346 {

Subscribers

People subscribed via source and target branches