1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-01 01:17:02 +00:00

Version 2.0:

- USB joystick support has been added
  - Calling select() with a large timeout did not work properly: fixed
  - Short reads (< sizeof(struct js_event)) did not work: fixed
  - The JSIOCGCORR/JSCIOCSCORR ioctls now handle all the axes
  - Each joystick is now presented as a separate js device
  - A manual page has been added
This commit is contained in:
Jean-Yves Lefort 2006-03-21 16:03:50 +00:00
parent e5e940a8f9
commit cf56974241
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=157891
7 changed files with 85 additions and 23 deletions

View File

@ -6,7 +6,7 @@
#
PORTNAME= linux-js
PORTVERSION= 1.0
PORTVERSION= 2.0
CATEGORIES= devel emulators
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= jylefort
@ -17,8 +17,14 @@ COMMENT= The Linux joystick interface ported to FreeBSD
PROGRAMS= jscal jstest
MAN1= ${PROGRAMS:S|$|.1|}
MAN4= linux_js.4
PORTDOCS= joystick-api.txt
USE_RC_SUBR= jscal.sh
USE_RCORDER= jscal.sh linux_js.sh
OPTIONS= JOY "PC joystick support" on \
UHID "USB joystick support" on
MAKE_ENV= WITHOUT_DEBUG=yes
.include <bsd.port.pre.mk>
@ -30,11 +36,24 @@ IGNORE= requires FreeBSD 5.3 or superior
IGNORE= requires kernel source files
.endif
.if defined(WITHOUT_JOY)
MAKE_ENV+= WITHOUT_JOY=yes
.endif
.if defined(WITHOUT_UHID)
MAKE_ENV+= WITHOUT_UHID=yes
.endif
post-patch:
@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|' ${WRKSRC}/linux_js.4
post-install:
${MKDIR} ${PREFIX}/include/linux
${INSTALL_DATA} ${WRKSRC}/joystick.h ${PREFIX}/include/linux
${INSTALL_PROGRAM} ${PROGRAMS:S|^|${WRKSRC}/|} ${PREFIX}/bin
${INSTALL_MAN} ${MAN1:S|^|${WRKSRC}/|} ${PREFIX}/man/man1
.for s in 1 4
${INSTALL_MAN} ${MAN${s}:S|^|${WRKSRC}/|} ${PREFIX}/man/man${s}
.endfor
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/joystick-api.txt ${DOCSDIR}

View File

@ -1,3 +1,3 @@
MD5 (linux-js-1.0.tar.gz) = 8dd60e27c4b122b59fbcda3931626745
SHA256 (linux-js-1.0.tar.gz) = 463dbdc7efb79945728d4c5a9896ac6e7086527a5c39c2ae779e7d3df09e635e
SIZE (linux-js-1.0.tar.gz) = 20191
MD5 (linux-js-2.0.tar.gz) = f3270b11e3603b9cbee48fad51972208
SHA256 (linux-js-2.0.tar.gz) = b9e12efd44a02aabb36077e4333faeede9c6fa959cb468eebf66ed5a3a6c95be
SIZE (linux-js-2.0.tar.gz) = 32725

View File

@ -2,10 +2,11 @@
# $FreeBSD$
# PROVIDE: jscal
# REQUIRE: linux_js
# KEYWORD: shutdown
jscal_enable=${jscal_enable-"NO"}
jscal_device="/dev/input/js0"
jscal_devices="${jscal_devices:-/dev/input/js*}"
jscal_state="${jscal_state:-/var/db/jscal-state}"
. %%RC_SUBR%%
@ -18,13 +19,23 @@ stop_cmd="jscal_stop"
jscal_start()
{
[ -f "$jscal_state" ] && . "$jscal_state" 2>/dev/null
echo "Starting ${name}."
for d in $jscal_devices; do
[ "x$d" = "x$jscal_devices" ] && break
statefile="$jscal_state-`basename $d`"
[ -f "$statefile" ] && . "$statefile" 2>/dev/null
done
}
jscal_stop()
{
cal=`"$command" -p "$jscal_device" 2>/dev/null` && \
echo "$cal" | sed -e "s|^jscal|$command|" > $jscal_state
echo "Stopping ${name}."
for d in $jscal_devices; do
[ "x$d" = "x$jscal_devices" ] && break
statefile="$jscal_state-`basename $d`"
cal=`"$command" -p "$d" 2>/dev/null` && \
echo "$cal" | sed -e "s|^jscal|$command|" > "$statefile"
done
}
load_rc_config $name

View File

@ -0,0 +1,29 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: linux_js
# KEYWORD: shutdown
linux_js_enable=${linux_js_enable-"NO"}
. %%RC_SUBR%%
name="linux_js"
rcvar=`set_rcvar`
start_cmd="linux_js_start"
stop_cmd="linux_js_stop"
linux_js_start()
{
echo "Starting ${name}."
kldload linux_js
}
linux_js_stop()
{
echo "Stopping ${name}."
kldunload linux_js
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,5 +1,5 @@
This port provides a FreeBSD kernel module implementing the Linux joystick
interface (/dev/input/js0), as well as calibration (jscal) and test (jstest)
interface (/dev/input/js?), as well as calibration (jscal) and test (jstest)
utilities.
- Jean-Yves Lefort

View File

@ -1,25 +1,28 @@
===============================================================================
The linux_js kernel module supports analog joysticks through the
joy(4) driver, which must be loaded as a module or compiled into the
kernel. USB joysticks are not yet supported.
To load the kernel module immediately, type the following command:
To load the linux_js kernel module immediately, type the following commands:
kldload joy (if PC joystick support is desired)
kldload uhid (if USB joystick support is desired)
kldload linux_js
To load the kernel module at boot, add the following line to
To load the linux_js kernel module at boot, add the following lines to
/boot/loader.conf:
linux_js_load="YES"
joy_load="YES" (if PC joystick support is desired)
uhid_load="YES" (if USB joystick support is desired)
To test your joystick(s), type the following command:
and add the following line to /etc/rc.conf:
jstest /dev/input/js0
linux_js_enable="YES"
To calibrate your joystick(s), type the following command:
To test a joystick, type the following command:
jscal -c /dev/input/js0
jstest /dev/input/jsXXX
To calibrate a joystick, type the following command:
jscal -c /dev/input/jsXXX
To save the calibration data at system shutdown and restore it at
boot, add the following line to /etc/rc.conf:

View File

@ -1,7 +1,7 @@
bin/jscal
bin/jstest
include/linux/joystick.h
@dirrm include/linux
@dirrmtry include/linux
@cwd /boot/modules
linux_js.ko
@exec kldxref %D