This commit is contained in:
Denis Manherz 2024-08-26 14:28:14 +02:00
parent 17ef7e510a
commit 3f1800b015
5 changed files with 330 additions and 14 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

71
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,71 @@
{
"files.associations": {
"string": "cpp",
"format": "cpp",
"string_view": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"source_location": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stdfloat": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}

View file

@ -31,15 +31,8 @@
qt6.wrapQtAppsHook qt6.wrapQtAppsHook
qtcreator qtcreator
qt6.full qt6.full
libusb1
]; ];
# This creates the proper qt env so that plugins are found right.
shellHook = ''
setQtEnvironment=$(mktemp --suffix .setQtEnvironment.sh)
echo "shellHook: setQtEnvironment = $setQtEnvironment"
makeWrapper "/bin/sh" "$setQtEnvironment" "''${qtWrapperArgs[@]}"
sed "/^exec/d" -i "$setQtEnvironment"
source "$setQtEnvironment"
'';
}; };
}; };
}; };

View file

@ -0,0 +1,211 @@
First Part
0000 08 21 00 92 00 00 00 00 64 17 04 15 00 0c 00 0f
0010 00 13 00 17 00 1b 00 00 00 00 00 00 00 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 ff 00 ff ff ff 00 ff ff 9b 00 00 ff 00 ff
0040 ff ff ff 46 00 02 43 00 36 ff 00 00 32 07 ff ff
0050 ff 00 00 00 ff ff ff 00 00 00 ff ff ff 00 00 00
0060 ff ff ff 02 02 00 ff 00 00 00 ff 00 00 00 ff 00
0070 00 00 00 ff ff ff 46 00 ff 00 ff ff ff ff ff 00
0080 00 ff 00 00 01 02 03 04 05 06 07 42 42 02 ff 00
0090 00 27 40 01 02 ff 00 00 a5 00 00 00 00 00 00 00
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0200 00 00 00 00 00 00 00 00
0x08-0x09 0x63 0x17 Profil 1, 0x63 0x01 Profil 2 ?????
2 Hex Dumps for 1 Profile
FUCK ICH GLAUB ICH HABE HEX FALSCH GEZÄHLT HAB MANCHMAL VON 1 ANGEFANGEN LOL
0x0a USB Polling Rate [0x01-0x04]->[125,250,500,1000]
0x0c 0x11-0x15 wert für häckchen bei dpi, erstes 0x11 zweites 0x12 usw..
0x0d-0x16 jeweils 2 byte most significant byte last, * 50 -> annäherung an dpi -50
0x45 -> Lighting Mode, 02 Steady, 01 Colorful Streaming, 03 Breathing
0x47 -> 0-4 Brightness und 0-4 Speed bei colorful 0x(br)(sp)
0x48 -> Brightness bei Steady 00-40
0x4c -> 0-4 Brightness und 0-4 Speed bei steady 0x(br)(sp)
0x4e-0x63 -> Bei Breathing RGB * 7
0x67-0x7a -> Bei Steady RGB * 7
bei einem modus wechsel ändert sich brightness und speed nicht auser man ändert sie nochmal explizit
Mouse Sensitivity and Improve Pointer Precision does nothing
And the rest of the settings on advanced page are system settings
-------
Part two
0000 08 22 00 50 00 00 00 00 11 01 00 00 11 02 00 00
0010 11 04 00 00 11 08 00 00 11 10 00 00 21 00 61 00
0020 41 00 00 00 50 06 00 00 41 02 00 00 41 00 00 00
0030 21 02 5b 00 21 00 5c 00 21 00 5d 00 21 00 5e 00
0040 21 00 5f 00 21 00 60 00 50 01 00 00 50 01 00 00
0050 50 01 00 00 50 01 00 00 a5 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0200 00 00 00 00 00 00 00 00
--was machen die ersten 8 bytes?--
0x08-0x0b 4 Byte für linke Maustaste
0x0c-0x0f 4 Byte für rechte Maustaste
0x10-0x13 4 Byte für Mausrad taste
0x14-0x17 4 Byte für taste 13, Zurück Taste, über taste 5,6
0x18-0x1b 4 Byte für taste 12, Forward Taste, über taste 2,4
0x1c-0x1f 4 Byte für taste 14, 1. über mausrad
0x20-0x23 4 Byte für taste 15, 2. über mausrad
--was machen die 4 Byte die hier leer sind ?--
0x28-0x47 Jeweils 4 Byte (3 Sicher) für die Belegung der Tasten 1-8 an der Seite
Tastenbelegung
Leftclick -> 0x11 0x01 0x00, restliche 2 Byte egal? -> schätze nicht werden mit null geschrieben wenn was anderes drinnen stand
Rightclick -> 0x11 0x02 0x00, restliche 2 Byte egal?
Forward -> 0x11 0x10 0x00 0x00
Backward -> 0x11 0x08 0x00 0x00
MiddleClick -> 0x11 0x04 0x00 0x00
ThreeClick -> 0x31 0x01 0x32 0x03, whatever this is?
RGB on/off -> 0x50 0x02 0x00 0x00 -> hat die letzten bytes mit 0 geschrieben
Disable -> 0x50 0x01 0x00 0x00
Fire Key -> 0x31 0x01 0xff 0x03 -> 0xff ist the firespeed und iie kann man die klick anzahl (3) nicht ändern aber denke ist 0x03
Multimedia->Starts with 0x22
Media Player -> 0x22 0x00 0x01 0x00
Play/Pause -> 0x22 0x08 0x00 0x00
next -> 0x22 0x01 0x00 0x00
prev -> 0x22 0x02 0x00 0x00
stop -> 0x22 0x04 0x00 0x00
mute -> 0x22 0x10 0x00 0x00
vol up -> 0x22 0x40 0x00 0x00
vol down -> 0x22 0x80 0x00 0x00
email -> 0x22 0x00 0x10 0x00
calculator -> 0x22 0x00 0x20 0x00
explorer -> 0x22 0x00 0x02 0x00
homepage -> 0x22 0x00 0x00 0x02
search -> 0x22 0x00 0x00 0x01
forward -> 0x22 0x00 0x00 0x08
backward -> 0x22 0x00 0x00 0x04
stop web -> 0x22 0x00 0x00 0x10
refresh -> 0x22 0x00 0x00 0x20
favorites -> 0x22 0x00 0x00 0x40
DPI starts with 0x41
DPI Loop 0x41 0x00 0x00 0x00
DPI+ 0x41 0x01 0x00 0x00
DPI- 0x41 0x02 0x00 0x00
restliche Byte egal? -> rest mit null auffüllen
Key Combination starts with 0x21 then 0x?? mod then 0x?? 0x?? key ???? uff bis zu 3 Keys ohne mod, mod + 2 Keys???? ich check nicht wie das geht oder des geht einfach nicht wie das da steht das es geht
Mods -> Shift 0x02
Ctrl 0x01
Alt 0x04
Win 0x08
NoMod 0x00
Maximal 2 Mods z.b. 1010 -> 0x0a für win+shift
Man kann beliebig viele mods gleichzeitig
A ist 0x04, b ist 0x05, c ist 0x06 dann hochzählen bis z 0x1d?
0x4c ist delete bzw. entf
0x2a ist backspace
0x59 ist numpad 1 0x5a ist numpad 2 ... 0x61 ist numpad 9 0x62 ist numpad 0
Warum zum fick kann man eine Kombination T+T+T eingeben aber das letzte T wird nichtmal gespeichert und nur das erste T wird gedrückt lol
0x1e ist normal 1, 0x1f ist normal 2 ... 0x26 ist normal 9, 0x27 ist normal 0
0x52 ist up arrow, 0x51 down arrow, 0x50 right arrow, 0x4f left arrow
0x36 , , 0x37 . , 0x2d -, 0x38 #, 0x2e +, 0x30 ´, 0x2f ß, 0x31 ^, 0x00 <,
0x3a F1 ... 0x45 F12
4 Byte 0x70 (Macro) 0x01 (Macro nummer) 0x01 (??) 0x01(??)
0x70 -> Macro mod
Macros
0000 08 30 02 00 00 00 00 00 02 00 06 50 01 04 d0 01
0010 04 50 01 05 d0 01 05 50 01 06 d0 01 06 00 00 00
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0200 00 00 00 00 00 00 00 00
wenn macro wird ein extra dingens an data geschrieben mit 0x08 0x30 am anfang
für jedes Macro wird ein extra data geschrieben

View file

@ -8,8 +8,10 @@
#include <QtQml> #include <QtQml>
#include <libusb-1.0/libusb.h> #include <libusb-1.0/libusb.h>
#include <iostream> #include <iostream>
#include <string>
int main(int argc, char *argv[]) { int main(int argc, char *argv[])
{
KIconTheme::initTheme(); // this is not available in nixpkgs version of KIconTheme::initTheme(); // this is not available in nixpkgs version of
// KiconTheme // KiconTheme
QApplication app(argc, argv); QApplication app(argc, argv);
@ -20,7 +22,8 @@ int main(int argc, char *argv[]) {
QApplication::setDesktopFileName(QStringLiteral("org.kde.tutorial")); QApplication::setDesktopFileName(QStringLiteral("org.kde.tutorial"));
QApplication::setStyle(QStringLiteral("breeze")); QApplication::setStyle(QStringLiteral("breeze"));
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) { if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
{
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
} }
@ -29,18 +32,55 @@ int main(int argc, char *argv[]) {
engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.loadFromModule("org.kde.tutorial", "Main"); engine.loadFromModule("org.kde.tutorial", "Main");
if (engine.rootObjects().isEmpty()) { if (engine.rootObjects().isEmpty())
{
return -1; return -1;
} }
libusb_context *ctx;
libusb_init(NULL); int r = libusb_init(&ctx);
if(r<0) {
std::cout << libusb_error_name(r) << std::endl;
exit(1);
}
// discover devices // discover devices
libusb_device **list; libusb_device **list;
libusb_device *found = NULL; libusb_device *found = NULL;
ssize_t cnt = libusb_get_device_list(NULL, &list); ssize_t cnt = libusb_get_device_list(ctx, &list);
ssize_t i = 0; ssize_t i = 0;
std::cout << cnt << "\n"; std::cout << cnt << "\n";
for (i = 0; i < cnt; i++)
{
libusb_device *device = list[i];
found = device;
uint8_t addr = libusb_get_device_address(found);
uint8_t bus = libusb_get_bus_number(found);
libusb_device_descriptor desc;
libusb_get_device_descriptor(found, &desc);
std::cout << "Bus " << unsigned(bus) << " Device " << unsigned(addr) << ": ID " << std::hex << desc.idVendor << ":" << desc.idProduct << std::dec << std::endl;
if(desc.idProduct == 0x2e && desc.idVendor == 0x258a){
break;
}
}
libusb_device_handle *handle;
if(!libusb_open(found, &handle))
std::cout << "drrsdfsdf" << std::endl;
unsigned char data[520];
std::string asd = "082100920000000064170445000c000f00130017001b00000000000000000000000000000000000000000000000000000000ff00ffffff00ffff9b0000ff00ffffffff460003020042ff00000207ff000000ff000000ffffff0000ffffff4600ff00ff020200ff000000ff000000ffffff0000ffffff4600ff00ffffffffff0000ff000001020304050607424202ff000027400102ff0000a500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
for(int i = 0; i < 1040; i+=2){
data[i/2] = std::stoi(asd.substr(i, 2), (std::size_t *)0, 16);
//std::cout << std::hex << std::to_string(data[i/2]) << std::endl;
}
libusb_detach_kernel_driver(handle, 0);
libusb_claim_interface(handle, 0);
libusb_control_transfer(handle, 0x21, 0x09, 0x0308, 1, data, 520, 0);
libusb_release_interface(handle, 0);
libusb_close(handle);
libusb_free_device_list(list, 1); libusb_free_device_list(list, 1);
return app.exec(); return app.exec();