Git Product home page Git Product logo

ratslap's Introduction

     ##### /##                          #######  ###
  ######  / ##                        /       ### ###
 /#   /  /  ##                 #     /         ##  ##
/    /  /   ##                ##     ##        #   ##
    /  /    /                 ##      ###          ##
   ## ##   /       /###     ######## ## ###        ##      /###       /###
   ## ##  /       / ###  / ########   ### ###      ##     / ###  /   / ###  /
   ## ###/       /   ###/     ##        ### ###    ##    /   ###/   /   ###/
   ## ##  ###   ##    ##      ##          ### /##  ##   ##    ##   ##    ##
   ## ##    ##  ##    ##      ##            #/ /## ##   ##    ##   ##    ##
   #  ##    ##  ##    ##      ##             #/ ## ##   ##    ##   ##    ##
      /     ##  ##    ##      ##              # /  ##   ##    ##   ##    ##
  /##/      ### ##    /#      ##    /##        /   ##   ##    /#   ##    ##
 /  ####    ##   ####/ ##     ##   /  ########/    ### / ####/ ##  #######
/    ##     #     ###   ##     ## /     #####       ##/   ###   ## ######
#                                 |                                ##
 ##                                \)                              ##
                                                                   ##
                                                                    ##

RatSlap

Linux configuration tool for Logitech mice (currently only G300/G300S)

Total alerts Language grade: C/C++


Introduction

RatSlap aims to provide a way to configure configurable Logitech mice from within Linux. It is licensed under the GNU GPL version 2. For more information, see LICENSE / COPYING .

For a list of authors and contributors, see AUTHORS / CONTRIBUTORS .

For more information on contributing (new feature, bug fix, pull request etc), please see CONTRIBUTING .


Availability

{ BACKWARDS COMPATIBILITY WARNING FOR PRE-0.4.0 {

The default branch has changed from master to main. If you are building from source, and have an existing fork/clone, you may need to build this in a clean directory and/or update your remote tracking branch. Sorry about that.

} BACKWARDS COMPATIBILITY WARNING FOR PRE-0.4.0 }

{ BACKWARDS COMPATIBILITY WARNING FOR PRE-0.3.0 {

The key that was called Menu in now called Application (bringing it in line with the standard USB HID naming scheme. If you have any scripts calling this, and using Menu, they will need to be updated.

Additionally, there was a bug whereby unrecognised keys would be silently ignored - this is no longer the case, they are now reported as an error.

} BACKWARDS COMPATIBILITY WARNING FOR PRE-0.3.0 }

The most current release is v0.4.1 and is available from:

RatSlap binary and archive should be signed with my GPG key ( 231A 94F4 81EC F212 ).

Binary signature files end in .asc and can be verified using gpg/gpg2 thus:

$ gpg --verify ratslap-0.2.2.x86_64.tar.gz.asc
    gpg: assuming signed data in `ratslap-0.2.2.x86_64.tar.gz'
    gpg: Signature made 2018-05-01T01:00:52 AEST using RSA key ID 81ECF212
    gpg: Good signature from "Krayon (Code Signing Key) <[email protected]>"
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg:          There is no indication that the signature belongs to the owner.
    Primary key fingerprint: CDEC 1051 0874 06FB 8323  46DC 231A 94F4 81EC F212

You may first need to retrieve my public key if you haven't already done so:

$ gpg --recv-keys 81ECF212
    gpg: keyring `/home/krayon/.gnupg/secring.gpg' created
    gpg: requesting key 81ECF212 from hkp server keys.gnupg.net
    gpg: /home/krayon/.gnupg/trustdb.gpg: trustdb created
    gpg: key 81ECF212: public key "Krayon (Code Signing Key) <[email protected]>" imported
    gpg: no ultimately trusted keys found
    gpg: Total number processed: 1
    gpg:               imported: 1  (RSA: 1)

RatSlap source is available on GitHub , GitLab and BitBucket with the primary (public) repository being GitHub .


What's New?

The main changes in the more recent versions is the DPI Support ( Daniel Dawson ) and the new keys: NonUS#, CapsLock, NonUS\, Application, Power, Num=, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, Execute, Help, Menu, Select, Stop, Again, Undo, Cut, Copy, Paste, Find, Mute, VolumeUp, VolumeDown, Num, (Brazillian keypad period (.)?), AS400Num= (Keypad Equal Sign on AS/400 keyboards), SysReq (SysReq/Attention), Cancel, Clear, Prior, Return, Separator, Out, Oper, ClearAgain, CrSelProps, ExSel, Num00, Num000, Sep1000s (Thousands separator - locale specific?), SepDec (Decimal separator - locale specific?), CurrUnit (Currency Unit - locale specific?), CurrSubUnit (Currency Sub-Unit - locale specific?), Num(, Num), Num{, Num}, NumTab, NumBackspace, NumA, NumB, NumC, NumD, NumE, NumF, NumXOR, Num^, Num%, Num<, Num>, Num&, Num&&, Num|, Num||, Num:, Num#, NumSpace, Num@, Num!, NumMemStore, NumMemRecall, NumMemClear, NumMemAdd, NumMemSub, NumMemMul, NumMemDiv, NumPlusMinus, NumClear, NumClearEntry, NumBinary, NumOctal, NumDecimal, NumHex.

Now a lot of the above keys haven't been tested and in some cases I have NO IDEA what they are :P They come from the USB HID keyboard codes though.

For other features and bug fixes see Version History below.


Bug Tracker

Bugs are tracked on the Quadronyx Bug Tracker .


Usage

NOTE: The Logitech G300 and G300s differ only by name and physical appearance, otherwise they are functionally (and USB VID:PID) identical.

The Logitech G300/G300s has 3 button modes, affectionately known as F3, F4 and F5. For each of these modes, you can assign an LED colour, report rate (speed at which the mouse communicates with the computer), DPI setting(s) and button/key combinations.

NOTE: You cannot remap the scrollwheel. These generate button 4 (up) and 5 (down) and cannot be changed.

The default mapping for F3 on the G300/G300s, for example, is currently:

$ ratslap -pf3
Printing Mode: F3
  Colour:              cyan
  Report Rate:          500
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  LeftCtrl +
  G7:                  LeftAlt +
  G8:                  ModeSwitch
  G9:                  DPICycle

Remapping to just mouse buttons

One usage for RatSlap may be to remap the buttons to generate standard mouse buttons higher than the 1-3 + scrollwheel (4 and 5).

Above, we see a typical button 1/2/3 configuration for left, right and middle respectively. We can also see the G4 button generates mouse button 6 and G5 generates mouse button 7. Unfortunately, G6-G9 do not generate the desired extra

We can rectify this easily, using RatSlap:

$ ratslap --modify F3 --colour Magenta --G6 Button8 --G7 Button9 --G8 Button10 --G9 Button11
Modifying Mode: F3
    Setting colour: magenta
    Setting button 6: Button8
    Setting button 7: Button9
    Setting button 8: Button10
    Setting button 9: Button11
Saving Mode: F3

Now, we have all mouse buttons functioning as mouse buttons! Go figure! And as an added bonus, we have a nice Magenta glow.

$ ./ratslap --print F3
Printing Mode: F3
  Colour:              magenta
  Report Rate:          500
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  Button8
  G7:                  Button9
  G8:                  Button10
  G9:                  Button11

Finally, we can select the F3 mode (if we're not already using it):

$ ./ratslap --select F3
Selecting Mode: F3

Firefox tab switching buttons

Another option might be using the buttons behind the wheel (G8 and G9) to switch forward and backward (respectively) between tabs in your favourite browser ... or Firefox.

So, let's set the buttons to Control-TAB and Control-Shift-TAB, print out our config, then switch to that mode:

$ ratslap --modify F3 --G8 LeftCtrl+TAB --G9 LeftCtrl+LeftShift+TAB --print F3 --select F3
Modifying Mode: F3
    Setting button 8: LeftCtrl+TAB
    Setting button 9: LeftCtrl+LeftShift+TAB
Saving Mode: F3

Printing Mode: F3
  Colour:              magenta
  Report Rate:          250
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  Button8
  G7:                  Button9
  G8:                  LeftCtrl + Tab
  G9:                  LeftCtrl + LeftShift + Tab

Selecting Mode: F3

ERROR: libusbx: error [_get_usbfs_fd] libusbx...

When you try to run RatSlap, you may receive an error similar to the following:

libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/002/090: Permission denied
libusbx: error [_get_usbfs_fd] libusbx requires write access to USB device nodes.
20161115T002046+1100 [E]           main.c:00581:mouse_init      Failed to find Logitech G300s (046d:c246)

This is caused, as the error suggests, by the fact that you do not have write access to the mouse (/dev/bus/usb/002/090 in the example above).

There are two possible ways around this issue:

  1. (NOT RECOMMENDED) Run ratslap as root;
  2. Grant permissions to the device for your user account.

The later is the preferred option here. To do this, simply ensure you have write permissions to the device. One such way is to make it group-writable, change the group ownership and place yourself in the newly owning group, eg:

$ ls -lah /dev/bus/usb/002/090
crw-r--r-- 1 root root 189, 217 2016-11-14 19:22 /dev/bus/usb/002/090

$ groups
adm dialout cdrom sudo audio dip video plugdev netdev fuse lpadmin scanner
sambashare vboxsf vboxusers nonet

$ sudo chgrp adm /dev/bus/usb/002/090
[sudo] password for krayon:

$ sudo chmod g+w /dev/bus/usb/002/090

History

I recently (October 2016) purchased a Logitech G300S due mainly to the many extra buttons. I didn't care that the software didn't support Linux as I only wanted the extra buttons to generate extra mouse buttons, not keys or anything fancy.

Unfortunately, when I plugged it in, I discovered that none of the default 3 modes generated the extra mouse buttons I desired, instead generating useless and annoying keypress events such as CTRL-C, CTRL-X and CTRL-V.

Worse still, I also discovered that the Windows software only allows you to assign mouse buttons 1 through 7, skipping 4 and 5 (scroll-wheel). These are Left-Click (1), Middle-Click (2), Right-Click (3), Browser Back (6) and Browser Forward (7) respectively! Therefore, Logitech provides no way of generating higher mouse button events, button 8 for example. Hopefully this is a limitation in the Logitech software and not in the mouse itself (see Notes).


Features

  • Configure the mouse options, same as the Logitech Windows only software.
  • Bind all buttons, except the scroll wheel up and down, a total of 9 (Logitech tool only allows 5).
  • Assign mouse clicks or keys to the Left and Right buttons (which the Logitech tool cannot do).
  • Freely assign 'Mode Switch' to a mouse button in only one mode/profile.
  • Assign mouse clicks with key modifiers (which Logitech doesn't offer).

Version History


TODO


Notes

Key names

It seems the key names (and codes) are standard USB HID ones, who knew?! :D

More info at:

Technique to sniff USB traffic

https://julien.danjou.info/blog/2012/logitech-k750-linux-support shows a technique for sniffing USB traffic using the usbmon kernel module.

Unfortunately it looks like I'll need to create a Windows VM to run the Logitech software on :(

Logitech Software's Artificial Restrictions

After considerable testing, I have found some operations the hardware supports that Logitech's management software does not.

Firstly, I can confirm that we can actually set 9 mouse buttons (1, 2, 3, 6, 7, 8, 9, 10 and 11). This is good news as it was what I originally expected from the Logitech G300s in the first place :D

We can also re-assign left and right buttons to different keys/buttons. Logitech's software did not allow this, presumably to avoid accidentally removing your ability to actually "left-click" anything :P

Once you assigned the 'Mode Switch' to a button in one profile/mode, it was also set in the other profiles/modes. This is presumably so you can always change to another mode. We shall impose no such limitation.

Lastly, and perhaps rather attractively, we can assign mouse buttons to perform mouse clicks WITH modifiers! You can therefore bind Ctrl+Shift+Right-Click to the left mouse button if you so desire.


ratslap's People

Contributors

captn3m0 avatar ddawson avatar krayon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ratslap's Issues

Current rev (89b0d34) does not compile

log.h:44:13: warning: inline function ‘std_output’ declared but never defined
  inline void std_output(FILE *strm, const char *srcfile, const int line

leading to a

main.o: In function `mouse_hid_detach_kernel':
/tmp/ratslap/main.c:596: undefined reference to `std_output'
/tmp/ratslap/main.c:601: undefined reference to `std_output'
main.o: In function `mouse_hid_attach_kernel':
/tmp/ratslap/main.c:622: undefined reference to `std_output'
/tmp/ratslap/main.c:617: undefined reference to `std_output'
main.o: In function `main':
/tmp/ratslap/main.c:745: undefined reference to `std_output'
main.o:/tmp/ratslap/main.c:501: more undefined references to `std_output' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:176: ratslap] Error 1

Media Commands

can i remap the mouse button for media playback? how i configure it? still noob :)

[Documentation] Basic How-To

I may be tired, but I don't get how to set say key 1 to my button G4. Actually, apart from calling ./ratslap -p f3-5 I don't understand how you actually set a modified mode. Should I edit the source code and recompile?

Doube G5 and G4

when i set control configuration in dota2 to binding G7 and G6 buttotns it refers to G5 and G4 respectively. before i run the ratslap i try this script before :

xinput list | grep G300

then

#!/bin/sh
DEVICE_ID=$(xinput list |  grep "Logitech Gaming Mouse G300" | grep keyboard | sed 's/.*id=\([0-9]*\).*/\1/')

if xinput -list-props $DEVICE_ID | grep "Device Enabled" | grep "1$" > /dev/null
then
        xinput set-int-prop $DEVICE_ID "Device Enabled" 8 0
fi

Do you have an idea for a solution?
Thank you !

Make permissions permanent

In this section "ERROR: libusbx: error [_get_usbfs_fd] libusbx..." the fix you reccomend needs to be done each time you reboot or unplug the mouse. Using a udev rule will allow for a one time change of permissions.

I created this rule in /etc/udev/rules.d/99-logitech.rules
SUBSYSTEM=="input", ATTRS{idVendor}=="", ATTRS{idProduct}=="", MODE="0660", GROUP=""
and can be found by lsusb
is the group you want

Help needs priority

If you run 'ratslap -h' normally such that the user doesn't have access to the usb, you get an error about not being able to do any usb ops rather than the help. Help should ALWAYS be available. I'd suggest checking if the help option has been asked for first before anything else, and if so print the help and exit. Only if the user doesn't want help should it then try to get the usb.

Key+Button possible?

Hi, thank you for the awesome tool!
It's currently not possible to make a mouse button do something like:
LeftShift+U+Button1
or
A+Button1
This would be useful in games, any chance this can be done or is it a limitation?

Duplicate modifier when assigning to a button

When trying to reset the buttons to default settings (LeftCtrl and LeftAlt), the modifier gets duplicated

./ratslap --modify f3 --g6 'LeftCtrl' --g7 'LeftAlt' -p f3
...
  G6:                  LeftCtrl + LeftCtrl
  G7:                  LeftAlt + LeftAlt

I'd expect:

  G6:                  LeftCtrl +
  G7:                  LeftAlt +

All buttons with "tab" doesn't work anymore

On Arch, with the last updates, it seems that every buttons which use a "tab" (example: "LeftCtrl+Tab") doesn't work anymore. I have no idea why, it's something new. When I push the button it's only a "tab", but if I stay pressed, it works but it's not the behaviour you want. No issues with "LeftCtrl+C". No issues on Windows.

Maybe it's not related with ratslap, it could be a firmware issue.

Edit: I think it's from libinput which has been updated recently, but I need confirmation.

Error with 'LeftCtrl+Num+' key

Hi,

I have this error when assign a button to LeftCtrl+Num+ (zoom+ in FIrefox), LeftCtrl+Num- is ok.

$ ./ratslap --modify F3 --G7 LeftCtrl+Num+ --G6 LeftCtrl+Num- --print F3 --select F3                  
RatSlap v0.2.2-tags/0.2.2^0 (BUILT: 2018-07-11 11:06:16+0200)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x5568a0d53ce0
Detaching kernel driver...
Modifying Mode: F3
    Setting button 7: LeftCtrl+Num+
20180712T132246+0200 [E]           main.c:01101:set_mode_button ERROR: Invalid modifier (Num) specified: LeftCtrl+Num+
    Setting button 6: LeftCtrl+Num-
Saving Mode: F3
Printing Mode: F3
  Colour:              cyan
  Report Rate:          500
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  LeftCtrl + Num-
  G7:                  Button9
  G8:                  LeftCtrl + Tab
  G9:                  LeftCtrl + LeftShift + Tab
Mode Selection Specified: F3
Selecting Mode: F3
Attaching kernel driver...

Modify default DPI

In the case I assigned all button to send mouse clicks, how can I set a default DPI?

./ratslap --modify F4 --colour Black --G6 Button8 --G7 Button9 --G8 Button10 --G9 Button11

My mouse chooses 1000 by default, but I like it at 2500 for gaming:

RatSlap v0.2.0 (BUILT: 2016-11-09 10:35:24+0100)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x24ed3f0
Detaching kernel driver...
Printing Mode: F4
  Colour:              black
  Report Rate:         1000
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           500
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  Button8
  G7:                  Button9
  G8:                  Button10
  G9:                  Button11
Attaching kernel driver...

I know it's in your todo list, but it may be clearer to have an issue for that.

Button5 cannot be assigned to G5

I have a very weird behaviour here. After having modified many buttons to suit my needs, I have the following problem.

I cannot assign many software mouse Buttons to many hardware buttons. Assigning keys seems to always work tho.

Say I am in this situation:

╰─[XPS15af]─>  sudo ratslap --p F3
RatSlap v0.2.1-1-gd6b9714 (BUILT: 2017-04-07 16:39:56+0200)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0xfcba80
Detaching kernel driver...
Printing Mode: F3
  Colour:              cyan
  Report Rate:         1000
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  
  G5:                  
  G6:                  
  G7:                  
  G8:                  ModeSwitch
  G9:                  DPICycle
Attaching kernel driver...

Now let's try to modify it with:

╰─[XPS15af]─>  sudo ratslap --modify F3 --G4 Button4
RatSlap v0.2.1-1-gd6b9714 (BUILT: 2017-04-07 16:39:56+0200)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x13aea80
Detaching kernel driver...
Modifying Mode: F3
    Setting button 4: Button4
Saving Mode: F3
Attaching kernel driver...

Result:

╰─[XPS15af]─>  sudo ratslap --p F3
RatSlap v0.2.1-1-gd6b9714 (BUILT: 2017-04-07 16:39:56+0200)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x1a5ba80
Detaching kernel driver...
Printing Mode: F3
  Colour:              cyan
  Report Rate:         1000
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  
  G5:                  
  G6:                  
  G7:                  
  G8:                  ModeSwitch
  G9:                  DPICycle
Attaching kernel driver...

Nothing! Let's try assigning keys instead:

sudo ratslap --modify F3 --G4 LeftAlt+K
RatSlap v0.2.1-1-gd6b9714 (BUILT: 2017-04-07 16:39:56+0200)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0xe9fa80
Detaching kernel driver...
Modifying Mode: F3
    Setting button 4: LeftAlt+K
Saving Mode: F3
Attaching kernel driver...
┌─[✓]─[21:51:59]─[+80%]─[39°C]─[pwd:~]
╰─[XPS15af]─>  sudo ratslap --p F3
RatSlap v0.2.1-1-gd6b9714 (BUILT: 2017-04-07 16:39:56+0200)
Copyright (C) 2016 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x10efa80
Detaching kernel driver...
Printing Mode: F3
  Colour:              cyan
  Report Rate:         1000
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  LeftAlt + K
  G5:                  
  G6:                  
  G7:                  
  G8:                  ModeSwitch
  G9:                  DPICycle
Attaching kernel driver...

Works...

In short, I can seem to bind mouse Buttons anymore!
However, some, like sudo ratslap --modify F3 --G7 Button9 work, while others, like sudo ratslap --modify F3 --G7 Button5 do not.

Error [compiling]

taha@linux:~/ratslap$ make
Generating tags file...
/bin/sh: 1: ctags: not found
No ctags found, skipping tags file...
RatSlap
Pulling from origin...
All updated.
Generating Changelog...
Generating git header file...
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusb-1.0' found
gcc -march=native -O2 -pipe -Wall -Werror -ggdb -DDEBUG -DINFO -c "log.c" -o "log.o"
log.c:25:10: fatal error: stdio.h: No such file or directory
25 | #include <stdio.h>
| ^~~~~~~~~
compilation terminated.
make: *** [Makefile:270: log.o] Error 1

How to use this tool ?

Hello,

Can you add documentation in order to explain how to install this tool please ?
For those who are not familiar to C language.
On my side, I have download sources and run the command "make", but I have an error which is :
/bin/sh: 1: ctags: not found
Makefile:170 : la recette pour la cible « ctags » a échouée
make: *** [ctags] Erreur 127

Thanks for your help

How to assign multiple keypresses

Hi mate, thanks heaps for your efforts, I really appreciate what you have done and thanks so much for taking the time to document it and and publish it; it's awesome.

I was able to get ratslap working OK, and If i assign a single button it works fine; here i assign the number 5 key to mouse button 5:

$ ./ratslap --modify F4 --g5 5
RatSlap v0.3.2 (BUILT: 2020-05-25 13:48:43+1000)
Copyright (C) 2016-2020 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x562f2320dcd0
Detaching kernel driver...
Modifying Mode: F4
    Setting button 5: 5
Saving Mode: F4
Attaching kernel driver...

As per your example I can use the + modifier OK:

./ratslap --modify F4 --g5 LeftCtrl+TAB
RatSlap v0.3.2 (BUILT: 2020-05-25 13:48:43+1000)
Copyright (C) 2016-2020 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x563cebc8dcd0
Detaching kernel driver...
Modifying Mode: F4
    Setting button 5: LeftCtrl+TAB
Saving Mode: F4
Attaching kernel driver...

However if i use the + syntax to assign both numbers 5 and 6 to mouse button 5 i get an error:

./ratslap --modify F4 --g5 5+6
RatSlap v0.3.2 (BUILT: 2020-05-25 13:48:43+1000)
Copyright (C) 2016-2020 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x560cb5071cd0
Detaching kernel driver...
Modifying Mode: F4
    Setting button 5: 5+6
20200525T151150+1000 [E]           main.c:01226:set_mode_button ERROR: Invalid modifier (5) specified: 5+6
Saving Mode: F4
Attaching kernel driver...

interface number wrong

I ran these apt-get commands and then make and everything worked except for the interface number, which defaults to 1 but had to be 0 on my system and which resulted in the fact that the kernel driver could not be detached.

sudo apt-get install build-essential pkg-config linux-headers-amd64 libusb-1.0-0-dev

Originally posted by @silkentrance in #10 (comment)

How do I use???

I'm a total noob to linux still learning I read the usage document but I don't understand how to actually install ratslap?? I downloaded files then what

libusb couldn't open USB device /dev/bus/usb/001/004: Permission denied

Well I only can run the program as root:
I compile like a user-not-root
$/home/francisco/Documents/ratslap/ratslap -p f3
RatSlap v0.4.1 (BUILT: 2020-10-12 22:02:37-0300)
Copyright (C) 2016-2020 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/004: Permission denied
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
20201012T222516-0300 [E] main.c:00647:mouse_init Failed to find Logitech G300s (046d:c246)

My work arraound is:

sudo chown root:root /home/francisco/Documents/ratslap/ratslap
sudo chmod 4775 /home/francisco/Documents/ratslap/ratslap

/home/francisco/Documents/ratslap/ratslap -p f3
RatSlap v0.4.1 (BUILT: 2020-10-12 22:02:37-0300)
Copyright (C) 2016-2020 Todd Harbour
Linux configuration tool for Logitech mice (currently only G300/G300S)
https://gitlab.com/krayon/ratslap/
Found Logitech G300s (046d:c246) @ 0x5629d8c31680
Detaching kernel driver...
Printing Mode: F3
Colour: red
Report Rate: 500
DPI #1: 250
DPI #2: (DEF) 1000
DPI #3: 1500
DPI #4: 2500
DPI Shift: 4000 [DISABLED]
Left Click (But1): Button1
Right Click (But2): Button2
Middle Click (But3): Button3
G4: LeftCtrl +
G5: LeftCtrl +
G6: LeftCtrl +
G7: LeftCtrl +
G8: ModeSwitch
G9: DPICycle
Attaching kernel driver...

Weird behavior with scrollwheel

On KDE, the scrollwheel has a weird behavior. When I alt+tab between windows, then I use the scrollwheel, it scrolls up when I want to scroll down the first time then it scrolls down…

If I use this script to deactivate the keyboard feature, it works as expected.

 
#!/bin/sh
DEVICE_ID=$(xinput list |  grep "Logitech G300s Optical Gaming Mouse" | grep keyboard | sed 's/.*id=\([0-9]*\).*/\1/')

if
    xinput -list-props $DEVICE_ID | grep "Device Enabled" | grep "1$" > /dev/null
then
    xinput set-int-prop $DEVICE_ID "Device Enabled" 8 0
fi

But… the extra buttons don't work anymore and I can't use ratslap with this solution.

Have you the same issue?
Do you have an idea for a solution?
Can ratslap do something about that?

Thank you!

EDIT: well, you know what? It seems I don't have this bug on Wayland. So, maybe, the best solution is to switch to Wayland when it will be better.

dpishift: Unrecognised options: 500

I just buy a G300s and I'm using this tool, I love it but when trying to set the DPI for the DPI Shift I got this error message:
prompt> sudo ratslap --modify F3 --dpishift 500

Found Logitech G300s (046d:c246) @ 0x564e9540ade0
Detaching kernel driver...
Modifying Mode: F3
    Enabling DPI shift
20200809T000532-0500 [E]           main.c:01792:main            ERROR: Unrecognised options: 500
Saving Mode: F3
Attaching kernel driver...

And… it's fully need to output ratslap --version every time i run it?.
I installed from AUR

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.