Skip to content

Instantly share code, notes, and snippets.

@exlee
Created August 19, 2014 06:13
Show Gist options
  • Save exlee/528d418cb6d58f970a5f to your computer and use it in GitHub Desktop.
Save exlee/528d418cb6d58f970a5f to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "hidapi.h"
#define MAX_STR 255
const unsigned char caps_switch[] = {0x0, 0x0b, 0x20, 0x07, 0x00, 0x03, 0x00, 0x40, 0x00, 0xa2, 0x01, 0x02 };
#define HID_VENDOR_ID_LOGITECH 0x046d
#define HID_DEVICE_ID_K810 0xb319
int main(int argc, char* argv[]) {
int res;
int i;
unsigned char buf[65];
wchar_t wstr[MAX_STR];
hid_device *handle;
res = hid_init();
handle = hid_open_path("Bluetooth_046d_b319_207606bb");
res = hid_write(handle, caps_switch, 12);
printf("Result: %d\n", res); // Returns -1
hid_close(handle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment