Add an X.Org driver, a kernel module, and a script to configure X.Org
for Wacom tablets. The X.Org driver is a port of the Linux Wacom Project's [1] work. The kernel module required for USB tablets is provided by Bartosz Fabianowski [2], and supports the following devices: Graphire*, Graphire2*, Graphire3, Graphire4 Bamboo, Bamboo One*, Bamboo Fun Intuos3, Cintiq 21UX Volito*, Volito2* PenStation2*, PenPartner2* * not tested PR: ports/128547 Submitted by: Dominic Fandrey [3] Reviewed by: gabor Approved by: gabor [1] http://linuxwacom.sourceforge.net [2] <freebsd (at) chillt (dot) de> [3] <kamikaze (at) bsdforen (dot) de>
This commit is contained in:
parent
6d4ed3627c
commit
6986be9d27
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=222966
7 changed files with 522 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
SUBDIR += xf86-input-tek4957
|
||||
SUBDIR += xf86-input-vmmouse
|
||||
SUBDIR += xf86-input-void
|
||||
SUBDIR += xf86-input-wacom
|
||||
SUBDIR += xf86-video-apm
|
||||
SUBDIR += xf86-video-ark
|
||||
SUBDIR += xf86-video-ati
|
||||
|
|
105
x11-drivers/xf86-input-wacom/Makefile
Normal file
105
x11-drivers/xf86-input-wacom/Makefile
Normal file
|
@ -0,0 +1,105 @@
|
|||
# New ports collection makefile for: xf86-input-wacom
|
||||
# Date Created: 24 Oct 2008
|
||||
# Whom: Dominic Fandrey <kamikaze@bsdforen.de>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= xf86-input-wacom
|
||||
PORTVERSION= ${WACOM_VERSION:C/-/./g}.${KLD_VERSION}
|
||||
CATEGORIES= x11-drivers kld
|
||||
MASTER_SITES= http://www.chillt.de/bsdwacom/ \
|
||||
${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= linuxwacom
|
||||
DISTFILES= ${BSDWACOM}.tbz \
|
||||
${LINUXWACOM}.tar.bz2
|
||||
EXTRACT_ONLY= ${BSDWACOM}.tbz
|
||||
|
||||
MAINTAINER= kamikaze@bsdforen.de
|
||||
COMMENT= X.Org Wacom tablet driver and kernel module
|
||||
|
||||
MAN4= wacom.4x
|
||||
MANCOMPRESSED= yes
|
||||
|
||||
USE_GMAKE= yes
|
||||
USE_RC_SUBR= wacom
|
||||
|
||||
KMODDIR?= /boot/modules
|
||||
XINPUTMODDIR= lib/xorg/modules/input
|
||||
MAN4DIR= man/man4
|
||||
WRKSRC= ${WRKDIR}
|
||||
|
||||
PLIST_SUB+= KMODDIR=${KMODDIR} \
|
||||
XINPUTMODDIR=${XINPUTMODDIR}
|
||||
SUB_LIST:= ${PLIST_SUB}
|
||||
SUB_FILES+= pkg-message
|
||||
PKGMESSAGE= ${WRKDIR}/pkg-message
|
||||
|
||||
XORG_CAT= driver
|
||||
|
||||
LINUXWACOM= linuxwacom-${WACOM_VERSION}
|
||||
BSDWACOM= bsdwacom-${KLD_VERSION}
|
||||
WACOM_VERSION= 0.8.1-3
|
||||
KLD_VERSION= 38
|
||||
|
||||
OPTIONS= UWACOMKLD "Install USB kernel module" On
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if defined(WITH_UWACOMKLD)
|
||||
PLIST_SUB+= UWACOMKLD="uwacom.ko"
|
||||
.else
|
||||
PLIST_SUB+= UWACOMKLD="@noinst UWACOMKLD uwacom.ko"
|
||||
.endif
|
||||
|
||||
do-configure:
|
||||
@cd ${WRKDIR}/linuxwacom \
|
||||
&& ${LN} -s ${DISTDIR}/${DIST_SUBDIR}/${LINUXWACOM}.tar.bz2 \
|
||||
&& ./run_configure
|
||||
|
||||
do-build:
|
||||
.if defined(WITH_UWACOMKLD)
|
||||
@cd ${WRKDIR}/uwacom \
|
||||
&& ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS}
|
||||
.endif
|
||||
@cd ${WRKDIR}/linuxwacom/${LINUXWACOM} \
|
||||
&& ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_ARGS}
|
||||
|
||||
do-install:
|
||||
.if defined(WITH_UWACOMKLD)
|
||||
@${MKDIR} ${KMODDIR}
|
||||
@${INSTALL_KLD} ${WRKDIR}/uwacom/uwacom.ko ${KMODDIR}/
|
||||
.endif
|
||||
@${MKDIR} ${PREFIX}/${XINPUTMODDIR} ${PREFIX}/${MAN4DIR}
|
||||
@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util/ \
|
||||
&& ${GMAKE} install
|
||||
@${INSTALL} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/xdrv/wacom_drv.so \
|
||||
${PREFIX}/${XINPUTMODDIR}/
|
||||
@${INSTALL_MAN} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/wacom.4x.gz \
|
||||
${PREFIX}/${MAN4DIR}/
|
||||
|
||||
plist: clean configure
|
||||
@${ECHO} "===> Rebuilding PLIST."
|
||||
@${TOUCH} ${PLIST}
|
||||
@${RM} ${PLIST}
|
||||
@cd ${WRKDIR}/linuxwacom/${LINUXWACOM} \
|
||||
&& ./configure --prefix=${WRKDIR}/plist
|
||||
@${MKDIR} ${WRKDIR}/plist
|
||||
@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util && ${GMAKE} install
|
||||
@cd ${WRKDIR}/linuxwacom \
|
||||
&& ./run_configure
|
||||
@${FIND} ${WRKDIR}/plist/ -not -type d \
|
||||
| ${SED} "s|${WRKDIR}/plist/||1" \
|
||||
>> ${PLIST}
|
||||
@${FIND} -d ${WRKDIR}/plist/ -mindepth 2 -type d \
|
||||
| ${SED} "s|${WRKDIR}/plist/|@dirrm |1" \
|
||||
>> ${PLIST}
|
||||
@${ECHO} "%%XINPUTMODDIR%%/wacom_drv.so" >> ${PLIST}
|
||||
@${ECHO} "@cwd %%KMODDIR%%" >> ${PLIST}
|
||||
@${ECHO} "%%UWACOMKLD%%" >> ${PLIST}
|
||||
|
||||
post-install:
|
||||
@${ECHO} "===> Displaying pkg-message."
|
||||
@${CAT} ${PKGMESSAGE}
|
||||
|
||||
.include <bsd.port.post.mk>
|
6
x11-drivers/xf86-input-wacom/distinfo
Normal file
6
x11-drivers/xf86-input-wacom/distinfo
Normal file
|
@ -0,0 +1,6 @@
|
|||
MD5 (xorg/driver/bsdwacom-38.tbz) = fae10723e12b5bfc5daea411639f0ed4
|
||||
SHA256 (xorg/driver/bsdwacom-38.tbz) = 0d9027b5d781cd520ebe41287b388973465e8d62109c5d3f52d68f12ede03507
|
||||
SIZE (xorg/driver/bsdwacom-38.tbz) = 19993
|
||||
MD5 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = d09b212946e321cc503adf84e243ca99
|
||||
SHA256 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = cf1ac159d87666d16e2e3bfad81ede93e088b3bf64bb6d2d469adceb2a4c9dee
|
||||
SIZE (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = 1209228
|
16
x11-drivers/xf86-input-wacom/files/pkg-message.in
Normal file
16
x11-drivers/xf86-input-wacom/files/pkg-message.in
Normal file
|
@ -0,0 +1,16 @@
|
|||
To setup the wacom driver for X and start the kernel module upon boot
|
||||
run the following commands as the root user:
|
||||
|
||||
# echo 'wacom_enable="YES"' >> /etc/rc.conf
|
||||
# %%PREFIX%%/etc/rc.d/wacom setup
|
||||
|
||||
You can unload the driver and clean up the Xorg configuration by
|
||||
running the following lines before deinstalling:
|
||||
# %%PREFIX%%/etc/rc.d/wacom cleanup
|
||||
# %%PREFIX%%/etc/rc.d/wacom stop
|
||||
|
||||
To activate the driver without rebooting run:
|
||||
|
||||
# %%PREFIX%%/etc/rc.d/wacom start
|
||||
|
||||
Now (re)plug in your tablet and restart X.
|
365
x11-drivers/xf86-input-wacom/files/wacom.in
Normal file
365
x11-drivers/xf86-input-wacom/files/wacom.in
Normal file
|
@ -0,0 +1,365 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PROVIDE: wacom
|
||||
# REQUIRE: FILESYSTEMS
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
||||
# to enable this service:
|
||||
#
|
||||
# wacom_enable (bool): Set to NO by default.
|
||||
# Set it to YES to enable wacom.
|
||||
#
|
||||
# This script additionally offers setup and cleanup to configure Xorg
|
||||
# for use of the driver or remove the configuration settings.
|
||||
# The input devices are only added to the first ServerLayout section
|
||||
# and also only removed once.
|
||||
#
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="wacom"
|
||||
rcvar=${name}_enable
|
||||
|
||||
extra_commands="setup cleanup"
|
||||
setup_cmd=do_setup
|
||||
start_cmd=do_start
|
||||
stop_cmd=do_stop
|
||||
cleanup_cmd=do_cleanup
|
||||
|
||||
#
|
||||
# Outputs the location of the Xorg configuration file.
|
||||
# Returns 1 if no file could be found.
|
||||
#
|
||||
get_xorg_conf() {
|
||||
local config_locations config
|
||||
|
||||
# Possible Xorg configuration file locations, taken from the
|
||||
# xorg.conf(5) manual page.
|
||||
config_locations="
|
||||
/etc/X11/$XORGCONFIG
|
||||
%%PREFIX%%/etc/X11/$XORGCONFIG
|
||||
/etc/X11/xorg.conf-4
|
||||
/etc/X11/xorg.conf
|
||||
/etc/xorg.conf
|
||||
%%PREFIX%%/etc/X11/xorg.conf.$HOST
|
||||
%%PREFIX%%/etc/X11/xorg.conf-4
|
||||
%%PREFIX%%/etc/X11/xorg.conf
|
||||
%%PREFIX%%/lib/X11/xorg.conf.$HOST
|
||||
%%PREFIX%%/lib/X11/xorg.conf-4
|
||||
%%PREFIX%%/lib/X11/xorg.conf
|
||||
NONE
|
||||
"
|
||||
|
||||
# Find the first matching config file.
|
||||
for config in $config_locations; {
|
||||
test -f "$config" && break
|
||||
}
|
||||
|
||||
if [ "$config" = "NONE" ]; then
|
||||
echo "No Xorg configuration has been found." 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$config"
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Returns the line number of the first line matching the extended regular
|
||||
# expression $2 in the file $1.
|
||||
#
|
||||
# @param $1
|
||||
# The file to get the line number from.
|
||||
# @param $2
|
||||
# An extend regular expression.
|
||||
# @stdout
|
||||
# The line number of the first line matching $2.
|
||||
#
|
||||
get_first() {
|
||||
local result IFS
|
||||
IFS='
|
||||
'
|
||||
result="$(/usr/bin/grep -Ein "$2" "$1")"
|
||||
result="${result%%:*}"
|
||||
|
||||
# No match.
|
||||
if [ -z "$result" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$result"
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Returns the line number of the line before line number $2 that matches the
|
||||
# extended regular expression $3 in the file $1.
|
||||
#
|
||||
# @param $1
|
||||
# The file to get the line number from.
|
||||
# @param $2
|
||||
# The line before which the expression should match.
|
||||
# @param $3
|
||||
# An extend regular expression.
|
||||
# @stdout
|
||||
# The line number of the first line before line $2 matching $3.
|
||||
#
|
||||
get_before() {
|
||||
local result IFS line length
|
||||
IFS='
|
||||
'
|
||||
|
||||
# The length is necessary to make sure the check is run once
|
||||
# again for the last match.
|
||||
length="$(/usr/bin/wc -l "$1")"
|
||||
length=${length% *}
|
||||
|
||||
result=-1
|
||||
for line in $(/usr/bin/grep -Ein "$3" "$1") $(($length + 1)); {
|
||||
line="${line%%:*}"
|
||||
|
||||
# We have passed the line to look for.
|
||||
if [ $line -ge $2 ]; then
|
||||
|
||||
# No match before this line.
|
||||
if [ $result -lt 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$result"
|
||||
return 0
|
||||
fi
|
||||
|
||||
result=$line
|
||||
}
|
||||
|
||||
# No result.
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# Returns the line number of the line behind line number $2 that matches the
|
||||
# extended regular expression $3 in the file $1.
|
||||
#
|
||||
# @param $1
|
||||
# The file to get the line number from.
|
||||
# @param $2
|
||||
# The line behind which the expression should match.
|
||||
# @param $3
|
||||
# An extend regular expression.
|
||||
# @stdout
|
||||
# The line number of the first line behind line $2 matching $3.
|
||||
#
|
||||
get_behind() {
|
||||
local IFS line
|
||||
IFS='
|
||||
'
|
||||
|
||||
for line in $(/usr/bin/grep -Ein "$3" "$1"); {
|
||||
line="${line%%:*}"
|
||||
|
||||
# We have passed the line to look for.
|
||||
if [ $line -gt $2 ]; then
|
||||
echo "$line"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# No result.
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# Inserts a line at the end of a section of an Xorg configuration file.
|
||||
# Only works on the first matching section.
|
||||
#
|
||||
section_insert_line() {
|
||||
local file section insert begin end length
|
||||
file="$1"
|
||||
section="$2"
|
||||
insert="$3"
|
||||
|
||||
# Find the beginning of the section.
|
||||
begin="$(get_first "$file" \
|
||||
"^[[:space:]]*Section[[:space:]]+\"$section\"" \
|
||||
)"
|
||||
|
||||
if [ -z "$begin" ]; 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")"
|
||||
|
||||
if [ -z "$end" ]; then
|
||||
echo "The section $section 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.$$"
|
||||
|
||||
/usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
|
||||
echo "$insert" >> "$file"
|
||||
/usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
|
||||
|
||||
/bin/rm "$file.$$"
|
||||
}
|
||||
|
||||
#
|
||||
# Adds the necessary lines to the Xorg configuration.
|
||||
#
|
||||
do_setup() {
|
||||
local config ident status
|
||||
|
||||
# Get the Xorg configuration file.
|
||||
config="$(get_xorg_conf)"
|
||||
status=$?
|
||||
test $status -ne 0 && return $status
|
||||
|
||||
echo "Setting up configuration in $config."
|
||||
|
||||
# Add all the necessary sections.
|
||||
for ident in stylus eraser cursor pad touch; {
|
||||
if /usr/bin/grep -Eqi "^[[:space:]]*Identifier[[:space:]]+\"$ident\"" "$config"; then
|
||||
echo "Skipping $ident, because it already exists in $config."
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "Inserting $ident."
|
||||
|
||||
echo "Section \"InputDevice\"
|
||||
Driver \"wacom\"
|
||||
Identifier \"$ident\"
|
||||
Option \"Device\" \"/dev/event0\"
|
||||
Option \"Type\" \"$ident\"
|
||||
Option \"USB\" \"on\"
|
||||
EndSection
|
||||
" >> "$config"
|
||||
|
||||
section_insert_line "$config" "ServerLayout" " InputDevice \"$ident\" \"SendCoreEvents\""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Removes all wacom stuff from the Xorg configuration file. Beware,
|
||||
# this also affects handwritten content.
|
||||
#
|
||||
do_cleanup() {
|
||||
local config status driver i begin last_begin end length ident IFS
|
||||
|
||||
# Get the Xorg configuration file.
|
||||
config="$(get_xorg_conf)"
|
||||
status=$?
|
||||
test $status -ne 0 && return $status
|
||||
|
||||
echo "Removing wacom entries from $config."
|
||||
|
||||
IFS='
|
||||
'
|
||||
while true; do
|
||||
# Find a wacom section.
|
||||
driver="$(get_first "$config" \
|
||||
"^[[:space:]]*Driver[[:space:]]+\"wacom\"" \
|
||||
)"
|
||||
|
||||
# Not a numeric, no more wacom sections left.
|
||||
test -z "$driver" && break
|
||||
|
||||
# Find the beginning of the section.
|
||||
begin="$(get_before "$config" "$driver" \
|
||||
"^[[:space:]]*Section[[:space:]]+\"InputDevice\"" \
|
||||
)"
|
||||
|
||||
if [ -z "$begin" ]; then
|
||||
echo "Beginning of wacom driver section" \
|
||||
"could not be found!" 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Find the end of the section.
|
||||
end="$(get_behind "$config" "$driver" \
|
||||
"^[[:space:]]*EndSection" \
|
||||
)"
|
||||
|
||||
if [ -z "$end" ]; then
|
||||
echo "The Wacom driver section is" \
|
||||
"not closed properly." 1>&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Determine the length of the configuration file.
|
||||
length="$(/usr/bin/wc -l "$config")"
|
||||
length=${length% *}
|
||||
|
||||
# Adjust the end by trailing newlines.
|
||||
while [ $end -lt $length -a \
|
||||
-z "$(/usr/bin/tail -n$(($length - $end)) "$config" \
|
||||
| /usr/bin/head -n1)" ]; do
|
||||
end=$(($end + 1))
|
||||
done
|
||||
|
||||
# Remove the section.
|
||||
/bin/cp "$config" "$config.$$"
|
||||
|
||||
/usr/bin/head -n$(($begin - 1)) "$config.$$" > "$config"
|
||||
/usr/bin/tail -n$(($length - $end)) "$config.$$" >> "$config"
|
||||
|
||||
/bin/rm "$config.$$"
|
||||
done
|
||||
IFS='
|
||||
'
|
||||
|
||||
echo "Cleaning up ServerLayout section."
|
||||
|
||||
for ident in stylus eraser cursor pad touch; {
|
||||
driver="$(get_first "$config" \
|
||||
"[[:space:]]*InputDevice[[:space:]]+\"$ident\"" \
|
||||
)"
|
||||
|
||||
# There is no line matching this driver.
|
||||
test -z "$driver" && continue
|
||||
|
||||
# Determine the length of the configuration file.
|
||||
length="$(/usr/bin/wc -l "$config")"
|
||||
length=${length% *}
|
||||
|
||||
# Remove the section.
|
||||
/bin/cp "$config" "$config.$$"
|
||||
|
||||
/usr/bin/head -n$(($driver - 1)) "$config.$$" > "$config"
|
||||
/usr/bin/tail -n$(($length - $driver)) "$config.$$" >> "$config"
|
||||
|
||||
/bin/rm "$config.$$"
|
||||
}
|
||||
}
|
||||
|
||||
do_start() {
|
||||
if /sbin/kldstat | /usr/bin/grep -q uwacom; then
|
||||
echo "${name} is already running."
|
||||
return 0
|
||||
fi
|
||||
echo "Starting ${name}."
|
||||
/sbin/kldload %%KMODDIR%%/uwacom.ko
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
if ! /sbin/kldstat | /usr/bin/grep -q uwacom; then
|
||||
echo "${name} is not running."
|
||||
return 0
|
||||
fi
|
||||
echo "Stopping ${name}."
|
||||
/sbin/kldunload %%KMODDIR%%/uwacom.ko
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${wacom_enable="NO"}
|
||||
|
||||
run_rc_command "$1"
|
17
x11-drivers/xf86-input-wacom/pkg-descr
Normal file
17
x11-drivers/xf86-input-wacom/pkg-descr
Normal file
|
@ -0,0 +1,17 @@
|
|||
This package contains the X.Org linuxwacom driver, a Wacom kernel module
|
||||
and a script to configure Xorg.
|
||||
|
||||
The kernel module is provided by Bartosz Fabianowski <freebsd@chillt.de> and
|
||||
supports the following devices:
|
||||
Graphire*, Graphire2*, Graphire3, Graphire4
|
||||
Bamboo, Bamboo One*, Bamboo Fun
|
||||
Intuos3, Cintiq 21UX
|
||||
Volito*, Volito2*
|
||||
PenStation2*, PenPartner2*
|
||||
|
||||
* not tested
|
||||
|
||||
WWW: http://linuxwacom.sourceforge.net/
|
||||
|
||||
- Kamikaze
|
||||
kamikaze@bsdforen.de
|
12
x11-drivers/xf86-input-wacom/pkg-plist
Normal file
12
x11-drivers/xf86-input-wacom/pkg-plist
Normal file
|
@ -0,0 +1,12 @@
|
|||
lib/libwacomcfg.so.0
|
||||
lib/libwacomcfg.so
|
||||
lib/libwacomcfg.la
|
||||
lib/libwacomcfg.a
|
||||
bin/wacdump
|
||||
bin/xidump
|
||||
bin/xsetwacom
|
||||
include/wacomcfg/wacomcfg.h
|
||||
@dirrm include/wacomcfg
|
||||
%%XINPUTMODDIR%%/wacom_drv.so
|
||||
@cwd %%KMODDIR%%
|
||||
%%UWACOMKLD%%
|
Loading…
Reference in a new issue