diff --git a/sysutils/Makefile b/sysutils/Makefile index b780c6c8424f..cd68a6652b26 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -37,6 +37,7 @@ SUBDIR += asmem SUBDIR += asmon SUBDIR += asr-utils + SUBDIR += asusoled SUBDIR += ataidle SUBDIR += atitvout SUBDIR += automounter diff --git a/sysutils/asusoled/Makefile b/sysutils/asusoled/Makefile new file mode 100644 index 000000000000..ffc7f938966a --- /dev/null +++ b/sysutils/asusoled/Makefile @@ -0,0 +1,50 @@ +# Ports collection makefile for: asusoled +# Date created: 2008-09-11 +# Whom: Jung-uk Kim +# +# $FreeBSD$ +# + +PORTNAME= asusoled +PORTVERSION= 0.10 +CATEGORIES= sysutils +MASTER_SITES= http://people.freebsd.org/~jkim/ +DISTNAME= ${PORTNAME}-${PORTVERSION} + +MAINTAINER= jkim@FreeBSD.org +COMMENT= Utility for ASUS USB OLED Display + +LIB_DEPENDS= usb-0.1.8:${PORTSDIR}/devel/libusb +RUN_DEPENDS= ${FONTDIR}/TTF/luxisr.ttf:${PORTSDIR}/x11-fonts/font-bh-ttf + +USE_SDL= image sdl ttf +USE_RC_SUBR= asusoled.sh oled_clock.sh + +PORTDATA= asus.png asus_clock.png +PORTDOCS= README.FreeBSD +PLIST_FILES= sbin/asusoled +SUB_FILES= asusoled.sh oled_clock.sh pkg-message + +MAKE_ARGS+= TTF_FONT=${FONTDIR}/TTF/luxisr.ttf + +FONTDIR?= ${LOCALBASE}/lib/X11/fonts + +post-install: +.if !defined(NOPORTDATA) + @${MKDIR} ${DATADIR} +.for i in ${PORTDATA} + @${INSTALL_DATA} ${WRKSRC}/data/${i} ${DATADIR} +.endfor +.endif +.if !defined(NOPORTDOCS) + @${CAT} ${PKGMESSAGE} > ${WRKSRC}/README.FreeBSD + @${MKDIR} ${DOCSDIR} +.for i in ${PORTDOCS} + @${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR} +.endfor +.endif + @${ECHO} + @${CAT} ${PKGMESSAGE} + @${ECHO} + +.include diff --git a/sysutils/asusoled/distinfo b/sysutils/asusoled/distinfo new file mode 100644 index 000000000000..823fdd5085d4 --- /dev/null +++ b/sysutils/asusoled/distinfo @@ -0,0 +1,3 @@ +MD5 (asusoled-0.10.tar.gz) = b49419fd3abb508fb264ee56c55294a7 +SHA256 (asusoled-0.10.tar.gz) = 2343f8bde7b9672a5602e81c2ce4992839c7f5175260ea57f0412b340e1027e3 +SIZE (asusoled-0.10.tar.gz) = 19051 diff --git a/sysutils/asusoled/files/asusoled.sh.in b/sysutils/asusoled/files/asusoled.sh.in new file mode 100644 index 000000000000..45f99283f228 --- /dev/null +++ b/sysutils/asusoled/files/asusoled.sh.in @@ -0,0 +1,54 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: asusoled +# REQUIRE: DAEMON +# KEYWORD: nojail shutdown +# +# Add the following lines to /etc/rc.conf to enable the ASUS OLED display: +# +# asusoled_enable="YES" +# + +asusoled_enable=${asusoled_enable-"NO"} +asusoled_flags=${asusoled_flags-"-f %%PREFIX%%/share/asusoled/asus.png"} +asusoled_command=${asusoled_command-""} + +. /etc/rc.subr + +name=asusoled +rcvar=`set_rcvar` + +start_cmd=asusoled_start +stop_cmd=asusoled_stop + +asusoled_bin="%%PREFIX%%/sbin/asusoled" +asusoled_pidfile="/var/run/${name}.pid" + +asusoled_start() { + if checkyesno asusoled_enable + then + echo "Starting asusoled." + ${asusoled_bin} -e || exit 1 + if test ! -z "${asusoled_command}" + then + ${asusoled_bin} ${asusoled_flags} -c "${asusoled_command}" + else + ${asusoled_bin} ${asusoled_flags} + fi + fi +} + +asusoled_stop() { + if checkyesno asusoled_enable + then + echo "Stopping asusoled." + test -f ${asusoled_pidfile} && + ${asusoled_bin} -k -p ${asusoled_pidfile} + ${asusoled_bin} -d + fi +} + +load_rc_config ${name} +run_rc_command "$1" diff --git a/sysutils/asusoled/files/oled_clock.sh.in b/sysutils/asusoled/files/oled_clock.sh.in new file mode 100644 index 000000000000..a8c8c4420bb4 --- /dev/null +++ b/sysutils/asusoled/files/oled_clock.sh.in @@ -0,0 +1,50 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: oled_clock +# REQUIRE: DAEMON +# KEYWORD: nojail shutdown +# +# Add the following lines to /etc/rc.conf to enable the ASUS OLED clock: +# +# oled_clock_enable="YES" +# + +oled_clock_enable=${oled_clock_enable-"NO"} +oled_clock_flags=${oled_clock_flags-"-R -i -w -P 1"} + +. /etc/rc.subr + +name=oled_clock +rcvar=`set_rcvar` + +start_cmd=oled_clock_start +stop_cmd=oled_clock_stop + +asusoled_bin="%%PREFIX%%/sbin/asusoled" +oled_clock_pidfile="/var/run/${name}.pid" +oled_clock_command="LANG=en_US.UTF-8 /bin/date '+%a %b %d %R %Y'" + +oled_clock_start() { + if checkyesno oled_clock_enable + then + echo "Starting oled_clock." + ${asusoled_bin} -e || exit 1 + ${asusoled_bin} ${oled_clock_flags} -D -p ${oled_clock_pidfile} \ + -c "${oled_clock_command}" + fi +} + +oled_clock_stop() { + if checkyesno oled_clock_enable + then + echo "Stopping oled_clock." + test -f ${oled_clock_pidfile} && \ + ${asusoled_bin} -k -p ${oled_clock_pidfile} + ${asusoled_bin} -d + fi +} + +load_rc_config ${name} +run_rc_command "$1" diff --git a/sysutils/asusoled/files/pkg-message.in b/sysutils/asusoled/files/pkg-message.in new file mode 100644 index 000000000000..97ecadca7711 --- /dev/null +++ b/sysutils/asusoled/files/pkg-message.in @@ -0,0 +1,46 @@ +Please note this utility requires ugen(4). Try: + + kldstat -m uhub/ugen + +If it is loaded, you will see something like the following: + + Id Refs Name + 31 1 uhub/ugen + +If it is not loaded, then try: + + kldload ugen + +Unfortunately early versions of uhid(4) conflict with ASUS LCM. If this +utility does not work for you, try unloading it first: + + kldunload uhid + +If the driver is compiled into kernel, you cannot unload it, however. +If so, you have to recompile kernel without the uhid support or to fix it +for yourself. If you don't need uhid, just comment out "device uhid" line +from your kernel configuration file and recompile kernel. If you need uhid, +you have to touch two files: + +http://docs.freebsd.org/cgi/mid.cgi?200803141559.m2EFxWs1074538 + +To build custom kernel, please read "Configuring the FreeBSD Kernel" section +from the Handbook: + +http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html + +Also, there are two example rcNG scripts, i.e., asusoled and oled_clock. +You can enable 'asusoled' by adding: + + asusoled_enable="YES" + +in your /etc/rc.conf. If you just want to test it, run: + + %%PREFIX%%/etc/rc.d/asusoled forcestart + +You will see a black ASUS logo on white background from the display. +Similarly, you can enable or test 'oled_clock', of course. :-) + +Enjoy! + +Jung-uk Kim diff --git a/sysutils/asusoled/pkg-descr b/sysutils/asusoled/pkg-descr new file mode 100644 index 000000000000..437d46b951d1 --- /dev/null +++ b/sysutils/asusoled/pkg-descr @@ -0,0 +1,10 @@ +This port provides a utility for controlling USB OLED display found +on some ASUS laptops such as G-series models. + +Originally it was written by Christian Lamparter +for Linux and the early version is still available from here: + + https://launchpad.net/asusoled + +Now it is almost rewrite of the code with a lot of new features and +improvements by Jung-uk Kim .