Coder Social home page Coder Social logo

Comments (23)

pwr avatar pwr commented on July 17, 2024

HID++ 2.0 has support for a battery feature. Not all HID++ 2.0 devices have that feature, however: e.g. the K750 keyboard does not, but has a different feature related to the light sensor that also reports the battery charge.

from solaar.

pwr avatar pwr commented on July 17, 2024

Right now Solaar tries to enable all notifications, but on the receiver alone. I haven't looked yet at notification flags on the devices themselves.

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

Just do not enable all notifications by setting FF FF FF. On the k800, r1_bit1 has a side-effect that some keys (like Mute) are not delivered to the OS (https://git.lekensteyn.nl/ltunify/tree/registers.txt#n81). It should be possible to make Solaar generate events though... but that is getting off-topic in this issue I guess.

from solaar.

pwr avatar pwr commented on July 17, 2024

That is interesting to know; will have to check if it has the same effect on my K750.

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

Please have a look at https://github.com/Lekensteyn/Solaar/commits/sandbox, mainly:
Lekensteyn/Solaar@742d5de - RFC battery notification processing.
Lekensteyn/Solaar@e3a2731 - (simple commit moving battery register parsing into a separate function)
(the other commit is a simple fix that can be cherry picked if you want).

TODO: enable device notification enablement, can you suggest a place to do so? A quick look did not reveal a central place where new devices are (un)tracked.

from solaar.

pwr avatar pwr commented on July 17, 2024

Okay, I've done some testing with my M705 mouse; it's 0x0D register behaves the same as the 0x07 register, when the battery_notification flag is set. The battery status mesage (10 0x 0D) is only sent once, when the flag is set. No idea if it is sent at any point afterwards (the battery discharges very slow).

from solaar.

pwr avatar pwr commented on July 17, 2024

In lib/solaar/listener.py, line 141 (in _notifications_handler()), is where the devices are properly set-up after being discovered.

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

Heh, I wish we had more HID++ 1.0 devices to check. I see a Performance MX mouse in the repo, do you have that device in your possession? Btw, my M525 has the same "problem", it is still full ("90%") after one year and I cannot get this down (the Illuminated keyboard is easier to empty, set lights to a max brightness and wait)

from solaar.

pwr avatar pwr commented on July 17, 2024

No Performance MX, just a K750 and M705.
However, I can borrow tomorrow a M515 to check its registers.

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

That would be great. So far, the common registers seems to be:

  • 00: Notifications (m510, k800, k705; should apply to every machine, in HID++ 1.0 spec)
  • 01: different functions on m510, k800, k705
  • 07: battery status (m510, k800)
    -- D0: unknown (k800, k705); different value on m510
  • F1: firmware/bootloader version (m510, k800, k705)
  • F3: unknown function (m510, k800, k705)

Hopefully the differences exist only between types (keyboards, mice, ...) and not models.

from solaar.

pwr avatar pwr commented on July 17, 2024

Hm, the M515 is a HID++2.0 device, and has the standard BATTERY feature (no battery registers).

from solaar.

terwarf avatar terwarf commented on July 17, 2024

I own a Performance MX mouse - if you tell me what to do, i would love to help in these issue...

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

@terwarf Great, please turn off interfering programs (like Solaar) and run the tools/scan-registers.sh tool from git with Python 2 as python in your PATH. Wait a minute for completion and paste the output here.

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

@pwr I see you did some work for integrating other types of notifications. How is the battery status supposed to be updated? By writing self[BATTERY_LEVEL] and calling self._changed()?

from solaar.

pwr avatar pwr commented on July 17, 2024

Yup, the first if of _process_feature_notification() is a pretty good example.

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

I was (and am still) confused by this:

self[BATTERY_STATUS] = BATTERY_STATUS[battery_status]

BATTERY_STATUS = 'battery-status' in status.py and _NamedInts in hidpp20.py. Shouldn't it be:

self[BATTERY_STATUS] = _hidpp20.BATTERY_STATUS[battery_status]

from solaar.

pwr avatar pwr commented on July 17, 2024

Yup, that's a bug.
This is what happents when I don't have a device with the feature, to trip over stuff like this :).

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

I will fix it together with refactoring this in a function in preparation for #30.

from solaar.

terwarf avatar terwarf commented on July 17, 2024

Here is the output of scan-registers.sh from my Performance MX mouse:

alex@linux-v34d:~/Downloads/Solaar-master/tools> ./scan-registers.sh 1
<< (   0.017) [10 01 8100 000000] '\x10\x01\x81\x00\x00\x00\x00'
>> (   0.049) [10 01 8100 000000] '\x10\x01\x81\x00x00x00\x00'
<< (   1.050) [10 01 8101 000000] '\x10\x01\x81\x01\x00\x00\x00'
>> (   1.097) [10 01 8101 020000] '\x10\x01\x81\x01\x02\x00\x00'
--
<< (   7.335) [10 01 8107 000000] '\x10\x01\x81\x07\x00\x00\x00' 
>> (   7.382) [10 01 8107 070000] '\x10\x01\x81\x07\x07\x00\x00'
-- 
<< (  86.592) [10 01 8151 000000] '\x10\x01\x81Q\x00\x00\x00'
>> (  86.639) [10 01 8151 111100] '\x10\x01\x81Q\x11\x11\x00'
--
<< ( 108.430) [10 01 8163 000000] '\x10\x01\x81c\x00\x00\x00'
>> ( 108.477) [10 01 8163 890000] '\x10\x01\x81c\x89\x00\x00'
--
<< ( 240.505) [10 01 81D0 000000] '\x10\x01\x81\xd0\x00\x00\x00'
>> ( 240.550) [10 01 81D0 000000] '\x10\x01\x81\xd0\x00\x00\x00'
--
<< ( 245.690) [10 01 81D4 000000] '\x10\x01\x81\xd4\x00\x00\x00'
>> ( 245.737) [10 01 81D4 000012] '\x10\x01\x81\xd4\x00\x00\x12'
--
<< ( 281.016) [10 01 81F1 000000] '\x10\x01\x81\xf1\x00\x00\x00'
>> ( 282.177) [10 01 8F81 F10300] '\x10\x01\x8f\x81\xf1\x03\x00'
-- 
<< ( 284.106) [10 01 81F3 000000] '\x10\x01\x81\xf3\x00\x00\x00'
>> ( 284.153) [10 01 81F3 000000] '\x10\x01\x81\xf3\x00\x00\x00'

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

Odd, your notifications (the second line at 0.049) seem to miss some slashes, bug?

Please show the output of the following, it is on the tool-updates branch of my repo:

dev=1
do_req() { tools/hidconsole --hidpp | grep -v ' 8F.. ..0[12]' | grep -B 1 '^>> '; }
reg00=$(echo "10 0$dev 8100 000000" | do_req)
oldflags=$(echo "$reg00" | grep -Po '>>.*? 8100 \K[0-9a-f]{6}(?=\])')
if [ -n "$oldflags" ]; then
        echo "# Old notification flags: $oldflags"
        {
                echo "10 0$dev 8000 ffffff"     # enable all notifications
                echo "10 0$dev 8100 000000"     # read available notifs
                echo "10 0$dev 8000 $oldflags"  # restore notifications
        } | do_req | grep -B 1 '^>>.* 8100 '
fi

It should looks like:

# Old notification flags: 000000
<< (   1.098) [10 02 8100 000000] b'\x10\x02\x81\x00\x00\x00\x00'
>> (   1.347) [10 02 8100 130200] b'\x10\x02\x81\x00\x13\x02\x00'

(if it is empty, your device is incorrect. Try 2 or 3 depending on the connected machines)

from solaar.

terwarf avatar terwarf commented on July 17, 2024

That's probably my fault. I copied the output from console and have reformatted it to get rid of the whitespaces...

The Code above gives me:

# Old notification flags: 000000
<< (   1.113) [10 01 8100 000000] '\x10\x01\x81\x00\x00\x00\x00'
>> (   1.157) [10 01 8100 100000] '\x10\x01\x81\x00\x10\x00\x00'

from solaar.

Lekensteyn avatar Lekensteyn commented on July 17, 2024

Thank you, it looks like only battery updates are available from notifications.

from solaar.

pwr avatar pwr commented on July 17, 2024

The notification flags are now enabled for each device as it becomes available.

from solaar.

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.