pmaports/device/community/device-purism-librem5/pcscd-librem5.initd
Clayton Craft 3ed8a1b07c
device-purism-librem5: add smartcard reader support (MR 1993)
This adds a new subpackage that installs dependencies and configures the
smartcard reader on the librem 5. Some setup is required before this
will work (e.g. upgrading reader firmware), the L5 wiki page will have
this information.

The pcsc init script was forked into this package to allow for powering
on the reader *before* the service started. Doing this in a separate
init script would have caused the reader to power on regardless of
whether the pcsc service was set to start, which is not desirable since
it should *only* be powered on when pcsc is starting
2021-02-28 10:50:36 +03:00

37 lines
855 B
Text

#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/pcsc-lite/files/pcscd-init.7,v 1.1 2014/02/14 23:11:54 flameeyes Exp $
#
# Forked from Alpine's pcsc-lite package to start the cardreader hardware on
# the librem 5
name="PC/SC Daemon for the Librem 5"
pidfile=/run/pcscd/pcscd.pid
command=/usr/sbin/pcscd
command_args="${EXTRA_OPTS}"
start_stop_daemon_args="--user pcscd:pcscd"
depend() {
need localmount
after udev openct dbus
use logger
}
start_pre() {
checkpath -d -m 0755 -o pcscd:pcscd /run/pcscd
# power on smartcard reader
echo 1 > /sys/class/leds/smc_en/brightness
# delay to give card reader time to start up
sleep 2
}
stop_post() {
# power off smartcard reader
echo 0 > /sys/class/leds/smc_en/brightness
}