Gain exclusive access to a USB HID devise with HIDAPI C Library?

100 views Asked by At

it is possible to develop a C command line tool app for windows that uses the hidapi c library and opens a connection to a usb hid device and lock the device / gain exclusive access to it so that no other parts of the system or other apps is able to talk or recognize the usb hid devise as long as the connection between my c app and hid device is open ?

#include <stdio.h>
#include <hidapi.h>

int main() {
    // Initialize the HIDAPI library
    if (hid_init() < 0) {
        fprintf(stderr, "hid_init failed\n");
        return 1;
    }

    hid_device *handle = hid_open(0x08ff, 0x0009, NULL); 


    if (!handle) {
        fprintf(stderr, "Failed to open HID device: %ls\n", hid_error(handle));
        return 1;
    }

    printf("HID device opened successfully\n");

    while (getchar() != '\n') {}

    hid_close(handle);

    hid_exit();

    return 0;
}
0

There are 0 answers