cvuchener / hidpp

Collection of HID++ tools
GNU General Public License v3.0
90 stars 23 forks source link

Duplicated buttons info with hidpp-persistent-profiles #9

Closed dslul closed 5 years ago

dslul commented 5 years ago

Hi, I noticed that the library prints out the button mappings twice (g402). Here is the output:

./hidpp-persistent-profiles /dev/hidraw3 read

<profiles>
    <profile>
        <dir_unknown>0</dir_unknown>
        <enabled>true</enabled>
        <modes>
            <mode>
                <dpi>400</dpi>
            </mode>
            <mode>
                <dpi>800</dpi>
            </mode>
            <mode>
                <dpi>1600</dpi>
            </mode>
            <mode>
                <dpi>350</dpi>
            </mode>
        </modes>
        <angle_snapping>false</angle_snapping>
        <color>ffffff</color>
        <default_dpi>0</default_dpi>
        <name></name>
        <report_rate>3</report_rate>
        <revision>33</revision>
        <switched_dpi>0</switched_dpi>
        <buttons>
            <mouse-button>0</mouse-button>
            <mouse-button>1</mouse-button>
            <mouse-button>2</mouse-button>
            <mouse-button>3</mouse-button>
            <mouse-button>4</mouse-button>
            <special>ResolutionSwitch</special>
            <special>ResolutionPrev</special>
            <special>ResolutionNext</special>
            <mouse-button>0</mouse-button>
            <mouse-button>1</mouse-button>
            <mouse-button>2</mouse-button>
            <mouse-button>3</mouse-button>
            <mouse-button>4</mouse-button>
            <special>ResolutionSwitch</special>
            <special>ResolutionPrev</special>
            <special>ResolutionNext</special>
        </buttons>
    </profile>
</profiles>

I don't know if this issue is related to the profile, since there seems to be duplicate information also there:

00000000: 0300 0090 0120 0340 065e 0100 00ff ffff  ..... .@.^......
00000010: ff00 2100 ffff ffff ffff ffff ffff ffff  ..!.............
00000020: 8001 0001 8001 0002 8001 0004 8001 0008  ................
00000030: 8001 0010 9007 ffff 9004 ffff 9003 ffff  ................
00000040: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000050: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000060: 8001 0001 8001 0002 8001 0004 8001 0008  ................
00000070: 8001 0010 9007 ffff 9004 ffff 9003 ffff  ................
00000080: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000090: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000d0: 0002 0000 0000 28df 0008 51d3 0008 59d3  ......(...Q...Y.
000000e0: 0008 0500 0003 0000 0000 3cdf 0008 67d3  ..........<...g.
000000f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000100: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000110: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000120: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000130: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000140: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000150: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000160: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000170: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000180: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000190: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000200: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000210: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000220: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000230: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000240: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000250: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000260: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000270: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000280: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000290: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000300: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000310: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000320: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000330: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000340: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000350: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000360: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000370: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000380: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000390: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003f0: ffff ffff ffff ffff ffff ffff ffff e94e  ...............N
cvuchener commented 5 years ago

Not a bug from the tool, it is the expected behavior. But the documentation should be fixed.

The duplicated buttons are for the shifted mode (G-shift). In the doc, I forgot the ModeSwitch special action (it is referenced in the switched_dpi setting doc, but it should be ResolutionSwitch there).

000000d0: 0002 0000 0000 28df 0008 51d3 0008 59d3  ......(...Q...Y.
000000e0: 0008 0500 0003 0000 0000 3cdf 0008 67d3  ..........<...g.

The g402 uses profile format 1, right? The data after 000000d0 is ignored because I don't what it is. I don't even know how long the profile actually is, yours looks like 240-byte long but I wrote 224 in a comment. If you find out, please tell me.

cvuchener commented 5 years ago

Fixed in 14eb1dbc69d15e6b6ff1da7cb0e6b9afba7de660

I also renamed the special action to GShift to avoid confusion, Logitech uses "Mode Switch" for switching powersave modes on wireless devices. I don't know the value for the later.