Lines Matching +full:device +full:- +full:version
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Twin device code is hugely inspired by the ALPS driver.
67 * struct vmmouse_data - private data structure for the vmmouse driver
69 * @abs_dev: "Absolute" device used to report absolute mouse movement.
70 * @phys: Physical path for the absolute device.
71 * @dev_name: Name attribute name for the absolute device.
80 * Hypervisor-specific bi-directional communication channel
102 * vmmouse_report_button - report button state on the correct input device
105 * @abs_dev: The absolute input device
106 * @rel_dev: The relative input device
107 * @pref_dev: The preferred device for reporting
112 * pressed on the other device, in which case the state is reported on that
113 * device.
121 if (test_bit(code, abs_dev->key)) in vmmouse_report_button()
123 else if (test_bit(code, rel_dev->key)) in vmmouse_report_button()
130 * vmmouse_report_events - process events on the vmmouse communications channel
135 * reports them on the correct (absolute or relative) input device. When the
138 * host- or synchronization error, the function returns PSMOUSE_BAD_DATA in
143 struct input_dev *rel_dev = psmouse->dev; in vmmouse_report_events()
144 struct vmmouse_data *priv = psmouse->private; in vmmouse_report_events()
145 struct input_dev *abs_dev = priv->abs_dev; in vmmouse_report_events()
152 while (count--) { in vmmouse_report_events()
179 * events on the same device where we report motion events. in vmmouse_report_events()
182 * preferred device as well. in vmmouse_report_events()
187 input_report_rel(rel_dev, REL_Y, -(s32)y); in vmmouse_report_events()
195 input_report_rel(rel_dev, REL_WHEEL, -(s8)((u8) z)); in vmmouse_report_events()
214 * vmmouse_process_byte - process data on the ps/2 channel
225 unsigned char *packet = psmouse->packet; in vmmouse_process_byte()
227 switch (psmouse->pktcnt) { in vmmouse_process_byte()
241 * vmmouse_disable - Disable vmmouse
259 psmouse_warn(psmouse, "failed to disable vmmouse device\n"); in vmmouse_disable()
263 * vmmouse_enable - Enable vmmouse and request absolute mode.
269 * Returns 0 on success, -ENODEV on failure.
273 u32 status, version; in vmmouse_enable() local
277 * Try enabling the device. If successful, we should be able to in vmmouse_enable()
278 * read valid version ID back from it. in vmmouse_enable()
284 * See if version ID can be retrieved. in vmmouse_enable()
288 psmouse_dbg(psmouse, "empty flags - assuming no device\n"); in vmmouse_enable()
289 return -ENXIO; in vmmouse_enable()
293 version, dummy1, dummy2, dummy3); in vmmouse_enable()
294 if (version != VMMOUSE_VERSION_ID) { in vmmouse_enable()
295 psmouse_dbg(psmouse, "Unexpected version value: %u vs %u\n", in vmmouse_enable()
296 (unsigned) version, VMMOUSE_VERSION_ID); in vmmouse_enable()
298 return -ENXIO; in vmmouse_enable()
322 * vmmouse_check_hypervisor - Check if we're running on a supported hypervisor
336 * vmmouse_detect - Probe whether vmmouse is available
345 u32 response, version, dummy1, dummy2; in vmmouse_detect() local
350 return -ENXIO; in vmmouse_detect()
353 /* Check if the device is present */ in vmmouse_detect()
355 VMMOUSE_CMD(GETVERSION, 0, version, response, dummy1, dummy2); in vmmouse_detect()
356 if (response != VMMOUSE_PROTO_MAGIC || version == 0xffffffffU) in vmmouse_detect()
357 return -ENXIO; in vmmouse_detect()
360 psmouse->vendor = VMMOUSE_VENDOR; in vmmouse_detect()
361 psmouse->name = VMMOUSE_NAME; in vmmouse_detect()
362 psmouse->model = version; in vmmouse_detect()
369 * vmmouse_disconnect - Take down vmmouse driver
377 struct vmmouse_data *priv = psmouse->private; in vmmouse_disconnect()
381 input_unregister_device(priv->abs_dev); in vmmouse_disconnect()
386 * vmmouse_reconnect - Reset the ps/2 - and vmmouse connections
391 * -1 on failure.
402 "Unable to re-enable mouse when reconnecting, err: %d\n", in vmmouse_reconnect()
411 * vmmouse_init - Initialize the vmmouse driver
415 * Requests the device and tries to enable vmmouse mode.
416 * If successful, sets up the input device for relative movement events.
417 * It also allocates another input device and sets it up for absolute motion
418 * events. Returns 0 on success and -1 on failure.
423 struct input_dev *rel_dev = psmouse->dev, *abs_dev; in vmmouse_init()
434 error = -ENOMEM; in vmmouse_init()
438 priv->abs_dev = abs_dev; in vmmouse_init()
439 psmouse->private = priv; in vmmouse_init()
441 /* Set up and register absolute device */ in vmmouse_init()
442 snprintf(priv->phys, sizeof(priv->phys), "%s/input1", in vmmouse_init()
443 psmouse->ps2dev.serio->phys); in vmmouse_init()
445 /* Mimic name setup for relative device in psmouse-base.c */ in vmmouse_init()
446 snprintf(priv->dev_name, sizeof(priv->dev_name), "%s %s %s", in vmmouse_init()
448 abs_dev->phys = priv->phys; in vmmouse_init()
449 abs_dev->name = priv->dev_name; in vmmouse_init()
450 abs_dev->id.bustype = BUS_I8042; in vmmouse_init()
451 abs_dev->id.vendor = 0x0002; in vmmouse_init()
452 abs_dev->id.product = PSMOUSE_VMMOUSE; in vmmouse_init()
453 abs_dev->id.version = psmouse->model; in vmmouse_init()
454 abs_dev->dev.parent = &psmouse->ps2dev.serio->dev; in vmmouse_init()
456 /* Set absolute device capabilities */ in vmmouse_init()
465 error = input_register_device(priv->abs_dev); in vmmouse_init()
469 /* Add wheel capability to the relative device */ in vmmouse_init()
472 psmouse->protocol_handler = vmmouse_process_byte; in vmmouse_init()
473 psmouse->disconnect = vmmouse_disconnect; in vmmouse_init()
474 psmouse->reconnect = vmmouse_reconnect; in vmmouse_init()
483 psmouse->private = NULL; in vmmouse_init()