You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I am trying to run a really simple example but I get an error when executing hid_exit().
I am running the latest libusb (1.0.22).
Code
#include <stdio.h>
#include <stdlib.h>
#include "hidapi.h"
#define MAX_STR 255
int main(int argc, char* argv[])
{
int res;
unsigned char buf[65];
wchar_t wstr[MAX_STR];
hid_device *handle;
int i;
// Initialize the hidapi library
res = hid_init();
// Open the device using the VID, PID,
// and optionally the Serial number.
handle = hid_open(0x1038, 0x1720, NULL);
// Read the Manufacturer String
res = hid_get_manufacturer_string(handle, wstr, MAX_STR);
wprintf(L"Manufacturer String: %s\n", wstr);
// Read the Product String
res = hid_get_product_string(handle, wstr, MAX_STR);
wprintf(L"Product String: %s\n", wstr);
// Read the Serial Number String
res = hid_get_serial_number_string(handle, wstr, MAX_STR);
wprintf(L"Serial Number String: (%d) %s\n", wstr[0], wstr);
// Read Indexed String 4
res = hid_get_indexed_string(handle, 4, wstr, MAX_STR);
wprintf(L"Indexed String 4: %s\n", wstr);
// Read Indexed String 5
res = hid_get_indexed_string(handle, 5, wstr, MAX_STR);
wprintf(L"Indexed String 5: %s\n", wstr);
// Request state (cmd 0x81). The first byte is the report number (0x0).
buf[0] = 0x0;
buf[1] = 0x90;
res = hid_write(handle, buf, 65);
// Read requested state
res = hid_read(handle, buf, 65);
// Print out the returned buffer.
for (i = 0; i < 4; i++)
printf("buf[%d]: %d\n", i, buf[i]);
// Finalize the hidapi library
res = hid_exit();
return 0;
}
I am using my Steelseries Rival 310 as an example. The output should be something like what is showed here.
Output
Manufacturer String: S
Product String: S
Serial Number String: (48) 0
Indexed String 4: S
Indexed String 5: S
test-hidapi-c-rival310: io.c:2116: handle_events: Assertion `ctx->pollfds_cnt >= internal_nfds' failed.
fish: “./test-hidapi-c-rival310” terminated by signal SIGABRT (Abort)
Fish is my shell
The text was updated successfully, but these errors were encountered:
Hey, I am trying to run a really simple example but I get an error when executing
hid_exit()
.I am running the latest libusb (
1.0.22
).Code
I am using my Steelseries Rival 310 as an example. The output should be something like what is showed here.
Output
Fish is my shell
The text was updated successfully, but these errors were encountered: