forked from denis/a811
Update
This commit is contained in:
parent
3f1800b015
commit
10dfbb1aff
9
.vscode/README.md
vendored
Normal file
9
.vscode/README.md
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
need permissions
|
||||
|
||||
do make udev rule
|
||||
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="002e|002f", MODE="0666"
|
||||
|
||||
|
||||
write a nixos module that also sets udev rules
|
||||
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
|
@ -66,6 +66,7 @@
|
|||
"streambuf": "cpp",
|
||||
"thread": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"variant": "cpp"
|
||||
"variant": "cpp",
|
||||
"cinttypes": "cpp"
|
||||
}
|
||||
}
|
||||
|
|
@ -26,12 +26,14 @@
|
|||
kdePackages.qtbase.dev
|
||||
kdePackages.qtdeclarative
|
||||
kdePackages.qttools.dev
|
||||
kdePakcages.qtserialport.dev
|
||||
makeWrapper
|
||||
pkg-config
|
||||
qt6.wrapQtAppsHook
|
||||
qtcreator
|
||||
qt6.full
|
||||
libusb1
|
||||
hidapi
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,18 +34,22 @@ First Part
|
|||
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
|
||||
|
||||
0x98 ist ende von data ???
|
||||
|
||||
0x03 maybe if 0x92 -> set report 0x00 -> get report
|
||||
|
||||
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..
|
||||
0x0b9 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
|
||||
0x47 -> 0-4 Brightness und 0-4 Speed bei breathing 0x(br)(sp)
|
||||
0x48 -> Brightness bei colorful 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
|
||||
|
|
@ -94,6 +98,8 @@ Part two
|
|||
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
|
||||
|
||||
0x58 0xa5 ist ende von data?
|
||||
|
||||
--was machen die ersten 8 bytes?--
|
||||
0x08-0x0b 4 Byte für linke Maustaste
|
||||
0x0c-0x0f 4 Byte für rechte Maustaste
|
||||
|
|
@ -209,3 +215,39 @@ Macros
|
|||
|
||||
wenn macro wird ein extra dingens an data geschrieben mit 0x08 0x30 am anfang
|
||||
für jedes Macro wird ein extra data geschrieben
|
||||
|
||||
So schaut ein get config von maus aus (GET_REPORT response)
|
||||
für teil eins mit licht und so und nicht tasten
|
||||
|
||||
0000 80 04 16 03 e8 92 ff ff 43 02 80 0a 03 00 2d 00
|
||||
0010 f1 9a cc 66 00 00 00 00 28 be 0e 00 00 00 00 00
|
||||
0020 9a 00 00 00 9a 00 00 00 00 00 00 00 00 00 00 00
|
||||
0030 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00
|
||||
0040 08 11 00 00 00 00 00 00 64 17 04 45 00 0c 00 0f
|
||||
0050 00 13 00 17 00 1b 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 ff 00 ff ff ff 00 ff ff 9b 00 00 ff 00 ff
|
||||
0080 ff ff ff 46 00 02 43 00 36 ff 00 00 32 07 ff ff
|
||||
0090 ff 00 00 00 ff ff ff 00 00 00 ff ff ff 00 00 00
|
||||
00a0 ff ff ff 02 02 00 ff 00 00 00 ff 00 00 00 ff 00
|
||||
00b0 00 00 00 ff ff ff 46 00 ff 00 ff ff ff ff ff 00
|
||||
00c0 00 ff 00 00 01 02 03 04 05 06 07 42 42 02 ff 00
|
||||
00d0 00 27 40 01 02 ff 00 00 a5 00
|
||||
|
||||
ab 0x40 fängt erst die config an was davor das zeug ist keine ahnung
|
||||
|
||||
SET_REPORT request for getting the number 1 config
|
||||
|
||||
0000 80 64 3c 75 e9 92 ff ff 53 02 00 0b 03 00 00 00
|
||||
0010 18 aa cc 66 00 00 00 00 d5 89 0a 00 8d ff ff ff
|
||||
0020 08 00 00 00 08 00 00 00 21 09 05 03 01 00 08 00
|
||||
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
->0040 05 11 00 00 00 00 00 00
|
||||
|
||||
SET_REPORT request for getting the number 2 config
|
||||
|
||||
0000 00 7e 3c 75 e9 92 ff ff 53 02 00 0b 03 00 00 00
|
||||
0010 18 aa cc 66 00 00 00 00 87 dc 07 00 8d ff ff ff
|
||||
0020 08 00 00 00 08 00 00 00 21 09 05 03 01 00 08 00
|
||||
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
->0040 05 12 00 00 00 00 00 00
|
||||
|
|
|
|||
97
src/main.cpp
97
src/main.cpp
|
|
@ -36,9 +36,11 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
libusb_context *ctx;
|
||||
int r = libusb_init(&ctx);
|
||||
if(r<0) {
|
||||
if (r < 0)
|
||||
{
|
||||
std::cout << libusb_error_name(r) << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -58,27 +60,98 @@ int main(int argc, char *argv[])
|
|||
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){
|
||||
if (desc.idProduct == 0x2f && desc.idVendor == 0x258a)
|
||||
{
|
||||
std::cout << "test" << std::endl;
|
||||
std::cout << std::hex << (int)(desc.bNumConfigurations) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
libusb_device_handle *handle;
|
||||
if(!libusb_open(found, &handle))
|
||||
std::cout << "drrsdfsdf" << std::endl;
|
||||
if ((r = libusb_open(found, &handle)) < 0)
|
||||
std::cout << "libusb_open: " << libusb_error_name(r) << 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;
|
||||
unsigned char data2[520];
|
||||
unsigned char deviceData[520];
|
||||
memset(deviceData, 0, 520 * sizeof(unsigned char));
|
||||
std::string data01 = "081100920000000064170445000c000f00130017001b00000000000000000000000000000000000000000000000000000000ff00ffffff00ffff9b0000ff00ffffffff460002430036ff00003207ffffff000000ffffff000000ffffff000000ffffff020200ff000000ff000000ff00000000ffffff4600ff00ffffffffff0000ff000001020304050607424202ff000027400102ff0000a500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
|
||||
std::string data02 = "081200500000000011010000110200001104000011080000111000002100610041000000500600001102000021005a0021005b0021005c0021005d0021005e0021005f002100600050010000500100005001000050010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
|
||||
for (int i = 0; i < 1040; i += 2)
|
||||
{
|
||||
data[i / 2] = std::stoi(data01.substr(i, 2), (std::size_t *)0, 16);
|
||||
data2[i / 2] = std::stoi(data02.substr(i, 2), (std::size_t *)0, 16);
|
||||
}
|
||||
libusb_detach_kernel_driver(handle, 0);
|
||||
/*
|
||||
self.set_report(0x0305, [5, 0x80, 0, 0, 0, 0, 0, 0])
|
||||
self.get_report(0x0305, 8)
|
||||
self.set_report(0x0305, [5, 0x21, 0, 0, 0, 0, 0, 0])
|
||||
odata = self.get_report(0x0308, 520)
|
||||
|
||||
libusb_claim_interface(handle, 0);
|
||||
self.set_report(0x0308, data)
|
||||
self.set_report(0x0308, data2)
|
||||
*/
|
||||
|
||||
libusb_control_transfer(handle, 0x21, 0x09, 0x0308, 1, data, 520, 0);
|
||||
libusb_release_interface(handle, 0);
|
||||
if ((r = libusb_detach_kernel_driver(handle, 1)) < 0)
|
||||
std::cout << "libusb_detach_kernel_driver: " << libusb_error_name(r) << std::endl;
|
||||
if ((r = libusb_claim_interface(handle, 1)) < 0)
|
||||
std::cout << "libusb_claim_interface: " << libusb_error_name(r) << std::endl;
|
||||
|
||||
unsigned char send_data0[8];
|
||||
memset(send_data0, 0, 8 * sizeof(unsigned char));
|
||||
send_data0[0] = 0x05;
|
||||
send_data0[1] = 0x21;
|
||||
if ((r = libusb_control_transfer(handle, 0x21, 0x09, 0x0305, 1, send_data0, 8, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer1: " << libusb_error_name(r) << std::endl;
|
||||
/*if ((r = libusb_control_transfer(handle, 0xa1, 0x01, 0x0305, 1, send_data0, 8, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer2: " << libusb_error_name(r) << std::endl;
|
||||
for(int i = 0; i < 8; ++i)
|
||||
std::cout << std::hex << (int)send_data0[i] << ", ";
|
||||
std::cout << std::endl;
|
||||
memset(send_data0, 0, 8 * sizeof(unsigned char));
|
||||
send_data0[0] = 0x05;
|
||||
send_data0[1] = 0x21;
|
||||
if ((r = libusb_control_transfer(handle, 0x21, 0x09, 0x0305, 1, send_data0, 8, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer3: " << libusb_error_name(r) << std::endl;
|
||||
*/
|
||||
if ((r = libusb_control_transfer(handle, 0xa1, 0x01, 0x0308, 1, deviceData, 520, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer2: " << libusb_error_name(r) << std::endl;
|
||||
for (int i = 0; i < 520; ++i)
|
||||
{
|
||||
std::cout << std::hex << (int)deviceData[i] << "|" << (int)data[i] << "\t";
|
||||
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
memset(send_data0, 0, 8 * sizeof(unsigned char));
|
||||
send_data0[0] = 0x05;
|
||||
send_data0[1] = 0x22;
|
||||
memset(deviceData, 0, 520 * sizeof(unsigned char));
|
||||
|
||||
if ((r = libusb_control_transfer(handle, 0x21, 0x09, 0x0305, 1, send_data0, 8, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer3: " << libusb_error_name(r) << std::endl;
|
||||
if ((r = libusb_control_transfer(handle, 0xa1, 0x01, 0x0308, 1, deviceData, 520, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer4: " << libusb_error_name(r) << std::endl;
|
||||
for (int i = 0; i < 520; ++i)
|
||||
{
|
||||
std::cout << std::hex << (int)deviceData[i] << "|" << (int)data2[i] << "\t";
|
||||
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
if ((r = libusb_control_transfer(handle, 0x21, 0x09, 0x0308, 1, data, 520, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer5: " << libusb_error_name(r) << std::endl;
|
||||
if ((r = libusb_control_transfer(handle, 0x21, 0x09, 0x0308, 1, data2, 520, 5000)) < 0)
|
||||
std::cout << "libusb_control_transfer6: " << libusb_error_name(r) << std::endl;
|
||||
|
||||
if ((r = libusb_release_interface(handle, 1)) < 0)
|
||||
std::cout << "libusb_release_interface: " << libusb_error_name(r) << std::endl;
|
||||
if ((r = libusb_attach_kernel_driver(handle, 1)) < 0)
|
||||
std::cout << "libusb_attach_kernel_driver: " << libusb_error_name(r) << std::endl;
|
||||
libusb_close(handle);
|
||||
|
||||
libusb_free_device_list(list, 1);
|
||||
|
|
|
|||
BIN
vgcore.77665
Normal file
BIN
vgcore.77665
Normal file
Binary file not shown.
Loading…
Reference in a new issue