aboutsummaryrefslogtreecommitdiff
path: root/x11-drivers/input-wacom
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2009-01-17 22:55:27 +0000
committerMartin Wilke <miwi@FreeBSD.org>2009-01-17 22:55:27 +0000
commit4a2b408062f0720e46b8ea3ae335ed3df09cb8cc (patch)
tree319660c15acd3e0268701fe554d244711fdaab11 /x11-drivers/input-wacom
parent560ed285d83f8f46d3990c5f70a76d069067f461 (diff)
downloadports-4a2b408062f0720e46b8ea3ae335ed3df09cb8cc.tar.gz
ports-4a2b408062f0720e46b8ea3ae335ed3df09cb8cc.zip
Notes
Diffstat (limited to 'x11-drivers/input-wacom')
-rw-r--r--x11-drivers/input-wacom/Makefile20
-rw-r--r--x11-drivers/input-wacom/files/pkg-message-serial.in12
-rw-r--r--x11-drivers/input-wacom/files/pkg-message-usb.in (renamed from x11-drivers/input-wacom/files/pkg-message.in)0
-rw-r--r--x11-drivers/input-wacom/files/wacom.in99
4 files changed, 96 insertions, 35 deletions
diff --git a/x11-drivers/input-wacom/Makefile b/x11-drivers/input-wacom/Makefile
index 3638f824c686..e935874af872 100644
--- a/x11-drivers/input-wacom/Makefile
+++ b/x11-drivers/input-wacom/Makefile
@@ -30,10 +30,11 @@ MAN4DIR= man/man4
WRKSRC= ${WRKDIR}
PLIST_SUB+= KMODDIR=${KMODDIR} \
- XINPUTMODDIR=${XINPUTMODDIR}
+ XINPUTMODDIR=${XINPUTMODDIR} \
+ PORTTYPE=${PORTTYPE}
SUB_LIST:= ${PLIST_SUB}
-SUB_FILES+= pkg-message
-PKGMESSAGE= ${WRKDIR}/pkg-message
+SUB_FILES+= pkg-message-${PORTTYPE}
+PKGMESSAGE= ${WRKDIR}/pkg-message-${PORTTYPE}
XORG_CAT= driver
USE_XORG= xi
@@ -49,14 +50,16 @@ OPTIONS= UWACOMKLD "Install USB kernel module" On
.if defined(WITH_UWACOMKLD)
PLIST_SUB+= UWACOMKLD="uwacom.ko"
+PORTTYPE= usb
.else
PLIST_SUB+= UWACOMKLD="@noinst UWACOMKLD uwacom.ko"
+PORTTYPE= serial
.endif
do-configure:
@cd ${WRKDIR}/linuxwacom \
&& ${LN} -s ${DISTDIR}/${DIST_SUBDIR}/${LINUXWACOM}.tar.bz2 \
- && ${SETENV} PREFIX=${PREFIX} ./run_configure
+ && ${SETENV} ${MAKE_ENV} ./run_configure
do-build:
.if defined(WITH_UWACOMKLD)
@@ -73,7 +76,7 @@ do-install:
.endif
@${MKDIR} ${PREFIX}/${XINPUTMODDIR} ${PREFIX}/${MAN4DIR}
@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util/ \
- && ${GMAKE} install
+ && ${SETENV} ${MAKE_ENV} ${GMAKE} install
@${INSTALL} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/xdrv/wacom_drv.so \
${PREFIX}/${XINPUTMODDIR}/
@${INSTALL_MAN} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/wacom.4x.gz \
@@ -84,11 +87,12 @@ plist: clean configure
@${TOUCH} ${PLIST}
@${RM} ${PLIST}
@cd ${WRKDIR}/linuxwacom \
- && ${SETENV} PREFIX=${WRKDIR}/plist ./run_configure
+ && ${SETENV} ${MAKE_ENV} PREFIX=${WRKDIR}/plist ./run_configure
@${MKDIR} ${WRKDIR}/plist
- @cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util && ${GMAKE} install
+ @cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util \
+ && ${SETENV} ${MAKE_ENV} ${GMAKE} install
@cd ${WRKDIR}/linuxwacom \
- && ${SETENV} PREFIX=${PREFIX} ./run_configure
+ && ${SETENV} ${MAKE_ENV} ./run_configure
@${FIND} ${WRKDIR}/plist/ -not -type d \
| ${SED} "s|${WRKDIR}/plist/||1" \
>> ${PLIST}
diff --git a/x11-drivers/input-wacom/files/pkg-message-serial.in b/x11-drivers/input-wacom/files/pkg-message-serial.in
new file mode 100644
index 000000000000..f64f53d181ce
--- /dev/null
+++ b/x11-drivers/input-wacom/files/pkg-message-serial.in
@@ -0,0 +1,12 @@
+To setup the wacom driver for X run the following commands as the root user:
+# %%PREFIX%%/etc/rc.d/wacom onesetup
+
+Now open your xorg.conf file and check weather the correct serial device
+was chosen. If you are using a USB to serial converter you might have
+to change it to cuaUX.
+
+You can clean up the Xorg configuration by running the following command
+before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom onecleanup
+
+Now (re)plug in your tablet and restart X.
diff --git a/x11-drivers/input-wacom/files/pkg-message.in b/x11-drivers/input-wacom/files/pkg-message-usb.in
index fdf3c418c99c..fdf3c418c99c 100644
--- a/x11-drivers/input-wacom/files/pkg-message.in
+++ b/x11-drivers/input-wacom/files/pkg-message-usb.in
diff --git a/x11-drivers/input-wacom/files/wacom.in b/x11-drivers/input-wacom/files/wacom.in
index 79c8c4357add..aa320ca85089 100644
--- a/x11-drivers/input-wacom/files/wacom.in
+++ b/x11-drivers/input-wacom/files/wacom.in
@@ -92,6 +92,34 @@ get_first() {
}
#
+# Returns the line numbers of lines matching the extended regular
+# expression $2 in the file $1.
+#
+# @param $1
+# The file to get the line numbers from.
+# @param $2
+# An extend regular expression.
+# @stdout
+# The line numbers of lines matching $2.
+#
+get_all() {
+ local entry result IFS
+ IFS='
+'
+
+ result="$(/usr/bin/grep -Ein "$2" "$1")"
+
+ # No match.
+ if [ -z "$result" ]; then
+ return 1
+ fi
+
+ for entry in $result; {
+ echo "${entry%%:*}"
+ }
+}
+
+#
# Returns the line number of the line before line number $2 that matches the
# extended regular expression $3 in the file $1.
#
@@ -171,44 +199,50 @@ get_behind() {
#
# Inserts a line at the end of a section of an Xorg configuration file.
-# Only works on the first matching section.
+# The insertion is done on all matching sections!
#
section_insert_line() {
- local file section insert begin end length
+ local file section insert sections begin end length
file="$1"
section="$2"
insert="$3"
# Find the beginning of the section.
- begin="$(get_first "$file" \
+ # Start with the last section to avoid moving sections around
+ # before something is inserted into them.
+ sections="$(get_all "$file" \
"^[[:space:]]*Section[[:space:]]+\"$section\"" \
+ | /usr/bin/sort -nr
)"
- if [ -z "$begin" ]; then
+ if [ -z "$sections" ]; then
echo "Identifying section $section has failed." 1>&2
return 1
fi
- # Find the end of the section.
- end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
+ for begin in $sections; {
- if [ -z "$end" ]; then
- echo "The section $section is not closed." 1>&2
- return 2
- fi
+ # Find the end of the section.
+ end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
- # Determine the length of the configuration file.
- length="$(/usr/bin/wc -l "$file")"
- length=${length% *}
+ if [ -z "$end" ]; then
+ echo "The section $section($begin) is not closed." 1>&2
+ return 2
+ fi
+
+ # Determine the length of the configuration file.
+ length="$(/usr/bin/wc -l "$file")"
+ length=${length% *}
- # Insert the line.
- /bin/cp "$file" "$file.$$"
+ # Insert the line.
+ /bin/cp "$file" "$file.$$"
- /usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
- echo "$insert" >> "$file"
- /usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
+ /usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
+ echo "$insert" >> "$file"
+ /usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
- /bin/rm "$file.$$"
+ /bin/rm "$file.$$"
+ }
}
#
@@ -225,7 +259,7 @@ do_setup() {
echo "Setting up configuration in $config."
# Add all the necessary sections.
- for ident in stylus eraser cursor pad touch; {
+ for ident in $(eval "echo \${${name}_types}"); {
if /usr/bin/grep -Eqi "^[[:space:]]*Identifier[[:space:]]+\"$ident\"" "$config"; then
echo "Skipping $ident, because it already exists in $config."
continue
@@ -236,10 +270,17 @@ do_setup() {
echo "Section \"InputDevice\"
Driver \"wacom\"
Identifier \"$ident\"
- Option \"Device\" \"/dev/event0\"
- Option \"Type\" \"$ident\"
- Option \"USB\" \"on\"
-EndSection
+ Option \"Type\" \"$ident\"" >> "$config"
+
+ if [ "$(eval "echo \${${name}_porttype}")" = "usb" ]; then
+ echo " Option \"Device\" \"/dev/event0\"
+ Option \"USB\" \"on\"" >> "$config"
+ else
+ echo " Option \"Device\" \"/dev/ttyd0\"
+ Option \"ForceDevice\" \"ISDV4\"" >> "$config"
+ fi
+
+ echo "EndSection
" >> "$config"
section_insert_line "$config" "ServerLayout" " InputDevice \"$ident\" \"SendCoreEvents\""
@@ -318,13 +359,14 @@ do_cleanup() {
echo "Cleaning up ServerLayout section."
- for ident in stylus eraser cursor pad touch; {
+ for ident in $(eval "echo \${${name}_types}"); {
+ while true; do
driver="$(get_first "$config" \
"[[:space:]]*InputDevice[[:space:]]+\"$ident\"" \
)"
# There is no line matching this driver.
- test -z "$driver" && continue
+ test -z "$driver" && break
# Determine the length of the configuration file.
length="$(/usr/bin/wc -l "$config")"
@@ -337,6 +379,7 @@ do_cleanup() {
/usr/bin/tail -n$(($length - $driver)) "$config.$$" >> "$config"
/bin/rm "$config.$$"
+ done
}
}
@@ -360,6 +403,8 @@ do_stop() {
load_rc_config $name
-: ${wacom_enable="NO"}
+eval ": \${${name}_enable=\"NO\"}"
+eval ": \${${name}_types=\"stylus eraser cursor pad touch\"}"
+eval ": \${${name}_porttype=\"%%PORTTYPE%%\"}"
run_rc_command "$1"