never gonna let you down
This commit is contained in:
parent
063c69303b
commit
141a8db388
9
client.c
9
client.c
|
@ -4,13 +4,11 @@
|
|||
#include "util.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/uinput.h>
|
||||
#include <netinet/in.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
@ -20,6 +18,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
|
@ -158,7 +157,7 @@ void device_handle_report(MessageDeviceReport *report) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < report->key_count; i++) {
|
||||
if (device_emit(EV_KEY, device.info.key_id[i], (uint32_t)(!report->key[i]) - 1 ) != 0)
|
||||
if (device_emit(EV_KEY, device.info.key_id[i], (uint32_t)(!report->key[i]) - 1) != 0)
|
||||
printf("CLIENT: Error writing key event to uinput\n");
|
||||
}
|
||||
|
||||
|
@ -291,10 +290,10 @@ void client_run(char *address, uint16_t port) {
|
|||
if (msg_deserialize(buf, len, &message) != 0) {
|
||||
printf("CLIENT: Couldn't parse message (code: %d, len: %d)\n", buf[0], len);
|
||||
int l = len > 100 ? 100 : len;
|
||||
for(int i = 0; i < l; i++) {
|
||||
for (int i = 0; i < l; i++) {
|
||||
printf("%02x", buf[i]);
|
||||
}
|
||||
if(len > 100) {
|
||||
if (len > 100) {
|
||||
printf(" ... %d more bytes", len - 100);
|
||||
}
|
||||
printf("\n");
|
||||
|
|
6
hid.c
6
hid.c
|
@ -75,7 +75,7 @@ void setup_device(PhysicalDevice *dev) {
|
|||
if (i == EV_ABS) {
|
||||
struct input_absinfo abs;
|
||||
ioctl(dev->event, EVIOCGABS(j), &abs);
|
||||
uint16_t index = dev->device_info.abs_count++;
|
||||
uint16_t index = dev->device_info.abs_count++;
|
||||
dev->device_info.abs_id[index] = j;
|
||||
dev->device_info.abs_min[index] = abs.minimum;
|
||||
dev->device_info.abs_max[index] = abs.maximum;
|
||||
|
@ -84,11 +84,11 @@ void setup_device(PhysicalDevice *dev) {
|
|||
dev->device_info.abs_res[index] = abs.resolution;
|
||||
dev->mapping.abs_indices[j] = index;
|
||||
} else if (i == EV_REL) {
|
||||
uint16_t index = dev->device_info.rel_count++;
|
||||
uint16_t index = dev->device_info.rel_count++;
|
||||
dev->device_info.rel_id[index] = j;
|
||||
dev->mapping.rel_indices[j] = index;
|
||||
} else if (i == EV_KEY) {
|
||||
uint16_t index = dev->device_info.key_count++;
|
||||
uint16_t index = dev->device_info.key_count++;
|
||||
dev->device_info.key_id[index] = j;
|
||||
dev->mapping.key_indices[j] = index;
|
||||
}
|
||||
|
|
1
hid.h
1
hid.h
|
@ -2,6 +2,7 @@
|
|||
#ifndef HID_H
|
||||
#define HID_H
|
||||
#include "net.h"
|
||||
|
||||
#include <linux/input.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue