Add devicepkg-dev which generate the touchscreen udev rule based on the deviceinfo (#995)

* Use devicepkg-dev by default in new device wizard
* Add link to reference wiki page
This commit is contained in:
drebrez 2017-12-14 22:17:18 +01:00 committed by Oliver Smith
parent b031017414
commit 4782ffd01f
5 changed files with 92 additions and 18 deletions

View file

@ -1,8 +0,0 @@
# udev rules file
# All device names can be read from weston's logfile
# Touchscreen (use 'weston-calibrator' to calibrate)
SUBSYSTEM=="input", ATTRS{name}=="sec_touchscreen", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1" \
ENV{WL_CALIBRATION}="1.043478 0.000000 -5.217407 0.014562 0.956938 2.798035"

View file

@ -1,30 +1,32 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-samsung-i9070
pkgver=1
pkgrel=15
pkgrel=16
pkgdesc="Samsung Galaxy S Advance"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-samsung-i9070 firmware-samsung-i9070"
makedepends=""
makedepends="devicepkg-dev"
install=""
subpackages="$pkgname-mesa"
source="
deviceinfo
initfs-hook.sh
90-android-touch-dev.rules
modules-load.conf
"
options="!check"
build() {
devicepkg_build $startdir $pkgname
}
package() {
install -D -m644 "$srcdir/deviceinfo" \
"$pkgdir/etc/deviceinfo"
install -D -m644 "$srcdir"/initfs-hook.sh \
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/initfs-hook.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
install -D -m644 "$srcdir"/90-android-touch-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
install -D -m644 "$srcdir"/modules-load.conf \
install -Dm644 "$srcdir"/modules-load.conf \
"$pkgdir"/etc/modules-load.d/00-${pkgname}.conf
}
@ -36,5 +38,4 @@ mesa() {
sha512sums="4aaa8192110e8480b2f674b81f5e850cf419bfb20675443dce63d7f631dc3a0084dd7354b2cf1352349dc5127548fb6940f1c4b2bc80c44595c53b55e80242e0 deviceinfo
098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh
f913184639f9f367730a7c0476657133c673a07dbcbde1fc643595a1a6b99774c2e2f63955bf52cf6d6de343a60b52af8085da3aebbdf6a95b52812a3e3181ec 90-android-touch-dev.rules
61e8becbf6fa7c1c6c42e481083f5981ae7af33a48cbc53e817d8ac2c6a8e4f67a54b32ae3b8f5f25f7b412165a849dc93a629110dc47b0d16927bf2a12eb7e1 modules-load.conf"

View file

@ -0,0 +1,20 @@
pkgname="devicepkg-dev"
pkgver=0.1
pkgrel=0
pkgdesc="Provides default device package functions"
url="https://github.com/postmarketOS"
arch="all"
license="MIT"
source="
devicepkg_build.sh
devicepkg_package.sh
"
package() {
install -Dm755 "$srcdir/devicepkg_build.sh" \
"$pkgdir/usr/bin/devicepkg_build"
install -Dm755 "$srcdir/devicepkg_package.sh" \
"$pkgdir/usr/bin/devicepkg_package"
}
sha512sums="e6f96f8942fa8124ca7461bcf9c78879e08ef00da4a728735046503cae86548505594e078eb14056af74616b17332474f1473f72127299773e075bfd970af13b devicepkg_build.sh
c732792596f56860f6ab9ddd53b9a7a80224400dd20097b20cebe17a6e7330e9178783f09db16132a28a555f83e29ef3643bfe069638b62998912a9a7ffefdc0 devicepkg_package.sh"

View file

@ -0,0 +1,34 @@
#!/bin/sh
startdir=$1
pkgname=$2
if [ -z "$startdir" ] || [ -z "$pkgname" ]; then
echo "ERROR: missing argument!"
echo "Please call devicepkg_default_build() with \$startdir and \$pkgname as arguments."
exit 1
fi
srcdir="$startdir/src"
if [ ! -f "$srcdir/deviceinfo" ]; then
echo "NOTE: $0 is intended to be used inside of the build() function"
echo "of a device package's APKBUILD only."
echo "ERROR: deviceinfo file missing!"
exit 1
fi
# shellcheck disable=SC1090,SC1091
. "$srcdir/deviceinfo"
# shellcheck disable=SC2154
if [ ! -z "$deviceinfo_dev_touchscreen" ]; then
# Create touchscreen udev rule
{
echo "SUBSYSTEM==\"input\", ENV{DEVNAME}==\"$deviceinfo_dev_touchscreen\", \\"
# shellcheck disable=SC2154
if [ ! -z "$deviceinfo_dev_touchscreen_calibration" ]; then
echo "ENV{WL_CALIBRATION}=\"$deviceinfo_dev_touchscreen_calibration\", \\"
fi
echo "ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TOUCHSCREEN}=\"1\""
} > "$srcdir/90-$pkgname.rules"
fi

View file

@ -0,0 +1,27 @@
#!/bin/sh
startdir=$1
pkgname=$2
if [ -z "$startdir" ] || [ -z "$pkgname" ]; then
echo "ERROR: missing argument!"
echo "Please call devicepkg_default_package() with \$startdir and \$pkgname as arguments."
exit 1
fi
srcdir="$startdir/src"
pkgdir="$startdir/pkg/$pkgname"
if [ ! -f "$srcdir/deviceinfo" ]; then
echo "NOTE: $0 is intended to be used inside of the package() function"
echo "of a device package's APKBUILD only."
echo "ERROR: deviceinfo file missing!"
exit 1
fi
install -Dm644 "$srcdir/deviceinfo" \
"$pkgdir/etc/deviceinfo"
if [ -f "$srcdir/90-$pkgname.rules" ]; then
install -Dm644 "$srcdir/90-$pkgname.rules" \
"$pkgdir/etc/udev/rules.d/90-$pkgname.rules"
fi