USBMS(4M) | STREAMS Modules | USBMS(4M) |
usbms - USB mouse STREAMS module
#include <sys/vuid_event.h>
#include <sys/vuid_wheel.h>
#include <sys/msio.h>
#include <sys/msreg.h>
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(4D)). 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.
VUIDGFORMAT
VUIDSFORMAT
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
If base does not equal VKEY_FIRST, ENODEV is returned.
VUIDGADDR
If base does not equal VKEY_FIRST, ENODEV is returned.
VUIDGWHEELCOUNT
VUIDGWHEELINFO
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
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
MSIOSETPARMS
MSIOSRESOLUTION
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.
/kernel/strmod/usbms
/kernel/strmod/sparcv9/usbms
See attributes(7) for a description of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Architecture | PCI-based systems |
ioctl(2), hid(4D), usba(4D), virtualkm(4D), attributes(7)
System Administration Guide: Basic Administration
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).
Mouse buffer flushed when overrun.
May 13, 2017 | OmniOS |