inputcontrol: Move hid-magicmouse parameters to modprobe.d

This will work on both X11 & freon builds. It fixes duplicate REL_WHEEL
events causing extremely fast scrolling on freon.

BUG=chromium:473831
TEST=Two-finger scrolling with Apple magic mouse is usable.

Change-Id: I365084f426f78852348c8f99db749304dd337296
Reviewed-on: https://chromium-review.googlesource.com/265530
Trybot-Ready: Michael Spang <spang@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
diff --git a/Makefile b/Makefile
index 187a4ee..cf10d16 100755
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,8 @@
 
 UDEV_RULE=99-inputcontrol.rules
 
+MODPROBE_CONF=modprobe.d/inputcontrol.conf
+
 INIT_DIR=/etc/init
 
 UPSTART_CONF=\
@@ -70,5 +72,7 @@
 	mkdir -p $(DESTDIR)/$(SCRIPTS_DIR)
 	cp -p $(SCRIPTS) $(DESTDIR)/$(SCRIPTS_DIR)
 	chmod 0755 $(DESTDIR)/$(SCRIPTS_DIR)/*
+	install -D -m 0644 $(MODPROBE_CONF) \
+		$(DESTDIR)/etc/$(MODPROBE_CONF)
 	install -D -m 0644 $(UDEV_RULE) \
 		$(DESTDIR)/lib/udev/rules.d/$(UDEV_RULE)
diff --git a/inputcontrol b/inputcontrol
index 34b7b29..0186340 100755
--- a/inputcontrol
+++ b/inputcontrol
@@ -134,13 +134,6 @@
   device_set_prop $device "Device Accel Profile" -1
   device_set_prop $device "Device Accel Constant Deceleration" 1
   device_set_prop $device "Device Accel Velocity Scaling" 1
-
-  # Kernel's Apple magicmouse driver by default will interpret mouse events, and
-  # we would like to turn off this interpretation.
-  if [ "$(device_get_vendor_product $device)" = "05ac:030d" ]; then
-    echo 0 > /sys/module/hid_magicmouse/parameters/emulate_3button
-    echo 0 > /sys/module/hid_magicmouse/parameters/emulate_scroll_wheel
-  fi
 }
 
 # Detup device preferences and properties
diff --git a/modprobe.d/inputcontrol.conf b/modprobe.d/inputcontrol.conf
new file mode 100644
index 0000000..485bb02
--- /dev/null
+++ b/modprobe.d/inputcontrol.conf
@@ -0,0 +1 @@
+options hid_magicmouse emulate_3button=N emulate_scroll_wheel=N