never gonna let you down

This commit is contained in:
viandoxdev 2022-08-31 00:56:56 +02:00
parent 063c69303b
commit 141a8db388
No known key found for this signature in database
GPG Key ID: AF1410C5BC10AA25
4 changed files with 9 additions and 9 deletions

View File

@ -4,13 +4,11 @@
#include "util.h" #include "util.h"
#include <arpa/inet.h> #include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/uinput.h> #include <linux/uinput.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <poll.h> #include <poll.h>
#include <pthread.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
@ -20,6 +18,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/ioctl.h>
typedef struct { typedef struct {
int fd; int fd;
@ -158,7 +157,7 @@ void device_handle_report(MessageDeviceReport *report) {
} }
for (int i = 0; i < report->key_count; i++) { 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"); 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) { if (msg_deserialize(buf, len, &message) != 0) {
printf("CLIENT: Couldn't parse message (code: %d, len: %d)\n", buf[0], len); printf("CLIENT: Couldn't parse message (code: %d, len: %d)\n", buf[0], len);
int l = len > 100 ? 100 : 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]); printf("%02x", buf[i]);
} }
if(len > 100) { if (len > 100) {
printf(" ... %d more bytes", len - 100); printf(" ... %d more bytes", len - 100);
} }
printf("\n"); printf("\n");

1
hid.h
View File

@ -2,6 +2,7 @@
#ifndef HID_H #ifndef HID_H
#define HID_H #define HID_H
#include "net.h" #include "net.h"
#include <linux/input.h> #include <linux/input.h>
#include <stdint.h> #include <stdint.h>