Proof-of-concept driver added
This commit is contained in:
parent
0543d56dd5
commit
c2ae875a82
8
Makefile
8
Makefile
@ -1,13 +1,13 @@
|
||||
NAME=ginput
|
||||
CC=gcc
|
||||
CFLAGS=$(shell pkg-config --cflags gtk4 libadwaita-1 libusb-1.0) -O3 -I src
|
||||
CFLAGS=$(shell pkg-config --cflags gtk4 libadwaita-1 libusb-1.0) -O3 -Wall -I src
|
||||
LDFLAGS=$(shell pkg-config --libs gtk4 libadwaita-1 libusb-1.0)
|
||||
BUILD_DIR=build
|
||||
|
||||
UI := $(shell find ui/ -name '*.ui')
|
||||
C_FILES := $(shell find src/ -name '*.c')
|
||||
|
||||
all: resources $(BUILD_DIR)/$(NAME)
|
||||
all: resources $(BUILD_DIR)/$(NAME) $(BUILD_DIR)/drivers
|
||||
|
||||
# Top-level targets
|
||||
resources: $(BUILD_DIR)/glib-2.0/schemas/gschemas.compiled
|
||||
@ -29,6 +29,10 @@ $(BUILD_DIR)/glib-2.0/schemas/gschemas.compiled: v.ginput.gschema.xml | $(BUILD_
|
||||
mkdir -p $(BUILD_DIR)/glib-2.0/schemas
|
||||
glib-compile-schemas . --targetdir=$(BUILD_DIR)/glib-2.0/schemas
|
||||
|
||||
# Drivers
|
||||
$(BUILD_DIR)/drivers:
|
||||
cd drivers && make
|
||||
|
||||
# Phony targets
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
12
drivers/Makefile
Normal file
12
drivers/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
SUBDIRS := $(wildcard */.)
|
||||
BUILD_DIR=../build/
|
||||
|
||||
all: $(BUILD_DIR)/drivers/ $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
.PHONY: all $(SUBDIRS)
|
||||
|
||||
$(BUILD_DIR)/drivers/:
|
||||
mkdir -p $(BUILD_DIR)/drivers/
|
7
drivers/g-wolves/Makefile
Normal file
7
drivers/g-wolves/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
SUBDIRS := $(wildcard */.)
|
||||
|
||||
all: $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
.PHONY: all $(SUBDIRS)
|
10
drivers/g-wolves/htx/Makefile
Normal file
10
drivers/g-wolves/htx/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
CC=gcc
|
||||
CFLAGS=$(shell pkg-config --cflags libusb-1.0) -O3 -Wall -shared
|
||||
LDFLAGS=$(shell pkg-config --libs libusb-1.0)
|
||||
|
||||
BUILD_DIR=../../../build/
|
||||
|
||||
all: $(BUILD_DIR)/drivers/gwolves-htx.so
|
||||
|
||||
$(BUILD_DIR)/drivers/gwolves-htx.so: htx.c | $(BUILD_DIR)/drivers/
|
||||
gcc $(CFLAGS) -o $@ $^
|
26
drivers/g-wolves/htx/htx.c
Normal file
26
drivers/g-wolves/htx/htx.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define DEVICE_NAME "HTX 4K"
|
||||
|
||||
void driver_init(void)
|
||||
{
|
||||
printf("Hello from G-Wolves HTX driver !\n");
|
||||
}
|
||||
|
||||
uint32_t driver_getkey(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* driver_get_name(void)
|
||||
{
|
||||
return DEVICE_NAME;
|
||||
}
|
||||
|
||||
char* driver_get_image(void)
|
||||
{
|
||||
return "g-wolves/htx/htx_0.png";
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
struct DEVICE
|
||||
{
|
||||
|
||||
void* driver;
|
||||
};
|
||||
|
||||
array_t* device_array;
|
||||
|
@ -89,16 +89,16 @@ void usb_init()
|
||||
struct libusb_device_descriptor desc;
|
||||
libusb_get_device_descriptor(current, &desc);
|
||||
|
||||
printf("Found usb device %04x:%04x\n", desc.idVendor, desc.idProduct);
|
||||
array_t* array = device_get_array();
|
||||
array_add(array, 0);
|
||||
// printf("Found usb device %04x:%04x\n", desc.idVendor, desc.idProduct);
|
||||
// array_t* array = device_get_array();
|
||||
// array_add(array, 0);
|
||||
|
||||
libusb_device_handle* handle;
|
||||
libusb_open(current, &handle);
|
||||
char buf[4096] = {0};
|
||||
libusb_get_string_descriptor_ascii(handle, 1, buf, 4096);
|
||||
printf("Device desc (1): %s\n", buf);
|
||||
libusb_get_string_descriptor_ascii(handle, 2, buf, 4096);
|
||||
printf("Device desc (2): %s\n", buf);
|
||||
// libusb_device_handle* handle;
|
||||
// libusb_open(current, &handle);
|
||||
// char buf[4096] = {0};
|
||||
// libusb_get_string_descriptor_ascii(handle, 1, buf, 4096);
|
||||
// printf("Device desc (1): %s\n", buf);
|
||||
// libusb_get_string_descriptor_ascii(handle, 2, buf, 4096);
|
||||
// printf("Device desc (2): %s\n", buf);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user