kwx_logo

hid2osc manual

About

The hid2osc application reads values from devices that meet the HID (Human Interface Device) specification (most mice and joysticks) and outputs those values as OSC (Open Sound Control). OSC can be used to control various applications.

Running it

Run hid2osc from the command line or by double clicking it. On the first launch the application creates a configuration file with entries for all connected HID devices. To see what the application actually spits out you can use an OSC monitor like dumpOSC, http://www.cnmat.berkeley.edu/OpenSoundControl/dumpOSC.html . Hid2osc to OSC sends by default over 5000, so tell dumpOSC from the command line to listen on port 5000 ( dumpOSC 5000 )

Configuring it

By editing the configuration file you can specify for each HID device which OSC addresses it should send to and which UDP ports it should use. The configuration file gets generated when the application is first launched and is adapted each time a "not yet configured" HID device is recognized. Once hid2osc has added an entry for the device in its configuration file you can tweak the device. Hid2osc needs to be restarted to make the edited configuration active.
N.B. Editing XML should be done very carefully, because invalid XML might make the application fail to launch.

The configuration file can be found here : "~/Library/Preferences/KWlive/hid2osc.xml" and it looks a bit like this:
<?xml version="1.0" ?>
<devicelist>
    <destination address="127.0.0.1" port="5000" />
    <destination address="127.0.0.1" port="5001" />
    <device name="USB Mouse" active="false" required="false" id="454164480" typeid="12872960" oscname="mouse1">
        <!--<destination address="127.0.0.1" port="5000" />-->
        <element name="Mouse" oscaddress="/HID/mouse1/Mouse" />
        <element name="Pointer" oscaddress="/HID/mouse1/Pointer" />
        <element name="Button #1" oscaddress="/HID/mouse1/Button1" fixedvalue="0.25" />
        <element name="Button #2" oscaddress="/HID/mouse1/Button2" />
        <element name="Button #3" oscaddress="/HID/mouse1/Button3" />
        <element name="X-Axis" oscaddress="/HID/mouse1/X-Axis" />
        <element name="Y-Axis" oscaddress="/HID/mouse1/Y-Axis" />
        <element name="Wheel" oscaddress="/HID/mouse1/Wheel" />
        <element name="Motion Wakeup" oscaddress="/HID/mouse1/MotionWakeup" />
    </device>
    <device name="Trackpad" active="true" required="false" id="50397184" typeid="371712" oscname="trackpad1">
        <!--<destination address="127.0.0.1" port="5000" />-->
        <element name="Mouse" oscaddress="/HID/trackpad1/Mouse" />
        <element name="Pointer" oscaddress="/HID/trackpad1/Pointer" />
        <element name="X-Axis" oscaddress="/HID/trackpad1/X-Axis" />
        <element name="Y-Axis" oscaddress="/HID/trackpad1/Y-Axis" />
        <element name="Button #1" oscaddress="/HID/trackpad1/Button1" />
    </device>
</devicelist>

the configuration file explained

Convince yourself the OSC addresses are valid when you edit them, the initially generated address addresses are always valid and based upon the device its name. Look here http://www.cnmat.berkeley.edu/OpenSoundControl/ for a specification of the protocol.
Generated on Thu Feb 16 15:35:41 2006 by  doxygen 1.4.5