Lines Matching +full:magic +full:- +full:packet

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 1999-2003 Vojtech Pavlik <vojtech@suse.cz>
38 * Process a PS2++ or PS2T++ packet.
43 struct input_dev *dev = psmouse->dev; in ps2pp_process_byte()
44 u8 *packet = psmouse->packet; in ps2pp_process_byte() local
46 if (psmouse->pktcnt < 3) in ps2pp_process_byte()
50 * Full packet accumulated, process it in ps2pp_process_byte()
53 if ((packet[0] & 0x48) == 0x48 && (packet[1] & 0x02) == 0x02) { in ps2pp_process_byte()
55 /* Logitech extended packet */ in ps2pp_process_byte()
56 switch ((packet[1] >> 4) | (packet[0] & 0x30)) { in ps2pp_process_byte()
61 packet[2] & 0x80 ? REL_HWHEEL : REL_WHEEL, in ps2pp_process_byte()
62 -sign_extend32(packet[2], 3)); in ps2pp_process_byte()
63 input_report_key(dev, BTN_SIDE, packet[2] & BIT(4)); in ps2pp_process_byte()
64 input_report_key(dev, BTN_EXTRA, packet[2] & BIT(5)); in ps2pp_process_byte()
70 input_report_key(dev, BTN_SIDE, packet[2] & BIT(0)); in ps2pp_process_byte()
71 input_report_key(dev, BTN_EXTRA, packet[2] & BIT(1)); in ps2pp_process_byte()
72 input_report_key(dev, BTN_TASK, packet[2] & BIT(2)); in ps2pp_process_byte()
73 input_report_key(dev, BTN_BACK, packet[2] & BIT(3)); in ps2pp_process_byte()
74 input_report_key(dev, BTN_FORWARD, packet[2] & BIT(4)); in ps2pp_process_byte()
81 packet[2] & 0x08 ? REL_HWHEEL : REL_WHEEL, in ps2pp_process_byte()
82 -sign_extend32(packet[2] >> 4, 3)); in ps2pp_process_byte()
83 packet[0] = packet[2] | BIT(3); in ps2pp_process_byte()
88 "Received PS2++ packet #%x, but don't know how to handle.\n", in ps2pp_process_byte()
89 (packet[1] >> 4) | (packet[0] & 0x30)); in ps2pp_process_byte()
93 psmouse_report_standard_buttons(dev, packet[0]); in ps2pp_process_byte()
97 psmouse_report_standard_packet(dev, packet); in ps2pp_process_byte()
117 error = ps2_sliced_command(&psmouse->ps2dev, command); in ps2pp_cmd()
121 error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_POLL | 0x0300); in ps2pp_cmd()
132 * 1 - enabled (if previously disabled, also default)
133 * 0 - disabled
138 struct ps2dev *ps2dev = &psmouse->ps2dev; in ps2pp_set_smartscroll()
155 return sprintf(buf, "%d\n", psmouse->smartscroll); in ps2pp_attr_show_smartscroll()
169 return -EINVAL; in ps2pp_attr_set_smartscroll()
172 psmouse->smartscroll = value; in ps2pp_attr_set_smartscroll()
189 struct ps2dev *ps2dev = &psmouse->ps2dev; in ps2pp_set_resolution()
196 psmouse->resolution = 800; in ps2pp_set_resolution()
203 device_remove_file(&psmouse->ps2dev.serio->dev, in ps2pp_disconnect()
210 { 1, 0, 0 }, /* Simple 2-button mouse */ in get_model_info()
231 { 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */ in get_model_info()
274 struct input_dev *input_dev = psmouse->dev; in ps2pp_set_model_properties()
276 if (model_info->features & PS2PP_SIDE_BTN) in ps2pp_set_model_properties()
279 if (model_info->features & PS2PP_EXTRA_BTN) in ps2pp_set_model_properties()
282 if (model_info->features & PS2PP_TASK_BTN) in ps2pp_set_model_properties()
285 if (model_info->features & PS2PP_NAV_BTN) { in ps2pp_set_model_properties()
290 if (model_info->features & PS2PP_WHEEL) in ps2pp_set_model_properties()
293 if (model_info->features & PS2PP_HWHEEL) in ps2pp_set_model_properties()
296 switch (model_info->kind) { in ps2pp_set_model_properties()
299 psmouse->name = "Wheel Mouse"; in ps2pp_set_model_properties()
303 psmouse->name = "MX Mouse"; in ps2pp_set_model_properties()
307 psmouse->name = "TouchPad 3"; in ps2pp_set_model_properties()
311 psmouse->name = "TrackMan"; in ps2pp_set_model_properties()
321 psmouse->name = "Mouse"; in ps2pp_set_model_properties()
331 psmouse->protocol_handler = ps2pp_process_byte; in ps2pp_setup_protocol()
332 psmouse->pktsize = 3; in ps2pp_setup_protocol()
334 if (model_info->kind != PS2PP_KIND_TP3) { in ps2pp_setup_protocol()
335 psmouse->set_resolution = ps2pp_set_resolution; in ps2pp_setup_protocol()
336 psmouse->disconnect = ps2pp_disconnect; in ps2pp_setup_protocol()
338 error = device_create_file(&psmouse->ps2dev.serio->dev, in ps2pp_setup_protocol()
352 * Logitech magic init. Detect whether the mouse is a Logitech one
359 struct ps2dev *ps2dev = &psmouse->ps2dev; in ps2pp_detect()
378 return -ENXIO; in ps2pp_detect()
384 * Do Logitech PS2++ / PS2T++ magic init. in ps2pp_detect()
386 if (model_info->kind == PS2PP_KIND_TP3) { /* Touch Pad 3 */ in ps2pp_detect()
408 ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ in ps2pp_detect()
426 psmouse->vendor = "Logitech"; in ps2pp_detect()
427 psmouse->model = model; in ps2pp_detect()
436 input_set_capability(psmouse->dev, EV_KEY, BTN_MIDDLE); in ps2pp_detect()
442 return use_ps2pp ? 0 : -ENXIO; in ps2pp_detect()