Skip to content
/ msigd Public
forked from couriersud/msigd

MSI Gaming Device control application

License

Notifications You must be signed in to change notification settings

RodoMa92/msigd

 
 

Repository files navigation

1. msigd

The msigd command line tool allows you to change most settings for MSI monitors which can be set in the monitor's OSD menu.

Warning: Use msigd only if you are sure what you are doing. The monitor firmware seems to have no protection against unsupported accesses.

Using msigd may make your monitor permantently unusable.

Please make sure you use at least msigd version 0.17

With version 0.12 the syntax of the "--mystic" option has changed. For the MPG273CQR two led groups (0 and 1) are supported. For all other mystic light monitors only group 1 is supported.

1. Build status:

OS Compiler Status
Linux g++
Windows MinGW++
OSX clang++

2. Supported monitors

All monitors for which the OSD Gaming Device App is available most likely should be supported. There are differences between those monitors which msigd currently does not know about.

If you own an MSI monitor supported by the MSI App, please provide the following information by opening an issue.

  • The id of your monitor, e.g. MAG321CURV
  • The output of msigd --debug --info --query
  • For linux the output of lsusb
  • Your operating system and version
  • any other information which might be helpful, e.g. OSD setting xyz is not supported.

2.1. MSI Monitors

ID Firmware Supported Version Special Panel Manual
MPG27CQ ? Yes "V18" "001" ?
MAG241C ? Yes "V18" "002" ? Manual
MAG241C ? Yes "V49" "002" ?
MAG241CP ? Yes "V18" "002" ? Manual
MAG241CV ? Yes "V18" "002" ? Manual
MAG241CR ? Yes "V18" "004" ? Manual
MAG271CR ? Yes "V18" "005" ? Manual
MAG271CQR ? Yes "V19" "006" TPM270WQ1_DP01
MAG321CQR ? Yes "V18" "00:" ?
MAG321CURV FW.009 Yes "V18" "00;" SAM_LSM315FP01 Manual
MAG321CURV FW.011 Yes "V43" "00;" ? Manual
MPG341CQR ? WIP "V09" "00>" ? Manual
PS341WU FW.024 Yes "V06" "00?" ?
MPG273CQR FW.022 Yes "V51" "00[" ? Manual
MAG251RX ? WIP "V18" "00B" ? Manual
MAG272CQR ? Yes "V18" "00E" ? Manual
MAG272CQR ? Yes "V41" "00E" ? Manual
MAG272QR ? Partial 1) "V18" "00G" ? Manual
MAG272 ? Yes "V18" "00L" ? Manual
MAG272QP ? Yes "V18" "00O" ? Manual
MAG274R ? Yes "V41" "00Z" ? Manual
MAG274QRF-QD FW.011 Yes "V43" "00e" AUO_M270DAN08_2
MAG274QRF-QD FW.015 Yes "V48" "00e" AUO_M270DAN08_2
MAG274QRF-QD FW.020 Yes "V56" "00e" AUO_M270DAN08_2 Manual
MAG274QRX ? Partial 2) "V53" "00|" ? Manual
MAG270CR ? ? ? ? ?
MAG271C ? ? "V18" "002" ? Manual
MAG271CP ? ? "V18" "002" ? Manual
MAG271CQP ? ? "V19" "006" ?
MAG271CV ? ? "V18" "002" ? Manual
MAG271QR ? ? ? ? ?
MAG271R ? ? ? ? ?
MAG271V ? ? ? ? ?
MAG272C ? ? "V18" "00O" ?
MAG272CR ? ? "V18" "00O" ?
MAG272CRX ? ? "V18" "00O" ?
MAG272R ? ? "V18" "00O" ?
MAG322CQR ? ? ? ? ?
MAG322CQRV ? ? ? ? ?
MAG322CR ? ? ? ? ?
MPG341CQRV ? ? ? ? ?
MD272QP ? Partial 3) "V51" "00\x85" ? Manual
  1. Mystic support is not working. Has 12 lights - Steel series interface?
  2. Currently only query possible until feedback is given on issue #43
  3. Audio Volume and Navi-Key not working

2.2. Service menu

The panel information and more is displayed by the service menu.

  • Hold the joystick button down
  • Unplug your monitor power supply - keep holding down
  • Plug in your monitor supply - keep holding down
  • When msi logo appears - stop holding down
  • When monitor displays screen - push joystick button down to show OSD
  • Push joystick button down again
  • Service menu opens

The service menu also has more information about the preset color temperature modes.

2.3. USB manufacturer and product id

ID 1462:3fa4 Micro Star International

3. Compile

3.1. Linux

Make sure you have libusb installed. On debian based systems

sudo apt install libusb-dev libhidapi-dev

On Fedora use

dnf install libusb-devel hidapi-devel

Compile with

make

For Arch-Linux the name of the usb library differs (usb-1.0). Please use

sudo pacman -S libusb hidapi
make TARGETOS=arch

to install dependencies and compile.

3.2. WSL

Warning: you need Windows Subsystem for Linux 2 with a kernel version of at least 5.10.60.1

Make sure you have libusb installed. On debian based systems

sudo apt install libusb-dev libhidapi-dev

Compile with libusb

make USE_HIDAPI=0

On Windows, install usbipd-win as described here.

You need to attach two usb devices to WSL. You can either find them in Device Manager or by checking usbpid wsl list before and after pluggin in the monitor.

Drawback: Attached usb devices are not saved and need to be reattached every time the monitor is turned on.

Perform the steps of 4.1. Linux.

3.3. Windows

To compile on windows you need a working mingw environment.

Make sure you have libusb installed:

pacman -S mingw-w64-x86_64-libusb-compat-git
pacman -S mingw-w64-x86_64-hidapi

Compile

make  TARGETOS=windows

3.4. OSX

Make sure you have homebrew installed.

brew install libusb-compat
brew install hidapi

Compile

make TARGETOS=osx

4. Security

4.1. Linux

This program needs root privilidges. Use with care.

Alternatively you may use udev to grant user access rights. More information is available on here: Documentation on askubuntu

In a nutshell:

  • Ensure that your system has a group plugdev and that the current user is a member of the plugdev group.

  • Create /etc/udev/rules.d/51-msi-gaming-device.rules:

# Allow access to members of plugdev - both for usb and hidraw access
SUBSYSTEM=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="3fa4", GROUP="plugdev", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="1462", ATTRS{idProduct}=="3fa4", GROUP="plugdev", TAG+="uaccess"
  • Execute
sudo udevadm control --reload-rules
  • Turn your monitor off and on.

4.2. Windows

On Windows 7 msigd does need no additional user rights. It however conflicts with OSD Gaming device software.

You have two alternatives:

  1. Completely remove the MSI Gaming Device software to run the application.

  2. Use Task Manager and stop MonitorMicroKeyDetector.exe

4.3. OSX

On OSX no elevated user rights are needed.

4.4. Building with libusb

You can also use make USE_HIDAPI=0 to build with libusb instead of the default libhidapi. This introduces issues on Windows and OSX builds and therefore is not recommended.

  • For Windows administrator rights are needed.

  • On OSX the usb interface will be claimed by the OSX HID driver. Basically this prevents msigd to claim the usb interface. There is no easy way around this. More information can be found here: libusb FAQ. A solution is described on stackoverflow. This includes turning of security settings and thus I am not going to pursue this further here.

5. Usage

msigd --help

man msigd

6. Settings not supported

6.1. MAG241 series

6.1.1. Screen size

Although documented in the manual setting the screen size (4:3, 16:9) is not supported. The setting will kill the usb interface and the monitor needs a plug/unplug power cable cycle.

6.2. PS341 series

6.2.1. Quick charge

Changing the quick charge setting is not supported. We were not able to identify how to enable or disable quick charge programmatically. The status however can be queried.

6.2.2. Eye saver

--eye_saver works with the modes user, hdr, cinema, reader and bw. In mode eyecare it is always reported as on while in modes adobe_rgb, dci_p3, srgb and dicom it is always off.

7. Examples

7.1. Automatically switch input source

I have a usb swiched port. Upon pressing a button on the switch, keyboard and mouse (or up to four devices) are switched between two computers: my desktop and my laptop. There is a USB-C docking station connected to the switch. The laptop is connected via USB-C. The docking station is connected to the USB-C hub and via HDMI to input hdmi1 to the monitor.

The following script runs on the desktop. If the keyboard gets disconnect - switched to laptop, it will switch monitor input to hdmi1. Once the keyboard reconnects, it will switch back monitor input to dp.

The inotifywait tool needed by this script is available on debian systems. Use sudo apt install inotify-tools to install it.

#!/bin/sh

WATCH_DIR=/dev/input/by-id
WATCH_INPUT=usb-046a_010d-event-kbd
DISP_INPUT=dp
DISP_ALTERNATIVE=hdmi1

inotifywait -q -m ${WATCH_DIR} | while read event
	do
		f=`echo $event | cut -f 3 "-d "`
		if [ _$f = _${WATCH_INPUT} ]; then
			ev=`echo $event | cut -f 2 "-d "`
			test _$ev = _DELETE && ./msigd --input $DISP_ALTERNATIVE
			test _$ev = _CREATE && ./msigd --input $DISP_INPUT
		fi
	done

7.2. Change settings depending on foreground window

The script below is an example on how to change display settings automatically depending on the active application. When watching movies, you may want to use image enhancement while when using the terminal you may prefer a reduced brightness.

This script is an example what you can do using msigd:

#!/bin/sh

DISP_DEFAULT='--brightness 80 --eye_saver off --image_enhancement off'
MSIGD=./msigd

if [ ! -x "$(command -v xdotool)" ]; then
	echo Error: xdotool required >&2
	exit 1
fi

setting=""
while true; do
	# Get foreground window commandline
	vwin=`xdotool getwindowfocus`
	vpid=`xdotool getwindowpid $vwin 2>/dev/null`
	if [ "$vpid" != "" ]; then
		cl=`cat /proc/${vpid}/cmdline | sed -e "s/\\x0/ /g"`
	else
		cl=`xdotool getwindowname $vwin`
	fi
	case "$cl" in
		*gnome-terminal-server*)
			nsetting='--brightness 30'
			;;
		*eclipse*)
			nsetting='--eye_saver on'
			;;
		*xine*)
			nsetting='--image_enhancement strong'
			;;
		*)
			nsetting=''
			;;
	esac 
	if [ "$nsetting" != "$setting" ]; then
		$MSIGD $DISP_DEFAULT $nsetting
		setting="$nsetting"
	fi
	sleep 1
done

7.3. Using msigd in a libvirt-qemu hook

mike-vivas contributed an example of using msigd within a libvirt-qemu hook to automatically switch the monitor to virtual guests booting up.

8. TODO

  • Code cleanup
  • Support more monitors - depends on user contributions
  • Document --mystic option better
  • Match options of WIP monitors against manuals.
  • Provide link to monitor manual in table.

9. Credits

John Wehin - PS341WU support and bug fixing

Daniel Connolly - MAG271CQR support

Maxime - MAG241C support

mike-vivas - Arch linux support, contrib

gbirchley - MAG272 support

Térence Clastres - MPG27CQ support and steel series LED support

elric1789 - MAG272QP support

andaag - MAG272CQR support

usrErr0r - MAG272QR support

glaon - MPG341CQR support

Marco Rodolfi - MAG274QRF-QD support

Preston - Multi-Monitor support

Michael J Brancato - Multi-Monitor support

Dominik Helfenstein - WSL compile instructions

Stephen Lee -- MAG321QR support

Thorou - MAG271CR support

Skyyblaze - MAG241CR support

Deathof1 - MAG321CQR support

Maxime - MAG241C support

Sahil Gupte - MAG241C V49 support

Pontus Jensen Karlsson - MAG274R support

kunver400 - MAG274QRX support

About

MSI Gaming Device control application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.5%
  • Makefile 2.9%
  • Shell 2.6%