GithubHelp home page GithubHelp logo

rhys-jmc / logitech-g400-config Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rprichard/logitech-g400-config

0.0 0.0 0.0 59 KB

CLI tool for setting G400 mouse settings (sampling rate and DPI) w/libusb

License: MIT License

Python 18.51% C 81.49%

logitech-g400-config's Introduction

logitech-g400-config

A command-line program for setting the sampling rate and DPI settings of the Logitech G400 gaming mouse.

The program uses the hidapi library (http://www.signal11.us/oss/hidapi/) for reading/writing the HID "feature reports" of the G400 mouse.

The tool is written in Python (either 2.7 or 3.x) and uses ctypes to access the native hidapi library.

NOTE: This program works with the G400 mouse, not the G400s mouse. See rprichard#3 for some details, or https://tnsp.org/~ccr/files/g400s_hack.c for something that works with the G400s.

Prerequisites

Ubuntu

sudo apt-get install libhidapi-libusb0

See the security HOWTO for instructions on making the USB devices accessible to this script without needing root.

macOS

Build libhidapi.dylib with this command:

clang -Inative/hidapi native/mac/hid.c -o libhidapi.dylib \
    -arch i386 -arch x86_64 \
    -Os -shared \
    -framework CoreFoundation -framework IOKit

Unlike Linux, macOS apparently requires no security configuration.

Usage

usage: logitech-g400-config.py [show]
  Prints the current mouse settings

usage: logitech-g400-config.py set [options]
  -rRATE
    RATE is in Hz and is one of: 125, 250, 500, or 1000.  The Windows driver
    defaults to 500 Hz.
  -dDPI
    DPI is one of: 400, 800, 1800, 3600, or 3600_frozen.  With 3600_frozen, the
    DPI+/DPI- buttons no longer change the DPI and instead are treated as
    any other ordinary mouse button.

usage: logitech-g400-config.py trace
    Read mouse press/release interrupts from the Logitech-proprietary G400 USB
    interface.  This interface will report DPI+/DPI- presses/releases even with
    ordinary DPI settings.  End the tracing with Ctrl-C.

Linux Security HOWTO

Add a file, /etc/udev/rules.d/10-logitech-g400-config.rules, with contents:

SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c245", MODE:="660", GROUP="plugdev"

Run sudo udevadm control --reload-rules.

Add your user account to the plugdev group (this has no effect if you're already in the group):

$ sudo usermod -a -G plugdev $USER
$ groups
rprichard adm cdrom sudo dip plugdev lpadmin sambashare vboxusers wireshark

Log out and back in to make sure group membership takes effect.

Unplug the mouse and plug it back in. The udev rule only applies when the operating system initializes a device.

logitech-g400-config's People

Contributors

rprichard avatar

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.