diff options
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 8bc61237bc1b..27057df7ba74 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -474,19 +474,45 @@ static int psmouse_poll(struct psmouse *psmouse) | |||
474 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); | 474 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); |
475 | } | 475 | } |
476 | 476 | ||
477 | static bool psmouse_check_pnp_id(const char *id, const char * const ids[]) | ||
478 | { | ||
479 | int i; | ||
480 | |||
481 | for (i = 0; ids[i]; i++) | ||
482 | if (!strcasecmp(id, ids[i])) | ||
483 | return true; | ||
484 | |||
485 | return false; | ||
486 | } | ||
487 | |||
477 | /* | 488 | /* |
478 | * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids. | 489 | * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids. |
479 | */ | 490 | */ |
480 | bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) | 491 | bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) |
481 | { | 492 | { |
482 | int i; | 493 | struct serio *serio = psmouse->ps2dev.serio; |
483 | 494 | char *p, *fw_id_copy, *save_ptr; | |
484 | if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) | 495 | bool found = false; |
485 | for (i = 0; ids[i]; i++) | 496 | |
486 | if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i])) | 497 | if (strncmp(serio->firmware_id, "PNP: ", 5)) |
487 | return true; | 498 | return false; |
499 | |||
500 | fw_id_copy = kstrndup(&serio->firmware_id[5], | ||
501 | sizeof(serio->firmware_id) - 5, | ||
502 | GFP_KERNEL); | ||
503 | if (!fw_id_copy) | ||
504 | return false; | ||
505 | |||
506 | save_ptr = fw_id_copy; | ||
507 | while ((p = strsep(&fw_id_copy, " ")) != NULL) { | ||
508 | if (psmouse_check_pnp_id(p, ids)) { | ||
509 | found = true; | ||
510 | break; | ||
511 | } | ||
512 | } | ||
488 | 513 | ||
489 | return false; | 514 | kfree(save_ptr); |
515 | return found; | ||
490 | } | 516 | } |
491 | 517 | ||
492 | /* | 518 | /* |