forked from rohitpid/Linux-Magic-Trackpad-2-Driver
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update driver loading script. It now uses better file locking.
- Loading branch information
1 parent
a81d708
commit b6d4df0
Showing
1 changed file
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
#!/bin/sh | ||
|
||
FILE=/tmp/magicmouse-driveload | ||
FILE=/tmp/magicmouse.lock | ||
|
||
reload() { | ||
if [ ! -f "$FILE" ]; then | ||
touch $FILE | ||
|
||
modprobe -r hid_magicmouse | ||
sleep 2 | ||
modprobe -a hid-generic hid_magicmouse | ||
|
||
sleep 2 | ||
rm -f "$FILE" | ||
|
||
# Check is Lock File exists, if not create it and set trap on exit | ||
if { set -C; 2>/dev/null >$FILE; }; then | ||
trap "rm -f $FILE" EXIT | ||
else | ||
# Lock file exists. exiting. | ||
exit | ||
fi | ||
|
||
modprobe -r hid_magicmouse | ||
sleep 2 | ||
modprobe -a hid-generic hid_magicmouse | ||
sleep 2 | ||
} | ||
|
||
reload & |