user39379: I'm using the Mouse library with an ATmega32U4 connected to Linux via USB.
I would like to issue horizontal scroll commands, but the Mouse.move() function only seems to accept X movement, Y movement and vertical scroll parameters.
How can I send horizontal scroll commands from the Arduino to the computer?

user39379: As suggested in the comments, I edited the core libraries to achieve this.
I'm using PlatformIO, so the library files I needed to edit were here:
~/.platformio/packages/framework-arduinoavr/libraries/Mouse/src/

And the required changes (to change a wheel parameter for horizontal (h) and vertical (v) scroll parameters were as follows:
Mouse.h
Change the declaration of move():
...
void move(signed char x, signed char y, signed char h = 0, signed char v = 0); 
...

Mouse.cpp
Add the following to the report descriptor after the last INPUT message:
...
0x05, 0x0c,        //       USAGE PAGE (Consumer Devices)
0x0a, 0x38, 0x02,  //       USAGE (AC Pan)
0x15, 0x81,        //       LOGICAL_MINIMUM (-127)
0x25, 0x7f,        //       LOGICAL_MAXIMUM (127)
0x75, 0x08,        //       REPORT_SIZE (8)
0x95, 0x01,        //       REPORT_COUNT (1)
0x81, 0x06,        //       INPUT (Data, Var, Rel)
...

Change the definition of move():
void Mouse_::move(signed char x, signed char y, signed char h, signed char v)
{
    uint8_t m[5];
    m[0] = _buttons;
    m[1] = x;
    m[2] = y;
    m[3] = v;
    m[4] = h;
    HID().SendReport(1, m, 5);
}


The following terminal commands were also useful in testing these changes:
# List input devices
xinput --list

# List device capabilities
xinput --list <device-id>

# Watch for data sent from the device
watch -n 0.1 xinput query-state <device-id>


39379: <p>I'm using the <a href="https://www.arduino.cc/en/Reference/MouseKeyboard" rel="nofollow noreferrer">Mouse</a> library with an ATmega32U4 connected to Linux via USB.</p>

<p>I would like to issue horizontal scroll commands, but the <a href="https://www.arduino.cc/en/Reference/MouseMove" rel="nofollow noreferrer">Mouse.move()</a> function only seems to accept X movement, Y movement and vertical scroll parameters.</p>

<p>How can I send horizontal scroll commands from the Arduino to the computer?</p>
 39379: <p>As suggested in the comments, I edited the core libraries to achieve this.</p>

<p>I'm using <a href="http://platformio.org" rel="nofollow noreferrer">PlatformIO</a>, so the library files I needed to edit were here:</p>

<pre><code>~/.platformio/packages/framework-arduinoavr/libraries/Mouse/src/
</code></pre>

<p>And the required changes (to change a <code>wheel</code> parameter for horizontal (<code>h</code>) and vertical (<code>v</code>) scroll parameters were as follows:</p>

<p><strong>Mouse.h</strong></p>

<p>Change the declaration of <code>move()</code>:</p>

<pre><code>...
void move(signed char x, signed char y, signed char h = 0, signed char v = 0); 
...
</code></pre>

<p><strong>Mouse.cpp</strong></p>

<p>Add the following to the report descriptor after the last <code>INPUT</code> message:</p>

<pre><code>...
0x05, 0x0c,        //       USAGE PAGE (Consumer Devices)
0x0a, 0x38, 0x02,  //       USAGE (AC Pan)
0x15, 0x81,        //       LOGICAL_MINIMUM (-127)
0x25, 0x7f,        //       LOGICAL_MAXIMUM (127)
0x75, 0x08,        //       REPORT_SIZE (8)
0x95, 0x01,        //       REPORT_COUNT (1)
0x81, 0x06,        //       INPUT (Data, Var, Rel)
...
</code></pre>

<p>Change the definition of <code>move()</code>:</p>

<pre><code>void Mouse_::move(signed char x, signed char y, signed char h, signed char v)
{
    uint8_t m[5];
    m[0] = _buttons;
    m[1] = x;
    m[2] = y;
    m[3] = v;
    m[4] = h;
    HID().SendReport(1, m, 5);
}
</code></pre>

<hr>

<p>The following terminal commands were also useful in testing these changes:</p>

<pre><code># List input devices
xinput --list

# List device capabilities
xinput --list &lt;device-id&gt;

# Watch for data sent from the device
watch -n 0.1 xinput query-state &lt;device-id&gt;
</code></pre>
