Inquiry about USB Host Shield

Hello Arduino community, so I compiled a sketch that works fine on one computer with my Arduino Leonardo R3 + USB Host Shield, I am rather new to this type of hardware but my mouse plugged in the host shield performs as normal on the 1st computer. My laptop (which has only USB 2.0 ports) I tried to test the mouse there but nothing. Here are some things I did:

  • Ensuring laptop was charged while USB connection was active to the Arduino

  • Used a USB to USB 3.0 Hub and attempted to check if it made any difference (nothing)

  • Used a multimeter and checked the voltages on the soldered points and was getting about
    5v

  • Went to device manager, opened all the devices in "Universal Serial Bus controllers", went to the properties and then proceeded to check off "Allow this computer to turn off this device to save power." Nothing.

  • I also looked through BIOS, I didn't seem to notice anything out of the ordinary, here is my laptop:

HP EliteBook 840 G6

If anyone could help me on this regards, that would be much appreciated.

This piece of code here I found online just essentially is supposed to allow a USB Device (primarily a mouse in this case) to be able to move. Now the issue isn't that I can't upload the sketch and there is an error. The issue is what I previously stated before. I am able to move my mouse on ONE computer, when I connect the same setup to ANOTHER computer (as described in the post), there is no response from the mouse to be able to move.

So essentially:

Arduino Leonardo + USB Host Shield --> USB PORT of Computer 1 (Works)
Arduino Leonardo + USB Host Shield --> USB PORT of Computer 2 (Does not work)

All my attempts to resolve this issue are also mentioned in my original message.

#include <Mouse.h>
#include <hiduniversal.h>
#include <SPI.h>
#include "hidmouserptparser.h"

USB Usb;
HIDUniversal Hid(&Usb);
HIDMouseEvents MouEvents;
HIDMouseReportParser Mou(&MouEvents);

int dx;
int dy;
int dxn;
int dyn;
int index;
int num_size;
int jump = 127;

void setup() {
    Mouse.begin();
    Serial1.begin(115200);
    Serial1.println("Starting setup...");

    if (Usb.Init() == -1) {
        Serial1.println("USB initialization failed.");
        while (1);
    }
    delay(200);

    if (!Hid.SetReportParser(0, &Mou)) {
        Serial1.println("Failed to set HID report parser.");
        while (1);
    }
    Serial1.println("Setup complete. USB initialized and HID report parser set.");
}

void loop() {
    Usb.Task();


    if (Serial1.available() > 0) {
        String uartData = Serial1.readStringUntil('\n');
        Serial1.print("Received data: ");
        Serial1.println(uartData);
        processInputData(uartData);
    }
}

void processInputData(String data) {
    Serial1.print("Processing data: ");
    Serial1.println(data);

    if (data == "shttt") {
        Mouse.click();
        Serial1.println("Mouse click executed.");
    } else if (data.startsWith("syl3nt")) {
        data.remove(0, 6);
        int delimiterIndex = data.indexOf(":");
        if (delimiterIndex != -1) {
            dx = data.substring(0, delimiterIndex).toInt();
            dy = data.substring(delimiterIndex + 1).toInt();
            dxn = dx * -1;
            dyn = dy * -1;

            Serial1.print("Moving mouse by dx: ");
            Serial1.print(dx);
            Serial1.print(", dy: ");
            Serial1.println(dy);

            moveMouseWithLimits(dx, dy);
            delay(50);
            moveMouseWithLimits(dxn, dyn);
        }
    } else if (data.startsWith("movsht")) {
        data.remove(0, 6);
        int delimiterIndex = data.indexOf(":");
        if (delimiterIndex != -1) {
            dx = data.substring(0, delimiterIndex).toInt();
            dy = data.substring(delimiterIndex + 1).toInt();

            Serial1.print("Moving mouse by dx: ");
            Serial1.print(dx);
            Serial1.print(", dy: ");
            Serial1.println(dy);

            moveMouseWithLimits(dx, dy);
            delay(50);
        }
    } else {
        index = 0;
        num_size = data.indexOf(":", index);
        if (num_size != -1) {
            dx = data.substring(index, num_size).toInt();
            data.remove(0, num_size + 1);
            dy = data.toInt();

            Serial1.print("Moving mouse by dx: ");
            Serial1.print(dx);
            Serial1.print(", dy: ");
            Serial1.println(dy);

            if (dx > 0) {
                while (dx > jump) {
                    dx -= jump;
                    Mouse.move(jump, 0);
                }
                Mouse.move(dx, 0);
            } else if (dx < 0) {
                while (dx < -jump) {
                    dx += jump;
                    Mouse.move(-jump, 0);
                }
                Mouse.move(dx, 0);
            }
            if (dy > 0) {
                while (dy > jump) {
                    dy -= jump;
                    Mouse.move(0, jump);
                }
                Mouse.move(0, dy);
            } else if (dy < 0) {
                while (dy < -jump) {
                    dy += jump;
                    Mouse.move(0, -jump);
                }
                Mouse.move(0, dy);
            }
        }
    }
}


void moveMouseWithLimits(int dx, int dy) {
    int moveX = dx;
    int moveY = dy;

    while (moveX != 0 || moveY != 0) {
        int stepX = constrain(moveX, -jump, jump);
        int stepY = constrain(moveY, -jump, jump);
        Mouse.move(stepX, stepY);
        moveX -= stepX;
        moveY -= stepY;
        delay(10);
    }
    Serial1.print("Moved mouse by dx: ");
    Serial1.print(dx);
    Serial1.print(", dy: ");
    Serial1.println(dy);
}