Date: Wed, 9 Apr 2008 05:37:25 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 139632 for review Message-ID: <200804090537.m395bPOh046793@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=139632 Change 139632 by sam@sam_ebb on 2008/04/09 05:36:24 IFC @ 139631 Affected files ... .. //depot/projects/vap/UPDATING#7 integrate .. //depot/projects/vap/etc/defaults/rc.conf#9 integrate .. //depot/projects/vap/etc/rc.d/Makefile#5 integrate .. //depot/projects/vap/etc/rc.d/rfcomm_pppd_server#1 branch .. //depot/projects/vap/etc/rc.d/wpa_supplicant#6 integrate .. //depot/projects/vap/share/man/man4/psm.4#3 integrate .. //depot/projects/vap/share/man/man5/rc.conf.5#7 integrate .. //depot/projects/vap/sys/dev/atkbdc/psm.c#4 integrate .. //depot/projects/vap/sys/ia64/ia64/sscdisk.c#6 integrate .. //depot/projects/vap/sys/kern/subr_taskqueue.c#8 integrate .. //depot/projects/vap/sys/kern/vfs_mount.c#12 integrate .. //depot/projects/vap/sys/netinet/ip_input.c#7 integrate .. //depot/projects/vap/sys/netinet/ip_ipsec.c#4 integrate .. //depot/projects/vap/sys/netinet/ip_ipsec.h#3 integrate .. //depot/projects/vap/sys/powerpc/include/atomic.h#8 integrate .. //depot/projects/vap/sys/sys/eventhandler.h#7 integrate .. //depot/projects/vap/sys/sys/kernel.h#9 integrate .. //depot/projects/vap/sys/sys/param.h#16 integrate .. //depot/projects/vap/usr.sbin/sysinstall/menus.c#5 integrate Differences ... ==== //depot/projects/vap/UPDATING#7 (text+ko) ==== @@ -22,6 +22,13 @@ to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20080408: + psm(4) has gained write(2) support in native operation level. + Arbitrary commands can be written to /dev/psm%d and status can + be read back from it. Therefore, an application is responsible + for status validation and error recovery. It is a no-op in + other operation levels. + 20080312: Support for KSE threading has been removed from the kernel. To run legacy applications linked against KSE libmap.conf may @@ -1007,4 +1014,4 @@ Contact Warner Losh if you have any questions about your use of this document. -$FreeBSD: src/UPDATING,v 1.523 2008/03/12 09:48:42 jeff Exp $ +$FreeBSD: src/UPDATING,v 1.524 2008/04/08 17:55:25 jkim Exp $ ==== //depot/projects/vap/etc/defaults/rc.conf#9 (text+ko) ==== @@ -15,7 +15,7 @@ # For a more detailed explanation of all the rc.conf variables, please # refer to the rc.conf(5) manual page. # -# $FreeBSD: src/etc/defaults/rc.conf,v 1.328 2008/03/06 14:01:10 mtm Exp $ +# $FreeBSD: src/etc/defaults/rc.conf,v 1.330 2008/04/08 23:50:03 emax Exp $ ############################################################## ### Important initial Boot-time options #################### @@ -384,6 +384,19 @@ bthidd_config="/etc/bluetooth/bthidd.conf" # bthidd(8) configuration file bthidd_hids="/var/db/bthidd.hids" # bthidd(8) known HID devices file +rfcomm_pppd_server_enable="NO" # Enable rfcomm_pppd(8) in server mode (or NO) +rfcomm_pppd_server_profile="one two" # Profile to use from /etc/ppp/ppp.conf +# +#rfcomm_pppd_server_one_bdaddr="" # Override local bdaddr for 'one' +rfcomm_pppd_server_one_channel="1" # Override local channel for 'one' +#rfcomm_pppd_server_one_register_sp="NO" # Override SP and DUN register +#rfcomm_pppd_server_one_register_dun="NO" # for 'one' +# +#rfcomm_pppd_server_two_bdaddr="" # Override local bdaddr for 'two' +rfcomm_pppd_server_two_channel="3" # Override local channel for 'two' +#rfcomm_pppd_server_two_register_sp="NO" # Override SP and DUN register +#rfcomm_pppd_server_two_register_dun="NO" # for 'two' + ### Miscellaneous network options: ### icmp_bmcastecho="NO" # respond to broadcast ping packets ==== //depot/projects/vap/etc/rc.d/Makefile#5 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/etc/rc.d/Makefile,v 1.89 2008/03/05 18:32:58 brooks Exp $ +# $FreeBSD: src/etc/rc.d/Makefile,v 1.90 2008/04/08 23:34:12 emax Exp $ .include <bsd.own.mk> @@ -29,7 +29,7 @@ pf pflog pfsync \ powerd power_profile ppp pppoed pwcheck \ quota \ - random rarpd resolv root \ + random rarpd resolv rfcomm_pppd_server root \ route6d routed routing rpcbind rtadvd rwho \ savecore sdpd securelevel sendmail \ serial sppp statd swap1 \ ==== //depot/projects/vap/etc/rc.d/wpa_supplicant#6 (text+ko) ==== @@ -1,6 +1,6 @@ #!/bin/sh # -# $FreeBSD: src/etc/rc.d/wpa_supplicant,v 1.2 2005/10/19 22:26:47 jkim Exp $ +# $FreeBSD: src/etc/rc.d/wpa_supplicant,v 1.5 2008/04/08 23:12:15 sam Exp $ # # PROVIDE: wpa_supplicant @@ -20,15 +20,14 @@ is_wired_interface() { - media= - ifconfig $1 2>/dev/null | while read line; do + media=`ifconfig $1 2>/dev/null | while read line; do case "$line" in - *media:*Ethernet*) - media="Ethernet" + *media:?Ethernet*) + echo Ethernet ;; esac - done - test -z "$media" + done` + test "$media" = "Ethernet" } case ${ifn} in @@ -49,7 +48,7 @@ command=${wpa_supplicant_program} conf_file=${wpa_supplicant_conf_file} pidfile="/var/run/${name}/${ifn}.pid" -command_args="-B ${wpa_supplicant_flags} -i $ifn -c $conf_file -D $driver -P $pidfile" +command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile" required_files=$conf_file run_rc_command "$1" ==== //depot/projects/vap/share/man/man4/psm.4#3 (text+ko) ==== @@ -24,9 +24,9 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/psm.4,v 1.48 2005/07/15 17:35:25 hrs Exp $ +.\" $FreeBSD: src/share/man/man4/psm.4,v 1.49 2008/04/08 17:55:25 jkim Exp $ .\" -.Dd September 29, 2004 +.Dd April 8, 2008 .Dt PSM 4 .Os .Sh NAME @@ -110,7 +110,9 @@ 8 byte data packets are sent to the user program at this level. .Pp At the operation level two, data from the pointing device is passed to the -user program as is. +user program as is. Conversely, command from the user program is passed +to the pointing device as is and the user program is responsible for +status validation and error recovery. Modern PS/2 type pointing devices often use proprietary data format. Therefore, the user program is expected to have intimate knowledge about the format from a particular device when operating ==== //depot/projects/vap/share/man/man5/rc.conf.5#7 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.337 2008/03/28 07:57:52 brooks Exp $ +.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.338 2008/04/08 23:34:12 emax Exp $ .\" .Dd January 27, 2008 .Dt RC.CONF 5 @@ -3880,6 +3880,108 @@ If set to .Dq Li YES , enable support for sound mixer. +.It Va hcsecd_enable +.Pq Vt bool +If set to +.Dq Li YES , +enable Bluetooth security daemon. +.It Va hcsecd_config +.Pq Vt str +Configuration file for +.Xr hcsecd 8 . +Default +.Pa /etc/bluetooth/hcsecd.conf . +.It Va sdpd_enable +.Pq Vt bool +If set to +.Dq Li YES , +enable Bluetooth Service Discovery Protocol daemon. +.It Va sdpd_control +.Pq Vt str +Path to +.Xr sdpd 8 +control socket. +Default +.Pa /var/run/sdp . +.It Va sdpd_groupname +.Pq Vt str +Sets +.Xr sdpd 8 +group to run as after it initializes. +Default +.Dq Li nobody . +.It Va sdpd_username +.Pq Vt str +Sets +.Xr sdpd 8 +user to run as after it initializes. +Default +.Dq Li nobody . +.It Va bthidd_enable +.Pq Vt bool +If set to +.Dq Li YES , +enable Bluetooth Human Interface Device daemon. +.It Va bthidd_config +.Pq Vt str +Configuration file for +.Xr bthidd 8 . +Default +.Pa /etc/bluetooth/bthidd.conf . +.It Va bthidd_hids +.Pq Vt str +Path to a file, where +.Xr bthidd 8 +will store information about known HID devices. +Default +.Pa /var/db/bthidd.hids . +.It Va rfcomm_pppd_server_enable +.Pq Vt bool +If set to +.Dq Li YES , +enable Bluetooth RFCOMM PPP wrapper daemon. +.It Va rfcomm_pppd_server_profile +.Pq Vt str +The name of the profile to use from +.Pa /etc/ppp/ppp.conf . +Multiple profiles can be specified here. +Also used to specify per-profile overrides. +When the profile name contains any of the characters +.Dq Li .-/+ +they are translated to +.Dq Li _ +for the proposes of the override variable names. +.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _bdaddr +.Pq Vt str +Overrides local address to listen on. +By default +.Xr rfcomm_pppd 8 +will listen on +.Dq Li ANY +address. +The address can be specified as BD_ADDR or name. +.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _channel +.Pq Vt str +Overrides local RFCOMM channel to listen on. +By default +.Xr rfcomm_pppd 8 +will listen on RFCOMM channel 1. +Must set properly if multiple profiles used in the same time. +.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _register_sp +.Pq Vt bool +Tells +.Xr rfcomm_pppd 8 +if it should register Serial Port service on the speficied RFCOMM channel. +Default +.Dq Li NO . +.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _register_dun +.Pq Vt bool +Tells +.Xr rfcomm_pppd 8 +if it should register Dial-Up Networking service on the speficied +RFCOMM channel. +Default +.Dq Li NO . .El .Sh FILES .Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact @@ -3920,12 +4022,14 @@ .Xr amd 8 , .Xr apm 8 , .Xr atm 8 , +.Xr bthidd 8 , .Xr chkprintcap 8 , .Xr chown 8 , .Xr cron 8 , .Xr dhclient 8 , .Xr ftpd 8 , .Xr geli 8 , +.Xr hcsecd 8 , .Xr ifconfig 8 , .Xr inetd 8 , .Xr ipf 8 , @@ -3955,6 +4059,7 @@ .Xr quotaon 8 , .Xr rc 8 , .Xr rc.sendmail 8 , +.Xr rfcomm_pppd 8 , .Xr route 8 , .Xr routed 8 , .Xr rpcbind 8 , @@ -3962,6 +4067,7 @@ .Xr rpc.statd 8 , .Xr rwhod 8 , .Xr savecore 8 , +.Xr sdpd 8 , .Xr sshd 8 , .Xr swapon 8 , .Xr sysctl 8 , ==== //depot/projects/vap/sys/dev/atkbdc/psm.c#4 (text+ko) ==== @@ -50,16 +50,16 @@ * - 12 November 1996. IOCTLs and rearranging `psmread', `psmioctl'... * - 14, 30 November 1996. Uses `kbdio.c'. * - 13 December 1996. Uses queuing version of `kbdio.c'. - * - January/February 1997. Tweaked probe logic for + * - January/February 1997. Tweaked probe logic for * HiNote UltraII/Latitude/Armada laptops. * - 30 July 1997. Added APM support. - * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX). + * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX). * Improved sync check logic. * Vendor specific support routines. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/atkbdc/psm.c,v 1.94 2008/02/25 13:57:18 rink Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/atkbdc/psm.c,v 1.96 2008/04/08 19:09:45 jkim Exp $"); #include "opt_isa.h" #include "opt_psm.h" @@ -97,158 +97,159 @@ /* debugging */ #ifndef PSM_DEBUG -#define PSM_DEBUG 0 /* +#define PSM_DEBUG 0 /* * logging: 0: none, 1: brief, 2: verbose * 3: sync errors, 4: all packets */ #endif -#define VLOG(level, args) \ -do { \ - if (verbose >= level) \ - log args; \ +#define VLOG(level, args) do { \ + if (verbose >= level) \ + log args; \ } while (0) #ifndef PSM_INPUT_TIMEOUT -#define PSM_INPUT_TIMEOUT 2000000 /* 2 sec */ +#define PSM_INPUT_TIMEOUT 2000000 /* 2 sec */ #endif #ifndef PSM_TAP_TIMEOUT -#define PSM_TAP_TIMEOUT 125000 +#define PSM_TAP_TIMEOUT 125000 #endif #ifndef PSM_TAP_THRESHOLD -#define PSM_TAP_THRESHOLD 25 +#define PSM_TAP_THRESHOLD 25 #endif /* end of driver specific options */ -#define PSMCPNP_DRIVER_NAME "psmcpnp" +#define PSMCPNP_DRIVER_NAME "psmcpnp" /* input queue */ -#define PSM_BUFSIZE 960 -#define PSM_SMALLBUFSIZE 240 +#define PSM_BUFSIZE 960 +#define PSM_SMALLBUFSIZE 240 /* operation levels */ -#define PSM_LEVEL_BASE 0 -#define PSM_LEVEL_STANDARD 1 -#define PSM_LEVEL_NATIVE 2 -#define PSM_LEVEL_MIN PSM_LEVEL_BASE -#define PSM_LEVEL_MAX PSM_LEVEL_NATIVE +#define PSM_LEVEL_BASE 0 +#define PSM_LEVEL_STANDARD 1 +#define PSM_LEVEL_NATIVE 2 +#define PSM_LEVEL_MIN PSM_LEVEL_BASE +#define PSM_LEVEL_MAX PSM_LEVEL_NATIVE /* Logitech PS2++ protocol */ -#define MOUSE_PS2PLUS_CHECKBITS(b) \ - ((((b[2] & 0x03) << 2) | 0x02) == (b[1] & 0x0f)) -#define MOUSE_PS2PLUS_PACKET_TYPE(b) \ - (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4)) +#define MOUSE_PS2PLUS_CHECKBITS(b) \ + ((((b[2] & 0x03) << 2) | 0x02) == (b[1] & 0x0f)) +#define MOUSE_PS2PLUS_PACKET_TYPE(b) \ + (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4)) /* some macros */ -#define PSM_UNIT(dev) (minor(dev) >> 1) -#define PSM_NBLOCKIO(dev) (minor(dev) & 1) -#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1)) +#define PSM_UNIT(dev) (minor(dev) >> 1) +#define PSM_NBLOCKIO(dev) (minor(dev) & 1) +#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1)) /* ring buffer */ typedef struct ringbuf { - int count; /* # of valid elements in the buffer */ - int head; /* head pointer */ - int tail; /* tail poiner */ - unsigned char buf[PSM_BUFSIZE]; + int count; /* # of valid elements in the buffer */ + int head; /* head pointer */ + int tail; /* tail poiner */ + u_char buf[PSM_BUFSIZE]; } ringbuf_t; /* data buffer */ typedef struct packetbuf { - unsigned char ipacket[16]; /* interim input buffer */ - int inputbytes; /* # of bytes in the input buffer */ + u_char ipacket[16]; /* interim input buffer */ + int inputbytes; /* # of bytes in the input buffer */ } packetbuf_t; #ifndef PSM_PACKETQUEUE -#define PSM_PACKETQUEUE 128 +#define PSM_PACKETQUEUE 128 #endif typedef struct synapticsinfo { - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; - int directional_scrolls; - int low_speed_threshold; - int min_movement; - int squelch_level; + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; + int directional_scrolls; + int low_speed_threshold; + int min_movement; + int squelch_level; } synapticsinfo_t; /* driver control block */ struct psm_softc { /* Driver status information */ - int unit; - struct selinfo rsel; /* Process selecting for Input */ - unsigned char state; /* Mouse driver state */ - int config; /* driver configuration flags */ - int flags; /* other flags */ - KBDC kbdc; /* handle to access the keyboard controller */ - struct resource *intr; /* IRQ resource */ - void *ih; /* interrupt handle */ - mousehw_t hw; /* hardware information */ - synapticshw_t synhw; /* Synaptics-specific hardware information */ - synapticsinfo_t syninfo; /* Synaptics-specific configuration */ - mousemode_t mode; /* operation mode */ - mousemode_t dflt_mode; /* default operation mode */ - mousestatus_t status; /* accumulated mouse movement */ - ringbuf_t queue; /* mouse status queue */ - packetbuf_t pqueue[PSM_PACKETQUEUE]; /* mouse data queue */ - int pqueue_start; /* start of data in queue */ - int pqueue_end; /* end of data in queue */ - int button; /* the latest button state */ - int xold; /* previous absolute X position */ - int yold; /* previous absolute Y position */ - int xaverage; /* average X position */ - int yaverage; /* average Y position */ - int squelch; /* level to filter movement data at low speed */ - int zmax; /* maximum pressure value for touchpads */ - int syncerrors; /* # of bytes discarded searching for sync */ - int pkterrors; /* # of packets failed during quaranteen. */ - struct timeval inputtimeout; - struct timeval lastsoftintr; /* time of last soft interrupt */ - struct timeval lastinputerr; /* time last sync error happened */ - struct timeval taptimeout; /* tap timeout for touchpads */ - int watchdog; /* watchdog timer flag */ - struct callout_handle callout; /* watchdog timer call out */ - struct callout_handle softcallout; /* buffer timer call out */ - struct cdev *dev; - struct cdev *bdev; - int lasterr; - int cmdcount; + int unit; + struct selinfo rsel; /* Process selecting for Input */ + u_char state; /* Mouse driver state */ + int config; /* driver configuration flags */ + int flags; /* other flags */ + KBDC kbdc; /* handle to access kbd controller */ + struct resource *intr; /* IRQ resource */ + void *ih; /* interrupt handle */ + mousehw_t hw; /* hardware information */ + synapticshw_t synhw; /* Synaptics hardware information */ + synapticsinfo_t syninfo; /* Synaptics configuration */ + mousemode_t mode; /* operation mode */ + mousemode_t dflt_mode; /* default operation mode */ + mousestatus_t status; /* accumulated mouse movement */ + ringbuf_t queue; /* mouse status queue */ + packetbuf_t pqueue[PSM_PACKETQUEUE]; /* mouse data queue */ + int pqueue_start; /* start of data in queue */ + int pqueue_end; /* end of data in queue */ + int button; /* the latest button state */ + int xold; /* previous absolute X position */ + int yold; /* previous absolute Y position */ + int xaverage; /* average X position */ + int yaverage; /* average Y position */ + int squelch; /* level to filter movement at low speed */ + int zmax; /* maximum pressure value for touchpads */ + int syncerrors; /* # of bytes discarded to synchronize */ + int pkterrors; /* # of packets failed during quaranteen. */ + struct timeval inputtimeout; + struct timeval lastsoftintr; /* time of last soft interrupt */ + struct timeval lastinputerr; /* time last sync error happened */ + struct timeval taptimeout; /* tap timeout for touchpads */ + int watchdog; /* watchdog timer flag */ + struct callout_handle callout; /* watchdog timer call out */ + struct callout_handle softcallout; /* buffer timer call out */ + struct cdev *dev; + struct cdev *bdev; + int lasterr; + int cmdcount; }; static devclass_t psm_devclass; -#define PSM_SOFTC(unit) ((struct psm_softc*)devclass_get_softc(psm_devclass, unit)) +#define PSM_SOFTC(unit) \ + ((struct psm_softc*)devclass_get_softc(psm_devclass, unit)) /* driver state flags (state) */ -#define PSM_VALID 0x80 -#define PSM_OPEN 1 /* Device is open */ -#define PSM_ASLP 2 /* Waiting for mouse data */ -#define PSM_SOFTARMED 4 /* Software interrupt armed */ -#define PSM_NEED_SYNCBITS 8 /* Set syncbits using next data pkt */ +#define PSM_VALID 0x80 +#define PSM_OPEN 1 /* Device is open */ +#define PSM_ASLP 2 /* Waiting for mouse data */ +#define PSM_SOFTARMED 4 /* Software interrupt armed */ +#define PSM_NEED_SYNCBITS 8 /* Set syncbits using next data pkt */ /* driver configuration flags (config) */ -#define PSM_CONFIG_RESOLUTION 0x000f /* resolution */ -#define PSM_CONFIG_ACCEL 0x00f0 /* acceleration factor */ -#define PSM_CONFIG_NOCHECKSYNC 0x0100 /* disable sync. test */ -#define PSM_CONFIG_NOIDPROBE 0x0200 /* disable mouse model probe */ -#define PSM_CONFIG_NORESET 0x0400 /* don't reset the mouse */ -#define PSM_CONFIG_FORCETAP 0x0800 /* assume `tap' action exists */ -#define PSM_CONFIG_IGNPORTERROR 0x1000 /* ignore error in aux port test */ -#define PSM_CONFIG_HOOKRESUME 0x2000 /* hook the system resume event */ -#define PSM_CONFIG_INITAFTERSUSPEND 0x4000 /* init the device at the resume event */ -#define PSM_CONFIG_SYNCHACK 0x8000 /* enable `out-of-sync' hack */ +#define PSM_CONFIG_RESOLUTION 0x000f /* resolution */ +#define PSM_CONFIG_ACCEL 0x00f0 /* acceleration factor */ +#define PSM_CONFIG_NOCHECKSYNC 0x0100 /* disable sync. test */ +#define PSM_CONFIG_NOIDPROBE 0x0200 /* disable mouse model probe */ +#define PSM_CONFIG_NORESET 0x0400 /* don't reset the mouse */ +#define PSM_CONFIG_FORCETAP 0x0800 /* assume `tap' action exists */ +#define PSM_CONFIG_IGNPORTERROR 0x1000 /* ignore error in aux port test */ +#define PSM_CONFIG_HOOKRESUME 0x2000 /* hook the system resume event */ +#define PSM_CONFIG_INITAFTERSUSPEND 0x4000 /* init the device at the resume event */ +#define PSM_CONFIG_SYNCHACK 0x8000 /* enable `out-of-sync' hack */ -#define PSM_CONFIG_FLAGS (PSM_CONFIG_RESOLUTION \ - | PSM_CONFIG_ACCEL \ - | PSM_CONFIG_NOCHECKSYNC \ - | PSM_CONFIG_SYNCHACK \ - | PSM_CONFIG_NOIDPROBE \ - | PSM_CONFIG_NORESET \ - | PSM_CONFIG_FORCETAP \ - | PSM_CONFIG_IGNPORTERROR \ - | PSM_CONFIG_HOOKRESUME \ - | PSM_CONFIG_INITAFTERSUSPEND) +#define PSM_CONFIG_FLAGS \ + (PSM_CONFIG_RESOLUTION | \ + PSM_CONFIG_ACCEL | \ + PSM_CONFIG_NOCHECKSYNC | \ + PSM_CONFIG_SYNCHACK | \ + PSM_CONFIG_NOIDPROBE | \ + PSM_CONFIG_NORESET | \ + PSM_CONFIG_FORCETAP | \ + PSM_CONFIG_IGNPORTERROR | \ + PSM_CONFIG_HOOKRESUME | \ + PSM_CONFIG_INITAFTERSUSPEND) /* other flags (flags) */ -#define PSM_FLAGS_FINGERDOWN 0x0001 /* VersaPad finger down */ +#define PSM_FLAGS_FINGERDOWN 0x0001 /* VersaPad finger down */ /* Tunables */ static int synaptics_support = 0; @@ -258,119 +259,129 @@ TUNABLE_INT("debug.psm.loglevel", &verbose); /* for backward compatibility */ -#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t) -#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t) -#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t) +#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t) +#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t) +#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t) typedef struct old_mousehw { - int buttons; - int iftype; - int type; - int hwid; + int buttons; + int iftype; + int type; + int hwid; } old_mousehw_t; typedef struct old_mousemode { - int protocol; - int rate; - int resolution; - int accelfactor; + int protocol; + int rate; + int resolution; + int accelfactor; } old_mousemode_t; /* packet formatting function */ -typedef int packetfunc_t(struct psm_softc *, unsigned char *, - int *, int, mousestatus_t *); +typedef int packetfunc_t(struct psm_softc *, u_char *, int *, int, + mousestatus_t *); /* function prototypes */ -static void psmidentify(driver_t *, device_t); -static int psmprobe(device_t); -static int psmattach(device_t); -static int psmdetach(device_t); -static int psmresume(device_t); +static void psmidentify(driver_t *, device_t); +static int psmprobe(device_t); +static int psmattach(device_t); +static int psmdetach(device_t); +static int psmresume(device_t); -static d_open_t psmopen; -static d_close_t psmclose; -static d_read_t psmread; -static d_ioctl_t psmioctl; -static d_poll_t psmpoll; +static d_open_t psmopen; +static d_close_t psmclose; +static d_read_t psmread; +static d_write_t psmwrite; +static d_ioctl_t psmioctl; +static d_poll_t psmpoll; -static int enable_aux_dev(KBDC); -static int disable_aux_dev(KBDC); -static int get_mouse_status(KBDC, int *, int, int); -static int get_aux_id(KBDC); -static int set_mouse_sampling_rate(KBDC, int); -static int set_mouse_scaling(KBDC, int); -static int set_mouse_resolution(KBDC, int); -static int set_mouse_mode(KBDC); -static int get_mouse_buttons(KBDC); -static int is_a_mouse(int); -static void recover_from_error(KBDC); -static int restore_controller(KBDC, int); -static int doinitialize(struct psm_softc *, mousemode_t *); -static int doopen(struct psm_softc *, int); -static int reinitialize(struct psm_softc *, int); -static char *model_name(int); -static void psmsoftintr(void *); -static void psmintr(void *); -static void psmtimeout(void *); -static int timeelapsed(const struct timeval *, - int, int, const struct timeval *); -static void dropqueue(struct psm_softc *); -static void flushpackets(struct psm_softc *); +static int enable_aux_dev(KBDC); +static int disable_aux_dev(KBDC); +static int get_mouse_status(KBDC, int *, int, int); +static int get_aux_id(KBDC); +static int set_mouse_sampling_rate(KBDC, int); +static int set_mouse_scaling(KBDC, int); +static int set_mouse_resolution(KBDC, int); +static int set_mouse_mode(KBDC); +static int get_mouse_buttons(KBDC); +static int is_a_mouse(int); +static void recover_from_error(KBDC); +static int restore_controller(KBDC, int); +static int doinitialize(struct psm_softc *, mousemode_t *); +static int doopen(struct psm_softc *, int); +static int reinitialize(struct psm_softc *, int); +static char *model_name(int); +static void psmsoftintr(void *); +static void psmintr(void *); +static void psmtimeout(void *); +static int timeelapsed(const struct timeval *, int, int, + const struct timeval *); +static void dropqueue(struct psm_softc *); +static void flushpackets(struct psm_softc *); +static void proc_mmanplus(struct psm_softc *, packetbuf_t *, + mousestatus_t *, int *, int *, int *); +static int proc_synaptics(struct psm_softc *, packetbuf_t *, + mousestatus_t *, int *, int *, int *); +static void proc_versapad(struct psm_softc *, packetbuf_t *, + mousestatus_t *, int *, int *, int *); +static int tame_mouse(struct psm_softc *, packetbuf_t *, mousestatus_t *, + u_char *); /* vendor specific features */ -typedef int probefunc_t(struct psm_softc *); +typedef int probefunc_t(struct psm_softc *); + +static int mouse_id_proc1(KBDC, int, int, int *); +static int mouse_ext_command(KBDC, int); -static int mouse_id_proc1(KBDC, int, int, int *); -static int mouse_ext_command(KBDC, int); -static probefunc_t enable_groller; -static probefunc_t enable_gmouse; -static probefunc_t enable_aglide; -static probefunc_t enable_kmouse; -static probefunc_t enable_msexplorer; -static probefunc_t enable_msintelli; -static probefunc_t enable_4dmouse; -static probefunc_t enable_4dplus; -static probefunc_t enable_mmanplus; -static probefunc_t enable_synaptics; -static probefunc_t enable_versapad; -static int tame_mouse(struct psm_softc *, packetbuf_t *, mousestatus_t *, unsigned char *); +static probefunc_t enable_groller; +static probefunc_t enable_gmouse; +static probefunc_t enable_aglide; +static probefunc_t enable_kmouse; +static probefunc_t enable_msexplorer; +static probefunc_t enable_msintelli; +static probefunc_t enable_4dmouse; +static probefunc_t enable_4dplus; +static probefunc_t enable_mmanplus; +static probefunc_t enable_synaptics; +static probefunc_t enable_versapad; static struct { - int model; - unsigned char syncmask; - int packetsize; - probefunc_t *probefunc; + int model; + u_char syncmask; + int packetsize; + probefunc_t *probefunc; } vendortype[] = { - /* - * WARNING: the order of probe is very important. Don't mess it - * unless you know what you are doing. - */ - { MOUSE_MODEL_NET, /* Genius NetMouse */ - 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_gmouse, }, - { MOUSE_MODEL_NETSCROLL, /* Genius NetScroll */ - 0xc8, 6, enable_groller, }, - { MOUSE_MODEL_MOUSEMANPLUS, /* Logitech MouseMan+ */ - 0x08, MOUSE_PS2_PACKETSIZE, enable_mmanplus, }, - { MOUSE_MODEL_EXPLORER, /* Microsoft IntelliMouse Explorer */ - 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msexplorer, }, - { MOUSE_MODEL_4D, /* A4 Tech 4D Mouse */ - 0x08, MOUSE_4D_PACKETSIZE, enable_4dmouse, }, - { MOUSE_MODEL_4DPLUS, /* A4 Tech 4D+ Mouse */ - 0xc8, MOUSE_4DPLUS_PACKETSIZE, enable_4dplus, }, - { MOUSE_MODEL_INTELLI, /* Microsoft IntelliMouse */ - 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msintelli, }, - { MOUSE_MODEL_GLIDEPOINT, /* ALPS GlidePoint */ - 0xc0, MOUSE_PS2_PACKETSIZE, enable_aglide, }, - { MOUSE_MODEL_THINK, /* Kensington ThinkingMouse */ - 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse, }, - { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */ - 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad, }, - { MOUSE_MODEL_SYNAPTICS, /* Synaptics Touchpad */ - 0xc0, MOUSE_SYNAPTICS_PACKETSIZE, enable_synaptics, }, - { MOUSE_MODEL_GENERIC, - 0xc0, MOUSE_PS2_PACKETSIZE, NULL, }, + /* + * WARNING: the order of probe is very important. Don't mess it + * unless you know what you are doing. + */ + { MOUSE_MODEL_NET, /* Genius NetMouse */ + 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_gmouse }, + { MOUSE_MODEL_NETSCROLL, /* Genius NetScroll */ + 0xc8, 6, enable_groller }, + { MOUSE_MODEL_MOUSEMANPLUS, /* Logitech MouseMan+ */ + 0x08, MOUSE_PS2_PACKETSIZE, enable_mmanplus }, + { MOUSE_MODEL_EXPLORER, /* Microsoft IntelliMouse Explorer */ + 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msexplorer }, + { MOUSE_MODEL_4D, /* A4 Tech 4D Mouse */ + 0x08, MOUSE_4D_PACKETSIZE, enable_4dmouse }, + { MOUSE_MODEL_4DPLUS, /* A4 Tech 4D+ Mouse */ + 0xc8, MOUSE_4DPLUS_PACKETSIZE, enable_4dplus }, + { MOUSE_MODEL_INTELLI, /* Microsoft IntelliMouse */ + 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msintelli }, + { MOUSE_MODEL_GLIDEPOINT, /* ALPS GlidePoint */ + 0xc0, MOUSE_PS2_PACKETSIZE, enable_aglide }, + { MOUSE_MODEL_THINK, /* Kensington ThinkingMouse */ + 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse }, + { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */ + 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad }, + { MOUSE_MODEL_SYNAPTICS, /* Synaptics Touchpad */ + 0xc0, MOUSE_SYNAPTICS_PACKETSIZE, enable_synaptics }, + { MOUSE_MODEL_GENERIC, + 0xc0, MOUSE_PS2_PACKETSIZE, NULL }, }; -#define GENERIC_MOUSE_ENTRY ((sizeof(vendortype) / sizeof(*vendortype)) - 1) +#define GENERIC_MOUSE_ENTRY \ + ((sizeof(vendortype) / sizeof(*vendortype)) - 1) /* device driver declarateion */ static device_method_t psm_methods[] = { @@ -385,18 +396,18 @@ }; static driver_t psm_driver = { - PSM_DRIVER_NAME, - psm_methods, - sizeof(struct psm_softc), + PSM_DRIVER_NAME, + psm_methods, + sizeof(struct psm_softc), }; - static struct cdevsw psm_cdevsw = { .d_version = D_VERSION, .d_flags = D_NEEDGIANT, .d_open = psmopen, .d_close = psmclose, .d_read = psmread, + .d_write = psmwrite, .d_ioctl = psmioctl, .d_poll = psmpoll, .d_name = PSM_DRIVER_NAME, @@ -406,123 +417,123 @@ static int enable_aux_dev(KBDC kbdc) { - int res; + int res; - res = send_aux_command(kbdc, PSMC_ENABLE_DEV); - VLOG(2, (LOG_DEBUG, "psm: ENABLE_DEV return code:%04x\n", res)); + res = send_aux_command(kbdc, PSMC_ENABLE_DEV); + VLOG(2, (LOG_DEBUG, "psm: ENABLE_DEV return code:%04x\n", res)); - return (res == PSM_ACK); + return (res == PSM_ACK); } static int disable_aux_dev(KBDC kbdc) { - int res; + int res; - res = send_aux_command(kbdc, PSMC_DISABLE_DEV); - VLOG(2, (LOG_DEBUG, "psm: DISABLE_DEV return code:%04x\n", res)); + res = send_aux_command(kbdc, PSMC_DISABLE_DEV); + VLOG(2, (LOG_DEBUG, "psm: DISABLE_DEV return code:%04x\n", res)); - return (res == PSM_ACK); + return (res == PSM_ACK); } static int get_mouse_status(KBDC kbdc, int *status, int flag, int len) { - int cmd; - int res; - int i; + int cmd; + int res; + int i; - switch (flag) { - case 0: - default: - cmd = PSMC_SEND_DEV_STATUS; - break; - case 1: - cmd = PSMC_SEND_DEV_DATA; - break; - } - empty_aux_buffer(kbdc, 5); - res = send_aux_command(kbdc, cmd); - VLOG(2, (LOG_DEBUG, "psm: SEND_AUX_DEV_%s return code:%04x\n", - (flag == 1) ? "DATA" : "STATUS", res)); - if (res != PSM_ACK) - return 0; + switch (flag) { + case 0: + default: + cmd = PSMC_SEND_DEV_STATUS; + break; + case 1: + cmd = PSMC_SEND_DEV_DATA; + break; + } + empty_aux_buffer(kbdc, 5); + res = send_aux_command(kbdc, cmd); + VLOG(2, (LOG_DEBUG, "psm: SEND_AUX_DEV_%s return code:%04x\n", + (flag == 1) ? "DATA" : "STATUS", res)); + if (res != PSM_ACK) + return (0); - for (i = 0; i < len; ++i) { - status[i] = read_aux_data(kbdc); - if (status[i] < 0) - break; - } + for (i = 0; i < len; ++i) { + status[i] = read_aux_data(kbdc); + if (status[i] < 0) + break; + } - VLOG(1, (LOG_DEBUG, "psm: %s %02x %02x %02x\n", - (flag == 1) ? "data" : "status", status[0], status[1], status[2])); + VLOG(1, (LOG_DEBUG, "psm: %s %02x %02x %02x\n", + (flag == 1) ? "data" : "status", status[0], status[1], status[2])); - return i; + return (i); } static int get_aux_id(KBDC kbdc) { - int res; - int id; + int res; + int id; - empty_aux_buffer(kbdc, 5); - res = send_aux_command(kbdc, PSMC_SEND_DEV_ID); - VLOG(2, (LOG_DEBUG, "psm: SEND_DEV_ID return code:%04x\n", res)); - if (res != PSM_ACK) - return (-1); + empty_aux_buffer(kbdc, 5); + res = send_aux_command(kbdc, PSMC_SEND_DEV_ID); + VLOG(2, (LOG_DEBUG, "psm: SEND_DEV_ID return code:%04x\n", res)); + if (res != PSM_ACK) + return (-1); - /* 10ms delay */ - DELAY(10000); + /* 10ms delay */ + DELAY(10000); - id = read_aux_data(kbdc); - VLOG(2, (LOG_DEBUG, "psm: device ID: %04x\n", id)); + id = read_aux_data(kbdc); + VLOG(2, (LOG_DEBUG, "psm: device ID: %04x\n", id)); - return id; + return (id); } static int set_mouse_sampling_rate(KBDC kbdc, int rate) { - int res; + int res; - res = send_aux_command_and_data(kbdc, PSMC_SET_SAMPLING_RATE, rate); - VLOG(2, (LOG_DEBUG, "psm: SET_SAMPLING_RATE (%d) %04x\n", rate, res)); + res = send_aux_command_and_data(kbdc, PSMC_SET_SAMPLING_RATE, rate); + VLOG(2, (LOG_DEBUG, "psm: SET_SAMPLING_RATE (%d) %04x\n", rate, res)); - return ((res == PSM_ACK) ? rate : -1); + return ((res == PSM_ACK) ? rate : -1); } static int set_mouse_scaling(KBDC kbdc, int scale) { - int res; + int res; - switch (scale) { - case 1: - default: - scale = PSMC_SET_SCALING11; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804090537.m395bPOh046793>