Deleted Added
sdiff udiff text old ( 233090 ) new ( 240891 )
full compact
1/**
2 ** Copyright (c) 1995 Michael Smith, All rights reserved.
3 **
4 ** Redistribution and use in source and binary forms, with or without
5 ** modification, are permitted provided that the following conditions
6 ** are met:
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer as

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

40 **
41 ** The mouse interface functions are derived closely from the mouse
42 ** handler in the XFree86 X server. Many thanks to the XFree86 people
43 ** for their great work!
44 **
45 **/
46
47#include <sys/cdefs.h>
48__FBSDID("$FreeBSD: head/usr.sbin/moused/moused.c 233090 2012-03-17 16:40:15Z hselasky $");
49
50#include <sys/param.h>
51#include <sys/consio.h>
52#include <sys/mouse.h>
53#include <sys/socket.h>
54#include <sys/stat.h>
55#include <sys/time.h>
56#include <sys/un.h>

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

403 int rate; /* report rate */
404 int resolution; /* MOUSE_RES_XXX or a positive number */
405 int zmap[4]; /* MOUSE_{X|Y}AXIS or a button number */
406 int wmode; /* wheel mode button number */
407 int mfd; /* mouse file descriptor */
408 int cfd; /* /dev/consolectl file descriptor */
409 int mremsfd; /* mouse remote server file descriptor */
410 int mremcfd; /* mouse remote client file descriptor */
411 long clickthreshold; /* double click speed in msec */
412 long button2timeout; /* 3 button emulation timeout */
413 mousehw_t hw; /* mouse device hardware information */
414 mousemode_t mode; /* protocol information */
415 float accelx; /* Acceleration in the X axis */
416 float accely; /* Acceleration in the Y axis */
417 float expoaccel; /* Exponential acceleration */
418 float expoffset; /* Movement offset for exponential accel. */

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

429 .rate = 0,
430 .resolution = MOUSE_RES_UNKNOWN,
431 .zmap = { 0, 0, 0, 0 },
432 .wmode = 0,
433 .mfd = -1,
434 .cfd = -1,
435 .mremsfd = -1,
436 .mremcfd = -1,
437 .clickthreshold = DFLT_CLICKTHRESHOLD,
438 .button2timeout = DFLT_BUTTON2TIMEOUT,
439 .accelx = 1.0,
440 .accely = 1.0,
441 .expoaccel = 1.0,
442 .expoffset = 1.0,
443 .remainx = 0.0,
444 .remainy = 0.0,

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

565static int gtco_digipad(u_char, mousestatus_t *);
566
567int
568main(int argc, char *argv[])
569{
570 int c;
571 int i;
572 int j;
573 static int retry;
574
575 for (i = 0; i < MOUSE_MAXBUTTON; ++i)
576 mstate[i] = &bstate[i];
577
578 while ((c = getopt(argc, argv, "3A:C:DE:F:HI:L:PRS:T:VU:a:cdfhi:l:m:p:r:st:w:z:")) != -1)
579 switch(c) {
580
581 case '3':

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

871
872 default:
873 if (rodent.portname)
874 break;
875 warnx("no port name specified");
876 usage();
877 }
878
879 retry = 1;
880 if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
881 retry = 5;
882 }
883
884 for (;;) {
885 if (setjmp(env) == 0) {
886 signal(SIGHUP, hup);
887 signal(SIGINT , cleanup);
888 signal(SIGQUIT, cleanup);
889 signal(SIGTERM, cleanup);
890 signal(SIGUSR1, pause_mouse);
891 for (i = 0; i < retry; ++i) {
892 if (i > 0)
893 sleep(2);
894 rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
895 if (rodent.mfd != -1 || errno != ENOENT)
896 break;
897 }
898 if (rodent.mfd == -1)
899 logerr(1, "unable to open %s", rodent.portname);
900 if (r_identify() == MOUSE_PROTO_UNKNOWN) {
901 logwarnx("cannot determine mouse type on %s", rodent.portname);
902 close(rodent.mfd);
903 rodent.mfd = -1;
904 }
905

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

939 moused();
940 }
941
942 if (rodent.mfd != -1)
943 close(rodent.mfd);
944 if (rodent.cfd != -1)
945 close(rodent.cfd);
946 rodent.mfd = rodent.cfd = -1;
947 }
948 /* NOT REACHED */
949
950 exit(0);
951}
952
953/*
954 * Function to calculate linear acceleration.

--- 2476 unchanged lines hidden ---