Merge pull request #64 from oxij/master

Fix wacom and cherry-pick acpid fix by surr
This commit is contained in:
cillianderoiste 2013-01-05 12:31:42 -08:00
commit 0412d6413e
2 changed files with 44 additions and 14 deletions

View File

@ -8,11 +8,11 @@ let
'' ''
ensureDir $out ensureDir $out
${ ${
# Generate a .conf file for each event. (You can't have # Generate a configuration file for each event. (You can't have
# multiple events in one config file...) # multiple events in one config file...)
let f = event: let f = event:
'' ''
fn=$out/${event.name}.conf fn=$out/${event.name}
echo "event=${event.event}" > $fn echo "event=${event.event}" > $fn
echo "action=${pkgs.writeScript "${event.name}.sh" event.action}" >> $fn echo "action=${pkgs.writeScript "${event.name}.sh" event.action}" >> $fn
''; '';

View File

@ -16,18 +16,41 @@ in
enable = mkOption { enable = mkOption {
default = false; default = false;
description = "Whether to enable the Wacom touchscreen/digitizer."; description = "Whether to enable the Wacom touchscreen/digitizer/tablet.";
}; };
device = mkOption { device = mkOption {
default = "/dev/ttyS0"; default = null;
description = "Device to use."; example = "/dev/ttyS0";
description = "Device to use. Set to null for autodetect (think USB tablet).";
}; };
forceDeviceType = mkOption { forceDeviceType = mkOption {
default = "ISDV4"; default = null;
example = null; example = "ISDV4";
description = "Some models (think touchscreen) require the device type to be specified."; description = "Some models (think touchscreen) require the device type to be specified. Set to null for autodetect (think USB tablet).";
};
stylusExtraConfig = mkOption {
default = "";
example = ''
Option "Button1" "2"
'';
description = "Lines to be added to Wacom_stylus InputDevice section.";
};
eraserExtraConfig = mkOption {
default = "";
example = ''
Option "Button2" "3"
'';
description = "Lines to be added to Wacom_eraser InputDevice section.";
};
cursorExtraConfig = mkOption {
default = "";
example = "";
description = "Lines to be added to Wacom_cursor InputDevice section.";
}; };
}; };
@ -44,8 +67,8 @@ in
services.xserver.serverLayoutSection = services.xserver.serverLayoutSection =
'' ''
InputDevice "Wacom_stylus" InputDevice "Wacom_stylus"
InputDevice "Wacom_cursor"
InputDevice "Wacom_eraser" InputDevice "Wacom_eraser"
InputDevice "Wacom_cursor"
''; '';
services.xserver.config = services.xserver.config =
@ -53,33 +76,40 @@ in
Section "InputDevice" Section "InputDevice"
Driver "wacom" Driver "wacom"
Identifier "Wacom_stylus" Identifier "Wacom_stylus"
Option "Device" "${cfg.device}" ${optionalString (cfg.device != null) ''
Option "Device" "${cfg.device}"
''}
Option "Type" "stylus" Option "Type" "stylus"
${optionalString (cfg.forceDeviceType != null) '' ${optionalString (cfg.forceDeviceType != null) ''
Option "ForceDevice" "${cfg.forceDeviceType}" Option "ForceDevice" "${cfg.forceDeviceType}"
''} ''}
Option "Button2" "3" ${cfg.stylusExtraConfig}
EndSection EndSection
Section "InputDevice" Section "InputDevice"
Driver "wacom" Driver "wacom"
Identifier "Wacom_eraser" Identifier "Wacom_eraser"
Option "Device" "${cfg.device}" ${optionalString (cfg.device != null) ''
Option "Device" "${cfg.device}"
''}
Option "Type" "eraser" Option "Type" "eraser"
${optionalString (cfg.forceDeviceType != null) '' ${optionalString (cfg.forceDeviceType != null) ''
Option "ForceDevice" "${cfg.forceDeviceType}" Option "ForceDevice" "${cfg.forceDeviceType}"
''} ''}
Option "Button1" "2" ${cfg.eraserExtraConfig}
EndSection EndSection
Section "InputDevice" Section "InputDevice"
Driver "wacom" Driver "wacom"
Identifier "Wacom_cursor" Identifier "Wacom_cursor"
Option "Device" "${cfg.device}" ${optionalString (cfg.device != null) ''
Option "Device" "${cfg.device}"
''}
Option "Type" "cursor" Option "Type" "cursor"
${optionalString (cfg.forceDeviceType != null) '' ${optionalString (cfg.forceDeviceType != null) ''
Option "ForceDevice" "${cfg.forceDeviceType}" Option "ForceDevice" "${cfg.forceDeviceType}"
''} ''}
${cfg.cursorExtraConfig}
EndSection EndSection
''; '';