GithubHelp home page GithubHelp logo

Crashes G910 firmware about g810-led HOT 34 CLOSED

matmoul avatar matmoul commented on August 22, 2024
Crashes G910 firmware

from g810-led.

Comments (34)

MatMoul avatar MatMoul commented on August 22, 2024

What your distrib ?

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Arch Linux x86_64

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

How do you install g810-led?
Now you have my package in aur : g810-led-git
Before installing the aur version, uninstall your current version with make uninstall

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Yeah I just noticed that a few minutes ago. I'm now using your AUR g810-led-git package. Same problem.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Can you more discribe symptom of your crash...
Do you have recently maked a firmware upgrade with Windows (grrr).

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Well not between switching g810-led versions. It works with the above mentioned commit. But not with any commit afterwards. Last firmware update in windows was at least two weeks ago.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

After this commit, I have full refactored the code
It's possible that a byte is false for the g910 in the new refactored version
But is very strange that your keyboard firmware crash
What do you mean by firmware crash ? (keyboard is dead, sending more command don't work, ...)

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

All colors except the G logo and the G910 logo are off
It usually keeps like that. Sometimes it switches back to the rainbow effect.

After some more testing I can also switch the color of the logo group but it only does that if I disable the LEDs with the keyboard button and reenable them.

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

I just set g810-led up as a project in CLion. If you want me to debug anything... I should be able to do that now.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

The "disable the LEDs with the keyboard button and reenable them" is a sign that commit don't work...

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

It seem a bug...

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Try to make your update, new version here

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Thanks. Now it works. But only with libusb. hidapi seems to be broken

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

What's your problem with hidapi, it's the new implementation...

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

It works. But it's not stable. A simple -a FF0000 leaves about one third of my keys with the wrong color
After multiple runs it finally changes them all

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Yes, what's your CPU ?
In the sendDataInternal function of Keyboard.cpp on line 509, I have set the value to 500...
It's a possible bug for more perf cpu than mind

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Intel(R) Core(TM) i5-4690.
a usleep(1000) works a lot better. But I can still trigger an error with a simple while true loop which starts g810-led multiple times very fast.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

I have not understood everything but the usleep and the CPU is a key...

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Can you give me the result of time g810-led -a ff0000 with your CPU and usleep 1000

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

This should help you understand what I tried to explain before: https://gist.github.com/CReimer/ea69e571945cc874c10f54b85aafa517

And here's the time output

real	0m0,018s
user	0m0,000s
sys	0m0,000s

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

I looked your link and when I launch the script with my G810, it's work and ctrl+c don't breack anything...

For your result : Less than 0.02... try to increase usleep

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

That doesn't help. Even very extreme values like 10000 don't fix it. It looks like multiple commands are overlapping.
usleeps don't solve anything here and I can't find anything in hidapi's API documentation which could help fix this.
I'll take a closer look at it tomorrow. Thanks.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Thanks for your return, I must also watch if I don't have an other error in g910 data...

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

I can't find anything. I think it's a bug in hidapi. It shouldn't be possible that multiple commands to the keyboard overlap. But for me it looks like that.

I'd stick with libusb. It's a well known mature library. If it's too slow, there might be some way to improve that.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

If you have time, you can test this three options (one at a time) :

  • In makefile, remove -O2 on line 2.
  • In Keyboard.cpp, in sendDataInternal on line 509 and 512
    comment the usleep
    and replace the 0 by a 1 at the end of hid_read_timeout
  • In Keyboard.cpp, in setKeys line 316
    decrease the max key sent at a time. sample :
    const uint8_t maxKeyCount = (data_size - 8) / 4 - 1;

For libusb it's very slow because the libusb_detach_kernel_driver function take 100ms and can not be skipped.

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Hmm. That fixed it. Great.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Cool but what option ?
It's just a tempory patch but I need to find the real bug.

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

OK. Finally tried these on it's own.

  1. Doesn't change anything. BTW. -O3 works quite well too
  2. This does the trick. It's not 100% reliable, but it's at least changing all key colors and doesn't leave a few out.
  3. Doesn't change anything.

With not 100% reliable I mean, that if i run g810-led -a ff0000 on the console and quickly press arrow up and enter. It crashes and tells me to try the libusb version.

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

The usleep is the devil part of the code...
Need to find best solution

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

With not 100% reliable I mean, that if i run g810-led -a ff0000 on the console and quickly press arrow up and enter. It crashes and tells me to try the libusb version.

This problem is strange ...
Does anyone else encounter this problem?
Bug or not bug?

usleed stay an obscure solution...

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

@CReimer I investigate but I can not reproduce...
What's your distro ?

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

Arch Linux x86_64

from g810-led.

MatMoul avatar MatMoul commented on August 22, 2024

Thanks, Same as me...
I will try to test on other computer than mine.

from g810-led.

CReimer avatar CReimer commented on August 22, 2024

With all the tinkering for #39 I stumbled upon this a few times. And I think I found a solution.

Remove the usleep(500) in line 565 of Keyboard.cpp
And replace the 0 at the end in line 568 with a 1.

This makes hidapi wait for something to read for at least 1ms. Which seems to be enough.

from g810-led.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.