ps2mouse.c (4c87aefe) ps2mouse.c (154972af)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2015 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
5 * Copyright (c) 2015 Nahanni Systems Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 27 unchanged lines hidden (view full) ---

36#include <stdbool.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <strings.h>
40#include <pthread.h>
41#include <pthread_np.h>
42
43#include "atkbdc.h"
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2015 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
5 * Copyright (c) 2015 Nahanni Systems Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 27 unchanged lines hidden (view full) ---

36#include <stdbool.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <strings.h>
40#include <pthread.h>
41#include <pthread_np.h>
42
43#include "atkbdc.h"
44#include "debug.h"
44#include "console.h"
45
46/* mouse device commands */
47#define PS2MC_RESET_DEV 0xff
48#define PS2MC_SET_DEFAULTS 0xf6
49#define PS2MC_DISABLE 0xf5
50#define PS2MC_ENABLE 0xf4
51#define PS2MC_SET_SAMPLING_RATE 0xf3

--- 232 unchanged lines hidden (view full) ---

284 sc->sampling_rate = val;
285 fifo_put(sc, PS2MC_ACK);
286 break;
287 case PS2MC_SET_RESOLUTION:
288 sc->resolution = val;
289 fifo_put(sc, PS2MC_ACK);
290 break;
291 default:
45#include "console.h"
46
47/* mouse device commands */
48#define PS2MC_RESET_DEV 0xff
49#define PS2MC_SET_DEFAULTS 0xf6
50#define PS2MC_DISABLE 0xf5
51#define PS2MC_ENABLE 0xf4
52#define PS2MC_SET_SAMPLING_RATE 0xf3

--- 232 unchanged lines hidden (view full) ---

285 sc->sampling_rate = val;
286 fifo_put(sc, PS2MC_ACK);
287 break;
288 case PS2MC_SET_RESOLUTION:
289 sc->resolution = val;
290 fifo_put(sc, PS2MC_ACK);
291 break;
292 default:
292 fprintf(stderr, "Unhandled ps2 mouse current "
293 "command byte 0x%02x\n", val);
293 EPRINTLN("Unhandled ps2 mouse current "
294 "command byte 0x%02x", val);
294 break;
295 }
296 sc->curcmd = 0;
297
298 } else if (insert) {
299 fifo_put(sc, val);
300 } else {
301 switch (val) {

--- 51 unchanged lines hidden (view full) ---

353 fifo_put(sc, PS2MC_ACK);
354 break;
355 case PS2MC_SET_SCALING1:
356 case PS2MC_SET_SCALING2:
357 fifo_put(sc, PS2MC_ACK);
358 break;
359 default:
360 fifo_put(sc, PS2MC_ACK);
295 break;
296 }
297 sc->curcmd = 0;
298
299 } else if (insert) {
300 fifo_put(sc, val);
301 } else {
302 switch (val) {

--- 51 unchanged lines hidden (view full) ---

354 fifo_put(sc, PS2MC_ACK);
355 break;
356 case PS2MC_SET_SCALING1:
357 case PS2MC_SET_SCALING2:
358 fifo_put(sc, PS2MC_ACK);
359 break;
360 default:
361 fifo_put(sc, PS2MC_ACK);
361 fprintf(stderr, "Unhandled ps2 mouse command "
362 "0x%02x\n", val);
362 EPRINTLN("Unhandled ps2 mouse command "
363 "0x%02x", val);
363 break;
364 }
365 }
366 pthread_mutex_unlock(&sc->mtx);
367}
368
369static void
370ps2mouse_event(uint8_t button, int x, int y, void *arg)

--- 48 unchanged lines hidden ---
364 break;
365 }
366 }
367 pthread_mutex_unlock(&sc->mtx);
368}
369
370static void
371ps2mouse_event(uint8_t button, int x, int y, void *arg)

--- 48 unchanged lines hidden ---