diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/fbterm/README | 23 | ||||
-rw-r--r-- | system/fbterm/checkfb.c | 77 | ||||
-rw-r--r-- | system/fbterm/fbterm.SlackBuild | 59 | ||||
-rw-r--r-- | system/fbterm/fbterm.info | 12 | ||||
-rw-r--r-- | system/fbterm/setcap.sh | 1 | ||||
-rw-r--r-- | system/fbterm/slack-desc | 8 |
6 files changed, 148 insertions, 32 deletions
diff --git a/system/fbterm/README b/system/fbterm/README index d9d09374ff..3a82f40f73 100644 --- a/system/fbterm/README +++ b/system/fbterm/README @@ -1,8 +1,19 @@ -FbTerm is a fast terminal emulator for linux with frame buffer device -or VESA video card. +FbTerm is a fast terminal emulator for linux with the frame buffer device +or a VESA video card. -* If you want to use shortcuts under FbTerm as a normal user, see - the SECURITY NOTES section of the man page for solution. +fbterm supports the mouse (provided gpm is running) and is able to +share the console with (some) other applications, such as "mplayer -vo +fbdev2". It also uses the same fonts as X, and renders them with lovely +antialiasing like modern X terminals. fbterm has *much* better Unicode +support than the plain Linux framebuffer console. -* To enable FbTerm to redirect /dev/tty0 output to the pseudo terminal - of current sub-window, see the same man page as above. +Also included is a handy utility called checkfb, which simply checks +for the presence and usability of the framebuffer device, and shows its +resolution and bit depth. + +This package uses POSIX filesystem capabilities to execute with +elevated privileges (required for keyboard shortcuts and console +redirection). This may be considered a security risk. Please read +http://www.slackbuilds.org/caps/ for more information. To disable +capabilities, pass SETCAP=no to the script. See also the SECURITY +NOTES section in the fbterm man page. diff --git a/system/fbterm/checkfb.c b/system/fbterm/checkfb.c new file mode 100644 index 0000000000..9180c4ef60 --- /dev/null +++ b/system/fbterm/checkfb.c @@ -0,0 +1,77 @@ +/* +# qtopia core testing framebuffer (1) +# Originally written by Trolltech (2)(3) +# +# (1) http://cep.xray.aps.anl.gov/software/qt4-x11-4.2.2/qtopiacore-testingframebuffer.html +# (2) http://cep.xray.aps.anl.gov/software/qt4-x11-4.2.2/opensourceedition.html +# (3) http://doc.qt.digia.com/4.2/gpl.html +# +# Modified by Sébastien Ballet <slacker6896@gmail.com> +*/ + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <fcntl.h> +#include <linux/fb.h> +#include <sys/mman.h> +#include <sys/ioctl.h> + +int main(int argc, char *argv[]) +{ + int fbfd = 0; + struct fb_var_screeninfo vinfo; + struct fb_fix_screeninfo finfo; + long int screensize = 0; + char *fbp = 0; + + char* fbName="/dev/fb0"; + + if ( argc > 2) { + printf("usage: checkfb [framebuffer device] \n"); + exit(1); + } + + if ( argc == 2) { + fbName=argv[1]; + } + + fbfd = open(fbName, O_RDWR); + + if (fbfd == -1) { + perror("Error: cannot open framebuffer device"); + exit(1); + } + + printf("The framebuffer device (%s) was opened successfully.\n",fbName); + + // Get fixed screen information + if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) { + perror("Error reading fixed information"); + exit(2); + } + + // Get variable screen information + if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) { + perror("Error reading variable information"); + exit(3); + } + + printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel); + + // Figure out the size of the screen in bytes + screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; + + // Map the device to memory + fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED,fbfd, 0); + + if ( fbp == MAP_FAILED ) { + perror("Error: failed to map framebuffer device to memory"); + exit(4); + } + printf("The framebuffer device was mapped to memory successfully.\n"); + + munmap(fbp, screensize); + close(fbfd); + return 0; +} diff --git a/system/fbterm/fbterm.SlackBuild b/system/fbterm/fbterm.SlackBuild index 52a9168660..269c69c8a6 100644 --- a/system/fbterm/fbterm.SlackBuild +++ b/system/fbterm/fbterm.SlackBuild @@ -2,15 +2,28 @@ # Slackware build script for fbterm -# Written by vvoody <ydoovv@gmail.com> +# Originally written by vvoody <email removed> +# Now maintained by B. Watson <yalhcru@gmail.com> + +# Original vvoody version of this script had no license. Modified version +# is licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ +# for details. + +# 20170403 bkw: +# - take over maintenance +# - upgrade for v1.8 +# - use new github homepage +# - stop installing empty NEWS +# - fix and simplify script +# - write compiled terminfo stuff to $PKG, not /usr... +# - add checkfb.c, from Trolltech by way of Slint +# - add capability stuff PRGNAM=fbterm -VERSION=${VERSION:-1.7} +VERSION=${VERSION:-1.8} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -TARBALL_VERSION=1.7.0 - if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; @@ -43,8 +56,8 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $TOPDIR -tar xvf $CWD/$PRGNAM-$TARBALL_VERSION.tar.gz +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . find -L . \ @@ -53,6 +66,12 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# without this, /usr gets spammed by 'tic', and the terminfo stuff +# doesn't become part of the package. +TERMINFO=$PKG/usr/share/terminfo +export TERMINFO +mkdir -p $TERMINFO + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ @@ -62,26 +81,34 @@ CXXFLAGS="$SLKCFLAGS" \ --localstatedir=/var \ --mandir=/usr/man \ --infodir=/usr/info \ - --build=$ARCH-slackware-linux \ - || true + --build=$ARCH-slackware-linux make make install DESTDIR=$PKG -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true - -( cd $PKG/usr/man - find . -type f -exec gzip -9 {} \; - for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done -) +strip $PKG/usr/bin/$PRGNAM +gzip -9 $PKG/usr/man/man1/$PRGNAM.1 +# don't install NEWS, it's empty. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a README ChangeLog AUTHORS NEWS COPYING $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README ChangeLog AUTHORS COPYING $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +# previous maintainer of this build, Didier Spaier, said he intended +# to bundle this with fbterm, for use in Slint. it looks like a useful +# little utility. +gcc $SLKCFLAGS -Wl,-s -o $PKG/usr/bin/checkfb $CWD/checkfb.c + mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc +# Only add capability stuff if not disabled: +if [ "${SETCAP:-yes}" = "yes" ]; then + cat $CWD/setcap.sh >> $PKG/install/doinst.sh + # Only allow execution by video group + chown root:video $PKG/usr/bin/$PRGNAM + chmod 0750 $PKG/usr/bin/$PRGNAM +fi + cd $PKG /sbin/makepkg -p -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/fbterm/fbterm.info b/system/fbterm/fbterm.info index f37ee41f08..4b097e25de 100644 --- a/system/fbterm/fbterm.info +++ b/system/fbterm/fbterm.info @@ -1,10 +1,10 @@ PRGNAM="fbterm" -VERSION="1.7" -HOMEPAGE="http://code.google.com/p/fbterm/" -DOWNLOAD="http://fbterm.googlecode.com/files/fbterm-1.7.0.tar.gz" -MD5SUM="c36bae75a450df0519b4527cccaf7572" +VERSION="1.8" +HOMEPAGE="https://github.com/sfzhi/fbterm" +DOWNLOAD="https://github.com/sfzhi/fbterm/archive/1.8/fbterm-1.8.tar.gz" +MD5SUM="40c36b28488ae8e33a76332fe429aed9" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Didier Spaier" -EMAIL="didier.spaier@epsm.fr" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/system/fbterm/setcap.sh b/system/fbterm/setcap.sh new file mode 100644 index 0000000000..2cee612dd5 --- /dev/null +++ b/system/fbterm/setcap.sh @@ -0,0 +1 @@ +[ -x /sbin/setcap ] && /sbin/setcap cap_sys_admin,cap_sys_tty_config=ep usr/bin/fbterm diff --git a/system/fbterm/slack-desc b/system/fbterm/slack-desc index 1e9daae483..05cc0f8931 100644 --- a/system/fbterm/slack-desc +++ b/system/fbterm/slack-desc @@ -6,12 +6,12 @@ # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| -fbterm: fbterm (a fast FrameBuffer based TERMinal emulator for linux) +fbterm: fbterm (fast framebuffer based terminal emulator for linux) +fbterm: +fbterm: FbTerm is a fast terminal emulator for Linux with the frame buffer +fbterm: device or a VESA video card. fbterm: -fbterm: FbTerm is a fast terminal emulator for Linux with frame buffer device -fbterm: or VESA video card. fbterm: -fbterm: Homepage: http://code.google.com/p/fbterm/ fbterm: fbterm: fbterm: |