aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/joystick')
-rw-r--r--drivers/input/joystick/a3d.c2
-rw-r--r--drivers/input/joystick/analog.c23
-rw-r--r--drivers/input/joystick/cobra.c3
-rw-r--r--drivers/input/joystick/db9.c3
-rw-r--r--drivers/input/joystick/gamecon.c3
-rw-r--r--drivers/input/joystick/gf2k.c2
-rw-r--r--drivers/input/joystick/grip.c3
-rw-r--r--drivers/input/joystick/guillemot.c2
-rw-r--r--drivers/input/joystick/interact.c2
-rw-r--r--drivers/input/joystick/magellan.c2
-rw-r--r--drivers/input/joystick/sidewinder.c15
-rw-r--r--drivers/input/joystick/spaceball.c2
-rw-r--r--drivers/input/joystick/spaceorb.c2
-rw-r--r--drivers/input/joystick/stinger.c2
-rw-r--r--drivers/input/joystick/twidjoy.c2
-rw-r--r--drivers/input/joystick/warrior.c2
16 files changed, 40 insertions, 30 deletions
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c
index 4612d13ea756..b11a4bbc84c4 100644
--- a/drivers/input/joystick/a3d.c
+++ b/drivers/input/joystick/a3d.c
@@ -306,7 +306,7 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
306 gameport_set_poll_handler(gameport, a3d_poll); 306 gameport_set_poll_handler(gameport, a3d_poll);
307 gameport_set_poll_interval(gameport, 20); 307 gameport_set_poll_interval(gameport, 20);
308 308
309 sprintf(a3d->phys, "%s/input0", gameport->phys); 309 snprintf(a3d->phys, sizeof(a3d->phys), "%s/input0", gameport->phys);
310 310
311 input_dev->name = a3d_names[a3d->mode]; 311 input_dev->name = a3d_names[a3d->mode];
312 input_dev->phys = a3d->phys; 312 input_dev->phys = a3d->phys;
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 3121961e3e7c..01dc0b195d59 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -408,21 +408,23 @@ static void analog_calibrate_timer(struct analog_port *port)
408 408
409static void analog_name(struct analog *analog) 409static void analog_name(struct analog *analog)
410{ 410{
411 sprintf(analog->name, "Analog %d-axis %d-button", 411 snprintf(analog->name, sizeof(analog->name), "Analog %d-axis %d-button",
412 hweight8(analog->mask & ANALOG_AXES_STD), 412 hweight8(analog->mask & ANALOG_AXES_STD),
413 hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 + 413 hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 +
414 hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4); 414 hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4);
415 415
416 if (analog->mask & ANALOG_HATS_ALL) 416 if (analog->mask & ANALOG_HATS_ALL)
417 sprintf(analog->name, "%s %d-hat", 417 snprintf(analog->name, sizeof(analog->name), "%s %d-hat",
418 analog->name, hweight16(analog->mask & ANALOG_HATS_ALL)); 418 analog->name, hweight16(analog->mask & ANALOG_HATS_ALL));
419 419
420 if (analog->mask & ANALOG_HAT_FCS) 420 if (analog->mask & ANALOG_HAT_FCS)
421 strcat(analog->name, " FCS"); 421 strlcat(analog->name, " FCS", sizeof(analog->name));
422 if (analog->mask & ANALOG_ANY_CHF) 422 if (analog->mask & ANALOG_ANY_CHF)
423 strcat(analog->name, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF"); 423 strlcat(analog->name, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF",
424 sizeof(analog->name));
424 425
425 strcat(analog->name, (analog->mask & ANALOG_GAMEPAD) ? " gamepad": " joystick"); 426 strlcat(analog->name, (analog->mask & ANALOG_GAMEPAD) ? " gamepad": " joystick",
427 sizeof(analog->name));
426} 428}
427 429
428/* 430/*
@@ -435,7 +437,8 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
435 int i, j, t, v, w, x, y, z; 437 int i, j, t, v, w, x, y, z;
436 438
437 analog_name(analog); 439 analog_name(analog);
438 sprintf(analog->phys, "%s/input%d", port->gameport->phys, index); 440 snprintf(analog->phys, sizeof(analog->phys),
441 "%s/input%d", port->gameport->phys, index);
439 analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn; 442 analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn;
440 443
441 analog->dev = input_dev = input_allocate_device(); 444 analog->dev = input_dev = input_allocate_device();
diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c
index 1909f7ef340c..d5e42eb88a20 100644
--- a/drivers/input/joystick/cobra.c
+++ b/drivers/input/joystick/cobra.c
@@ -202,7 +202,8 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
202 goto fail3; 202 goto fail3;
203 } 203 }
204 204
205 sprintf(cobra->phys[i], "%s/input%d", gameport->phys, i); 205 snprintf(cobra->phys[i], sizeof(cobra->phys[i]),
206 "%s/input%d", gameport->phys, i);
206 207
207 input_dev->name = "Creative Labs Blaster GamePad Cobra"; 208 input_dev->name = "Creative Labs Blaster GamePad Cobra";
208 input_dev->phys = cobra->phys[i]; 209 input_dev->phys = cobra->phys[i];
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index e61894685cb1..6f31f054d1bb 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -620,7 +620,8 @@ static struct db9 __init *db9_probe(int parport, int mode)
620 goto err_unreg_devs; 620 goto err_unreg_devs;
621 } 621 }
622 622
623 sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i); 623 snprintf(db9->phys[i], sizeof(db9->phys[i]),
624 "%s/input%d", db9->pd->port->name, i);
624 625
625 input_dev->name = db9_mode->name; 626 input_dev->name = db9_mode->name;
626 input_dev->phys = db9->phys[i]; 627 input_dev->phys = db9->phys[i];
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index ecbdb6b9bbd6..fe12aa37393d 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -761,7 +761,8 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
761 if (!pads[i]) 761 if (!pads[i])
762 continue; 762 continue;
763 763
764 sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); 764 snprintf(gc->phys[i], sizeof(gc->phys[i]),
765 "%s/input%d", gc->pd->port->name, i);
765 err = gc_setup_pad(gc, i, pads[i]); 766 err = gc_setup_pad(gc, i, pads[i]);
766 if (err) 767 if (err)
767 goto err_unreg_devs; 768 goto err_unreg_devs;
diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
index 8a3ad455eb38..e4a699f6ec87 100644
--- a/drivers/input/joystick/gf2k.c
+++ b/drivers/input/joystick/gf2k.c
@@ -298,7 +298,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
298 gameport_set_poll_handler(gameport, gf2k_poll); 298 gameport_set_poll_handler(gameport, gf2k_poll);
299 gameport_set_poll_interval(gameport, 20); 299 gameport_set_poll_interval(gameport, 20);
300 300
301 sprintf(gf2k->phys, "%s/input0", gameport->phys); 301 snprintf(gf2k->phys, sizeof(gf2k->phys), "%s/input0", gameport->phys);
302 302
303 gf2k->length = gf2k_lens[gf2k->id]; 303 gf2k->length = gf2k_lens[gf2k->id];
304 304
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
index 20cb98ac2d79..17a90c436de8 100644
--- a/drivers/input/joystick/grip.c
+++ b/drivers/input/joystick/grip.c
@@ -354,7 +354,8 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
354 goto fail3; 354 goto fail3;
355 } 355 }
356 356
357 sprintf(grip->phys[i], "%s/input%d", gameport->phys, i); 357 snprintf(grip->phys[i], sizeof(grip->phys[i]),
358 "%s/input%d", gameport->phys, i);
358 359
359 input_dev->name = grip_name[grip->mode[i]]; 360 input_dev->name = grip_name[grip->mode[i]];
360 input_dev->phys = grip->phys[i]; 361 input_dev->phys = grip->phys[i];
diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c
index 6e2c721c26ba..840ed9b512b2 100644
--- a/drivers/input/joystick/guillemot.c
+++ b/drivers/input/joystick/guillemot.c
@@ -222,7 +222,7 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver *
222 gameport_set_poll_handler(gameport, guillemot_poll); 222 gameport_set_poll_handler(gameport, guillemot_poll);
223 gameport_set_poll_interval(gameport, 20); 223 gameport_set_poll_interval(gameport, 20);
224 224
225 sprintf(guillemot->phys, "%s/input0", gameport->phys); 225 snprintf(guillemot->phys, sizeof(guillemot->phys), "%s/input0", gameport->phys);
226 guillemot->type = guillemot_type + i; 226 guillemot->type = guillemot_type + i;
227 227
228 input_dev->name = guillemot_type[i].name; 228 input_dev->name = guillemot_type[i].name;
diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c
index c4ed01758226..bbfeb9c59b87 100644
--- a/drivers/input/joystick/interact.c
+++ b/drivers/input/joystick/interact.c
@@ -251,7 +251,7 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d
251 gameport_set_poll_handler(gameport, interact_poll); 251 gameport_set_poll_handler(gameport, interact_poll);
252 gameport_set_poll_interval(gameport, 20); 252 gameport_set_poll_interval(gameport, 20);
253 253
254 sprintf(interact->phys, "%s/input0", gameport->phys); 254 snprintf(interact->phys, sizeof(interact->phys), "%s/input0", gameport->phys);
255 255
256 interact->type = i; 256 interact->type = i;
257 interact->length = interact_type[i].length; 257 interact->length = interact_type[i].length;
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index ca3cc2319d6a..168b1061a03b 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -162,7 +162,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
162 goto fail; 162 goto fail;
163 163
164 magellan->dev = input_dev; 164 magellan->dev = input_dev;
165 sprintf(magellan->phys, "%s/input0", serio->phys); 165 snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
166 166
167 input_dev->name = "LogiCad3D Magellan / SpaceMouse"; 167 input_dev->name = "LogiCad3D Magellan / SpaceMouse";
168 input_dev->phys = magellan->phys; 168 input_dev->phys = magellan->phys;
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
index 95c0de7964a0..e58b22c018e4 100644
--- a/drivers/input/joystick/sidewinder.c
+++ b/drivers/input/joystick/sidewinder.c
@@ -541,7 +541,7 @@ static void sw_print_packet(char *name, int length, unsigned char *buf, char bit
541 * Unfortunately I don't know how to do this for the other SW types. 541 * Unfortunately I don't know how to do this for the other SW types.
542 */ 542 */
543 543
544static void sw_3dp_id(unsigned char *buf, char *comment) 544static void sw_3dp_id(unsigned char *buf, char *comment, size_t size)
545{ 545{
546 int i; 546 int i;
547 char pnp[8], rev[9]; 547 char pnp[8], rev[9];
@@ -554,7 +554,7 @@ static void sw_3dp_id(unsigned char *buf, char *comment)
554 554
555 pnp[7] = rev[8] = 0; 555 pnp[7] = rev[8] = 0;
556 556
557 sprintf(comment, " [PnP %d.%02d id %s rev %s]", 557 snprintf(comment, size, " [PnP %d.%02d id %s rev %s]",
558 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | /* Two 6-bit values */ 558 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | /* Two 6-bit values */
559 sw_get_bits(buf, 16, 6, 1)) / 100, 559 sw_get_bits(buf, 16, 6, 1)) / 100,
560 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | 560 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) |
@@ -695,7 +695,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
695 sw->type = SW_ID_FFP; 695 sw->type = SW_ID_FFP;
696 sprintf(comment, " [AC %s]", sw_get_bits(idbuf,38,1,3) ? "off" : "on"); 696 sprintf(comment, " [AC %s]", sw_get_bits(idbuf,38,1,3) ? "off" : "on");
697 } else 697 } else
698 sw->type = SW_ID_PP; 698 sw->type = SW_ID_PP;
699 break; 699 break;
700 case 66: 700 case 66:
701 sw->bits = 3; 701 sw->bits = 3;
@@ -703,7 +703,8 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
703 sw->length = 22; 703 sw->length = 22;
704 case 64: 704 case 64:
705 sw->type = SW_ID_3DP; 705 sw->type = SW_ID_3DP;
706 if (j == 160) sw_3dp_id(idbuf, comment); 706 if (j == 160)
707 sw_3dp_id(idbuf, comment, sizeof(comment));
707 break; 708 break;
708 } 709 }
709 } 710 }
@@ -733,8 +734,10 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
733 for (i = 0; i < sw->number; i++) { 734 for (i = 0; i < sw->number; i++) {
734 int bits, code; 735 int bits, code;
735 736
736 sprintf(sw->name, "Microsoft SideWinder %s", sw_name[sw->type]); 737 snprintf(sw->name, sizeof(sw->name),
737 sprintf(sw->phys[i], "%s/input%d", gameport->phys, i); 738 "Microsoft SideWinder %s", sw_name[sw->type]);
739 snprintf(sw->phys[i], sizeof(sw->phys[i]),
740 "%s/input%d", gameport->phys, i);
738 741
739 sw->dev[i] = input_dev = input_allocate_device(); 742 sw->dev[i] = input_dev = input_allocate_device();
740 if (!input_dev) { 743 if (!input_dev) {
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
index d6f8db8ec3fd..75eb5ca59992 100644
--- a/drivers/input/joystick/spaceball.c
+++ b/drivers/input/joystick/spaceball.c
@@ -220,7 +220,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
220 goto fail; 220 goto fail;
221 221
222 spaceball->dev = input_dev; 222 spaceball->dev = input_dev;
223 sprintf(spaceball->phys, "%s/input0", serio->phys); 223 snprintf(spaceball->phys, sizeof(spaceball->phys), "%s/input0", serio->phys);
224 224
225 input_dev->name = spaceball_names[id]; 225 input_dev->name = spaceball_names[id];
226 input_dev->phys = spaceball->phys; 226 input_dev->phys = spaceball->phys;
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
index 7c123a01c58e..3e2782e79834 100644
--- a/drivers/input/joystick/spaceorb.c
+++ b/drivers/input/joystick/spaceorb.c
@@ -177,7 +177,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
177 goto fail; 177 goto fail;
178 178
179 spaceorb->dev = input_dev; 179 spaceorb->dev = input_dev;
180 sprintf(spaceorb->phys, "%s/input0", serio->phys); 180 snprintf(spaceorb->phys, sizeof(spaceorb->phys), "%s/input0", serio->phys);
181 181
182 input_dev->name = "SpaceTec SpaceOrb 360 / Avenger"; 182 input_dev->name = "SpaceTec SpaceOrb 360 / Avenger";
183 input_dev->phys = spaceorb->phys; 183 input_dev->phys = spaceorb->phys;
diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
index 0a9ed1d30636..011ec4858e15 100644
--- a/drivers/input/joystick/stinger.c
+++ b/drivers/input/joystick/stinger.c
@@ -148,7 +148,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
148 goto fail; 148 goto fail;
149 149
150 stinger->dev = input_dev; 150 stinger->dev = input_dev;
151 sprintf(stinger->phys, "%s/serio0", serio->phys); 151 snprintf(stinger->phys, sizeof(stinger->phys), "%s/serio0", serio->phys);
152 152
153 input_dev->name = "Gravis Stinger"; 153 input_dev->name = "Gravis Stinger";
154 input_dev->phys = stinger->phys; 154 input_dev->phys = stinger->phys;
diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
index 7f8b0093c5bc..076f237d9654 100644
--- a/drivers/input/joystick/twidjoy.c
+++ b/drivers/input/joystick/twidjoy.c
@@ -199,7 +199,7 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
199 goto fail; 199 goto fail;
200 200
201 twidjoy->dev = input_dev; 201 twidjoy->dev = input_dev;
202 sprintf(twidjoy->phys, "%s/input0", serio->phys); 202 snprintf(twidjoy->phys, sizeof(twidjoy->phys), "%s/input0", serio->phys);
203 203
204 input_dev->name = "Handykey Twiddler"; 204 input_dev->name = "Handykey Twiddler";
205 input_dev->phys = twidjoy->phys; 205 input_dev->phys = twidjoy->phys;
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
index 1849b176cf18..f9c1a03214eb 100644
--- a/drivers/input/joystick/warrior.c
+++ b/drivers/input/joystick/warrior.c
@@ -154,7 +154,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
154 goto fail; 154 goto fail;
155 155
156 warrior->dev = input_dev; 156 warrior->dev = input_dev;
157 sprintf(warrior->phys, "%s/input0", serio->phys); 157 snprintf(warrior->phys, sizeof(warrior->phys), "%s/input0", serio->phys);
158 158
159 input_dev->name = "Logitech WingMan Warrior"; 159 input_dev->name = "Logitech WingMan Warrior";
160 input_dev->phys = warrior->phys; 160 input_dev->phys = warrior->phys;