xref: /titanic_51/usr/src/man/man7m/usbms.7m (revision a59d1975cc18cdd7bd7bcc5ad6a5b2ed7e62b473)
te
Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
usbms 7M "1 Dec 2005" "SunOS 5.11" "STREAMS Modules"
NAME
usbms - USB mouse STREAMS module
SYNOPSIS

#include <sys/vuid_event.h>

#include <sys/vuid_wheel.h>

#include <sys/msio.h>

#include <sys/msreg.h>
DESCRIPTION

The usbms STREAMS module processes byte streams generated by a USB mouse. A USB mouse is a member of the Human Interface Device (HID) class and the usbms module supports only the mouse boot protocol defined in the HID specification.

The usbms module must be pushed on top of the HID class driver (see hid(7D)). In the VUID_FIRM_EVENT mode, the usbms module translates packets from the USB mouse into Firm events. The Firm event structure is defined in <sys/vuid_event.h>. The STREAMS module state is initially set to raw or VUID_NATIVE mode which performs no message processing. See the HID 1.0 specification for the raw format of the mouse packets. To initiate mouse protocol conversion to Firm events, change the state to VUID_FIRM_EVENT.

When the usb mouse is opened or hot plugged in, the MOUSE_TYPE_ABSOLUTE event (Firm event) is sent to the upper level to notify the VUID application that it is the absolute mouse.

IOCTLS

VUIDGFORMAT

This option returns the current state of the STREAMS module. The state of the usbms STREAMS module may be either VUID_NATIVE (no message processing) or VUID_FIRM_EVENT (convert to Firm events).

VUIDSFORMAT

The argument is a pointer to an int. Set the state of the STREAMS module to the int pointed to by the argument.

typedef struct vuid_addr_probe {
 short base; /* default vuid device addr directed too */
 union {
 short next; /* next addr for default when VUIDSADDR */
 short current; /* current addr of default when VUIDGADDR */
 } data;
} Vuid_addr_probe;

VUIDSADDR

The argument is a pointer to a Vuid_addr_probe structure. VUIDSADDR sets the virtual input device segment address indicated by base to next.

If base does not equal VKEY_FIRST, ENODEV is returned.

VUIDGADDR

The argument is a pointer to a Vuid_addr_probe structure. Return the address of the virtual input device segment indicated by base to current.

If base does not equal VKEY_FIRST, ENODEV is returned.

VUIDGWHEELCOUNT

This ioctl takes a pointer to an integer as argument and sets the value of the integer to the number of wheels available on this device. This ioctl returns 1 if wheel(s) are present and zero if no wheels are present.

VUIDGWHEELINFO

This command returns static information about the wheel that does not change while a device is in use. Currently the only information defined is the wheel orientation which is either VUID_WHEEL_FORMAT_VERTICAL or VUID_WHEEL_FORMAT_HORIZONTAL. If the module cannot distinguish the orientation of the wheel or the wheel is of some other format, the format is set to VUID_WHEEL_FORMAT_UNKNOWN.

 typedef struct {
 int vers; 
 int id;
 int format;
 } wheel_info;
The ioctl takes a pointer to "wheel_info" structure with the "vers" set to the current version of the "wheel_info" structure and "id" set to the id of the wheel for which the information is desired.

VUIDSWHEELSTATE/VUIDGWHEELSTATE

VUIDSWHEELSTATE sets the state of the wheel to that specified in the stateflags. VUIDGWHEELSTATE returns the current state settings in the stateflags field. stateflags is an OR'ed set of flag bits. The only flag currently defined is VUID_WHEEL_STATE_ENABLED. When stateflags is set to VUID_WHEEL_STATE_ENABLED the module converts motion of the specified wheel into VUID events and sends those up stream. Wheel events are enabled by default. Applications that want to change the stateflags should first get the current stateflags and then change only the bit they want.

 typedef struct {
 int vers; 
 int id;
 uint32_t stateflags;
 } wheel_state;
These ioctls take a pointer to "wheel_state" as an argument with the "vers" and "id" members filled in. These members have the same meaning as that for 'VUIDGWHEEL INFO' ioctl.

ioctl() requests for changing and retrieving mouse parameters use the Ms_parms structure:

 typedef struct {
 int jitter_thresh; 
 int speed_law; 
 int speed_limit; 
 } Ms_parms;

jitter_thresh is the "jitter threshold" of the mouse. Motions fewer than jitter_thresh units along both axes are accumulated and then sent up the stream after 1/12 second.

speed_law indicates whether extremely large motions are to be ignored. If it is 1, a "speed limit" is applied to mouse motions. Motions along either axis of more than speed_limit units are discarded.

MSIOGETPARMS

The argument is a pointer to a Ms_params structure. The usbms module parameters are returned in the structure.

MSIOSETPARMS

The argument is a pointer to a Ms_params structure. The usbms module parameters are set according to the values in the structure.

MSIOSRESOLUTION

Used by the absolute mouse to get the current screen resolution. The parameter is a pointer to the Ms_screen_resolution structure:

int height; /* height of the screen */
int width; /* width of the screen */
}Ms_screen_resolution;
The usbms module parameters are set according to the values in the structure and used to calculate the correct coordinates.
FILES

/kernel/strmod/usbms

32-bit ELF kernel STREAMS module (x86 platform only.)

/kernel/strmod/sparcv9/usbms

SPARC 64-bit ELF kernel STREAMS module

ATTRIBUTES

See attributes(5) for a description of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
ArchitecturePCI-based systems
SEE ALSO

ioctl(2), attributes(5), hid(7D), virtualkm(7D), usba(7D)

System Administration Guide: Basic Administration

http://www/sun.com/io

DIAGNOSTICS

The following messages may be logged into the system log. They are formatted in the following manner:

<device path><usbms<instance number>): message...

Invalid Hid descriptor tree. Set to default value (3 buttons).

The mouse supplied incorrect information in its HID report.

Mouse buffer flushed when overrun.

Mouse data was lost.