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:
parent
e95fa260c8
commit
254150567e
|
@ -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"
|
|
||||||
|
|
|
@ -1,30 +1,32 @@
|
||||||
|
# Reference: <https://postmarketos.org/devicepkg>
|
||||||
pkgname=device-samsung-i9070
|
pkgname=device-samsung-i9070
|
||||||
pkgver=1
|
pkgver=1
|
||||||
pkgrel=15
|
pkgrel=16
|
||||||
pkgdesc="Samsung Galaxy S Advance"
|
pkgdesc="Samsung Galaxy S Advance"
|
||||||
url="https://github.com/postmarketOS"
|
url="https://github.com/postmarketOS"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
license="MIT"
|
license="MIT"
|
||||||
depends="linux-samsung-i9070 firmware-samsung-i9070"
|
depends="linux-samsung-i9070 firmware-samsung-i9070"
|
||||||
makedepends=""
|
makedepends="devicepkg-dev"
|
||||||
install=""
|
install=""
|
||||||
subpackages="$pkgname-mesa"
|
subpackages="$pkgname-mesa"
|
||||||
source="
|
source="
|
||||||
deviceinfo
|
deviceinfo
|
||||||
initfs-hook.sh
|
initfs-hook.sh
|
||||||
90-android-touch-dev.rules
|
|
||||||
modules-load.conf
|
modules-load.conf
|
||||||
"
|
"
|
||||||
options="!check"
|
options="!check"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
devicepkg_build $startdir $pkgname
|
||||||
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -D -m644 "$srcdir/deviceinfo" \
|
devicepkg_package $startdir $pkgname
|
||||||
"$pkgdir/etc/deviceinfo"
|
|
||||||
install -D -m644 "$srcdir"/initfs-hook.sh \
|
install -Dm644 "$srcdir"/initfs-hook.sh \
|
||||||
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
|
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
|
||||||
install -D -m644 "$srcdir"/90-android-touch-dev.rules \
|
install -Dm644 "$srcdir"/modules-load.conf \
|
||||||
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
|
|
||||||
install -D -m644 "$srcdir"/modules-load.conf \
|
|
||||||
"$pkgdir"/etc/modules-load.d/00-${pkgname}.conf
|
"$pkgdir"/etc/modules-load.d/00-${pkgname}.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,5 +38,4 @@ mesa() {
|
||||||
|
|
||||||
sha512sums="4aaa8192110e8480b2f674b81f5e850cf419bfb20675443dce63d7f631dc3a0084dd7354b2cf1352349dc5127548fb6940f1c4b2bc80c44595c53b55e80242e0 deviceinfo
|
sha512sums="4aaa8192110e8480b2f674b81f5e850cf419bfb20675443dce63d7f631dc3a0084dd7354b2cf1352349dc5127548fb6940f1c4b2bc80c44595c53b55e80242e0 deviceinfo
|
||||||
098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh
|
098187f6ab56d2542f98f1b5fbcf493431f665a4300db05e859357366e39b02a3d508bfd94c1d1bd7c669261e7ef0d4e1aef1fdbb15541fe34f3f48a6caa247f initfs-hook.sh
|
||||||
f913184639f9f367730a7c0476657133c673a07dbcbde1fc643595a1a6b99774c2e2f63955bf52cf6d6de343a60b52af8085da3aebbdf6a95b52812a3e3181ec 90-android-touch-dev.rules
|
|
||||||
61e8becbf6fa7c1c6c42e481083f5981ae7af33a48cbc53e817d8ac2c6a8e4f67a54b32ae3b8f5f25f7b412165a849dc93a629110dc47b0d16927bf2a12eb7e1 modules-load.conf"
|
61e8becbf6fa7c1c6c42e481083f5981ae7af33a48cbc53e817d8ac2c6a8e4f67a54b32ae3b8f5f25f7b412165a849dc93a629110dc47b0d16927bf2a12eb7e1 modules-load.conf"
|
||||||
|
|
|
@ -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"
|
|
@ -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
|
|
@ -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
|
|
@ -140,6 +140,7 @@ def generate_deviceinfo(args, pkgname, name, manufacturer, arch, has_keyboard,
|
||||||
deviceinfo_screen_width="800"
|
deviceinfo_screen_width="800"
|
||||||
deviceinfo_screen_height="600"
|
deviceinfo_screen_height="600"
|
||||||
deviceinfo_dev_touchscreen=""
|
deviceinfo_dev_touchscreen=""
|
||||||
|
deviceinfo_dev_touchscreen_calibration=""
|
||||||
deviceinfo_dev_keyboard=""
|
deviceinfo_dev_keyboard=""
|
||||||
|
|
||||||
# Bootloader related
|
# Bootloader related
|
||||||
|
@ -185,6 +186,7 @@ def generate_apkbuild(args, pkgname, name, manufacturer, arch, flash_method):
|
||||||
if flash_method == "0xffff":
|
if flash_method == "0xffff":
|
||||||
depends += " uboot-tools"
|
depends += " uboot-tools"
|
||||||
content = """\
|
content = """\
|
||||||
|
# Reference: <https://postmarketos.org/devicepkg>
|
||||||
pkgname=\"""" + pkgname + """\"
|
pkgname=\"""" + pkgname + """\"
|
||||||
pkgdesc=\"""" + manufacturer + " " + name + """\"
|
pkgdesc=\"""" + manufacturer + " " + name + """\"
|
||||||
pkgver=0.1
|
pkgver=0.1
|
||||||
|
@ -194,11 +196,15 @@ def generate_apkbuild(args, pkgname, name, manufacturer, arch, flash_method):
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
options="!check"
|
options="!check"
|
||||||
depends=\"""" + depends + """\"
|
depends=\"""" + depends + """\"
|
||||||
|
makedepends="devicepkg-dev"
|
||||||
source="deviceinfo"
|
source="deviceinfo"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
devicepkg_build $startdir $pkgname
|
||||||
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm644 "$srcdir"/deviceinfo \\
|
devicepkg_package $startdir $pkgname
|
||||||
"$pkgdir"/etc/deviceinfo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="(run 'pmbootstrap checksum """ + pkgname + """' to fill)"
|
sha512sums="(run 'pmbootstrap checksum """ + pkgname + """' to fill)"
|
||||||
|
|
|
@ -38,6 +38,7 @@ sh_files="
|
||||||
./aports/main/postmarketos-ui-hildon/postmarketos-ui-hildon.post-install
|
./aports/main/postmarketos-ui-hildon/postmarketos-ui-hildon.post-install
|
||||||
$(find . -path './aports/main/postmarketos-ui-hildon/*.sh')
|
$(find . -path './aports/main/postmarketos-ui-hildon/*.sh')
|
||||||
$(find . -name '*.trigger')
|
$(find . -name '*.trigger')
|
||||||
|
$(find . -path './aports/main/devicepkg-dev/*.sh')
|
||||||
"
|
"
|
||||||
for file in ${sh_files}; do
|
for file in ${sh_files}; do
|
||||||
echo "Test with shellcheck: $file"
|
echo "Test with shellcheck: $file"
|
||||||
|
|
|
@ -38,13 +38,18 @@ def args(tmpdir, request):
|
||||||
pmb.helpers.logging.init(args)
|
pmb.helpers.logging.init(args)
|
||||||
request.addfinalizer(args.logfd.close)
|
request.addfinalizer(args.logfd.close)
|
||||||
|
|
||||||
# Fake aports folder):
|
# Fake aports folder:
|
||||||
tmpdir = str(tmpdir)
|
tmpdir = str(tmpdir)
|
||||||
setattr(args, "_aports_real", args.aports)
|
setattr(args, "_aports_real", args.aports)
|
||||||
args.aports = tmpdir
|
args.aports = tmpdir
|
||||||
pmb.helpers.run.user(args, ["mkdir", "-p", tmpdir + "/device"])
|
|
||||||
|
# Copy the devicepkg-dev package (shared device-* APKBUILD code)
|
||||||
|
pmb.helpers.run.user(args, ["mkdir", "-p", tmpdir + "/main"])
|
||||||
|
path_dev = args._aports_real + "/main/devicepkg-dev"
|
||||||
|
pmb.helpers.run.user(args, ["cp", "-r", path_dev, tmpdir + "/main"])
|
||||||
|
|
||||||
# Copy the linux-lg-mako aport (we currently copy patches from there)
|
# Copy the linux-lg-mako aport (we currently copy patches from there)
|
||||||
|
pmb.helpers.run.user(args, ["mkdir", "-p", tmpdir + "/device"])
|
||||||
path_mako = args._aports_real + "/device/linux-lg-mako"
|
path_mako = args._aports_real + "/device/linux-lg-mako"
|
||||||
pmb.helpers.run.user(args, ["cp", "-r", path_mako, tmpdir + "/device"])
|
pmb.helpers.run.user(args, ["cp", "-r", path_mako, tmpdir + "/device"])
|
||||||
return args
|
return args
|
||||||
|
|
Loading…
Reference in New Issue