Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trackpoint: Make the device name configurable #44058

Merged

Conversation

borisbabic
Copy link
Contributor

@borisbabic borisbabic commented Jul 24, 2018

Motivation for this change

Allow usage of trackpoint configuration with other devices instead of hardcoding the name.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

'';
})

(mkIf (cfg.emulateWheel) {
services.xserver.inputClassSections =
[''
Identifier "Trackpoint Wheel Emulation"
MatchProduct "${if cfg.fakeButtons then "PS/2 Generic Mouse" else "ETPS/2 Elantech TrackPoint|Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"}"
MatchProduct "${if cfg.fakeButtons then "PS/2 Generic Mouse" else "ETPS/2 Elantech TrackPoint|Elantech PS/2 TrackPoint|${cfg.device}|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this list of device names? And why is only the TPPS/2 IBM TrackPoint in the udev rules above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the commit history, the udev rules existed first and this section was added with the config from thinkwiki. Afterwards people added their devices to the xorg config.

IMHO the list here is not necessary and just configuring the device would be nicer, but I wouldn't want to break existing configurations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm alright, but then I think it would make more sense to append cfg.device to this list instead of replacing the previously fixed entry. Then the old entry will surely always still be there, which makes sense, because it's compatible, even if cfg.device is set differently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think it would matter, if somebody uses that device they wouldn't change the cfg but I'll change it so that I append it, it can't hurt :)

@borisbabic borisbabic force-pushed the feature/choose-trackpoint-device branch from f802230 to c84ed9e Compare August 5, 2018 21:48
@@ -55,6 +55,15 @@ with lib;
'';
};

device = mkOption {
default = "TPPS/2 IBM TrackPoint";
type = types.string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and I almost missed this, types.str is preferred over types.string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry. Fixed.

type = types.string;
description = ''
The device name of the trackpoint. You can check with xinput.
Some newer devices (example x1c6) use "TPPS/2 Elan TrackPoint";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here it should be a "." at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to check that, sorry. Nice catch. Fixed.

@borisbabic borisbabic force-pushed the feature/choose-trackpoint-device branch from c84ed9e to 081cf4b Compare August 5, 2018 22:11
type = types.str;
description = ''
The device name of the trackpoint. You can check with xinput.
Some newer devices (example x1c6) use "TPPS/2 Elan TrackPoint.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm, I meant like ...(example x1c6) use "TPPS/2 Elan TrackPoint". :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️

I fixed it now, I also removed the ;

@borisbabic borisbabic force-pushed the feature/choose-trackpoint-device branch from 081cf4b to 0ef3119 Compare August 6, 2018 00:56
@infinisil infinisil merged commit 66793d9 into NixOS:master Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants