user/rm-utils: new aport
This commit is contained in:
parent
c69f4afcb4
commit
75e08ef1c8
6 changed files with 649 additions and 0 deletions
40
user/rm-utils/APKBUILD
Normal file
40
user/rm-utils/APKBUILD
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
|
||||||
|
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
|
||||||
|
|
||||||
|
pkgname=rm-utils
|
||||||
|
pkgver=0.0.1
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="Utility files for reMarkable tablet"
|
||||||
|
arch="armv7 armhf"
|
||||||
|
url="http://www.davisr.me/projects/parabola-rm/"
|
||||||
|
license="GPL-3.0-only"
|
||||||
|
makedepends="musl-dev linux-headers"
|
||||||
|
options="!check" # No testsuite
|
||||||
|
builddir="$srcdir"
|
||||||
|
source="
|
||||||
|
battery-monitor.sh
|
||||||
|
epdc-init-auto.c
|
||||||
|
epdc-show-bitmap.c
|
||||||
|
xorg.conf
|
||||||
|
mxcfb.h
|
||||||
|
"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
$CC -c epdc-init-auto.c -o epdc-init-auto -I/usr/include
|
||||||
|
$CC -c epdc-show-bitmap.c -o epdc-show-bitmap -I/usr/include
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -vDm755 battery-monitor.sh "$pkgdir"/usr/bin/battery-monitor
|
||||||
|
install -vDm755 epdc-show-bitmap -t "$pkgdir"/usr/bin/
|
||||||
|
install -vDm755 epdc-init-auto -t "$pkgdir"/usr/bin/
|
||||||
|
install -vDm644 xorg.conf -t "$pkgdir"/etc/defaults/
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="
|
||||||
|
7f0e6cb276357983b76c37c81a91c0d278dbec16d8982a97618f2217ef5e4d706211d921af6c79db3aad912d50aaed8cf5ce67f52a1081f61585eb97322c8deb battery-monitor.sh
|
||||||
|
50813c5c2e888e106416dd0b5b515c8a145da23343992b29ee8ad325a72a7b4bd464824636ea66c95f16df20f357646bf8e9e1ed66367f8b540b50dc608495d6 epdc-init-auto.c
|
||||||
|
274ba66666628ec12ee32e2054d7fd2d3ebcccb144784934f645472d482ed0d56777ebd87a342dd121c6e753e8efc776d9c340e4f54ac3b0fb460afbdb0020fe epdc-show-bitmap.c
|
||||||
|
e14a61751e4c830652e7a849b9d596c6bc213fed87ba3f9f7c3df0d5fe35ddf28bde7de2fa977c0321639503ceff5abffd0d856380eacce24389fd50eaf3372a xorg.conf
|
||||||
|
0f3ccef7102c961232002f483344f9efc915f2862cefeaa966835ca7aa2f4d6236ac3df998189f3983535f03ede945565c54bb7e5f88f3a34c3a4429c3c075e7 mxcfb.h
|
||||||
|
"
|
37
user/rm-utils/battery-monitor.sh
Normal file
37
user/rm-utils/battery-monitor.sh
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# battery-monitor.sh
|
||||||
|
# Prints the state of charge of the tablet's battery
|
||||||
|
#
|
||||||
|
# Parabola-rM is a free operating system for the reMarakble tablet.
|
||||||
|
# Copyright (C) 2020
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program.
|
||||||
|
|
||||||
|
# Path for Linux 4.9
|
||||||
|
battpath="/sys/class/power_supply/bq27441-0"
|
||||||
|
|
||||||
|
chargenow="$(cat $battpath/charge_now)"
|
||||||
|
chargefull="$(cat $battpath/charge_full)"
|
||||||
|
status="$(cat $battpath/status)"
|
||||||
|
|
||||||
|
chargepct="$(echo $chargenow $chargefull \
|
||||||
|
| awk '{printf "%f", $1 / $2 * 100}' \
|
||||||
|
| cut -d'.' -f1)"
|
||||||
|
symbol=""
|
||||||
|
if [[ "Charging" == "$status" ]]; then
|
||||||
|
symbol=$'\u26a1' # Lightning symbol
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${symbol}${chargepct}%"
|
126
user/rm-utils/epdc-init-auto.c
Normal file
126
user/rm-utils/epdc-init-auto.c
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
epdc-init-auto.c
|
||||||
|
Initializes the EPDC framebuffer into a deferred-IO automatic-update
|
||||||
|
mode
|
||||||
|
|
||||||
|
Parabola-rM is a free operating system for the reMarakble tablet.
|
||||||
|
Copyright (C) 2020 Davis Remmel
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/fb.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include "mxcfb.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int fb = open("/dev/fb0", O_RDWR);
|
||||||
|
struct fb_var_screeninfo vinfo;
|
||||||
|
ret = ioctl(fb, FBIOGET_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOGET_VSCREENINFO failed with error "
|
||||||
|
"%d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
vinfo.xres = 1872;
|
||||||
|
vinfo.yres = 1404;
|
||||||
|
vinfo.pixclock = 160000000;
|
||||||
|
vinfo.left_margin = 32;
|
||||||
|
vinfo.right_margin = 326;
|
||||||
|
vinfo.upper_margin = 4;
|
||||||
|
vinfo.lower_margin = 12;
|
||||||
|
vinfo.hsync_len = 44;
|
||||||
|
vinfo.vsync_len = 1;
|
||||||
|
vinfo.sync = 0;
|
||||||
|
vinfo.vmode = FB_VMODE_NONINTERLACED;
|
||||||
|
vinfo.accel_flags = 0;
|
||||||
|
vinfo.activate = FB_ACTIVATE_FORCE;
|
||||||
|
|
||||||
|
// Put screen info. Sometimes this fails when trying to set the
|
||||||
|
// pixclock. This may be a bug in the driver's arithmetic.
|
||||||
|
ret = ioctl(fb, FBIOPUT_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOPUT_VSCREENINFO failed with error "
|
||||||
|
"%d, attempting to reset pixclock\n", ret);
|
||||||
|
vinfo.pixclock = 6250;
|
||||||
|
ioctl(fb, FBIOPUT_VSCREENINFO, &vinfo);
|
||||||
|
vinfo.pixclock = 160000000;
|
||||||
|
ret = ioctl(fb, FBIOPUT_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOPUT_VSCREENINFO failed "
|
||||||
|
"with error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull the screeninfo agian
|
||||||
|
ret = ioctl(fb, FBIOGET_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOGET_VSCREENINFO failed with error "
|
||||||
|
"%d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("x:%d y:%d activate:%d bpp:%d rotate:%d hsync_len:%d"
|
||||||
|
"vsync_len: %d sync:%d\n",
|
||||||
|
vinfo.xres, vinfo.yres, vinfo.activate,
|
||||||
|
vinfo.bits_per_pixel, vinfo.rotate, vinfo.hsync_len,
|
||||||
|
vinfo.vsync_len, vinfo.sync);
|
||||||
|
|
||||||
|
struct fb_fix_screeninfo finfo;
|
||||||
|
ret = ioctl(fb, FBIOGET_FSCREENINFO, &finfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOGET_FSCREENINFO failed with error "
|
||||||
|
"%d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case the EPDC wasn't accessible
|
||||||
|
ret = ioctl(fb, MXCFB_ENABLE_EPDC_ACCESS);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_ENABLE_EPDC_ACCESS failed with "
|
||||||
|
"error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set auto update mode
|
||||||
|
__u32 aumode = AUTO_UPDATE_MODE_AUTOMATIC_MODE;
|
||||||
|
ret = ioctl(fb, MXCFB_SET_AUTO_UPDATE_MODE, &aumode);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_SET_AUTO_UPDATE_MODE failed "
|
||||||
|
"with error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Queue-and-merge is best-performing
|
||||||
|
__u32 uscheme = UPDATE_SCHEME_QUEUE_AND_MERGE;
|
||||||
|
ret = ioctl(fb, MXCFB_SET_UPDATE_SCHEME, &uscheme);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_SET_UPDATE_SCHEME failed with "
|
||||||
|
"error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fb);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
184
user/rm-utils/epdc-show-bitmap.c
Normal file
184
user/rm-utils/epdc-show-bitmap.c
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
/*
|
||||||
|
epdc-show-bitmap.c
|
||||||
|
Displays a raw image to the EPDC framebuffer
|
||||||
|
|
||||||
|
Parabola-rM is a free operating system for the reMarakble tablet.
|
||||||
|
Copyright (C) 2020 Davis Remmel
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/fb.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include "mxcfb.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("Must pass an image as an argument.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
int fb = open("/dev/fb0", O_RDWR);
|
||||||
|
struct fb_var_screeninfo vinfo;
|
||||||
|
ret = ioctl(fb, FBIOGET_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
printf("FBIOGET_VSCREENINFO failed with error %d"
|
||||||
|
", aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
vinfo.xres = 1872;
|
||||||
|
vinfo.yres = 1404;
|
||||||
|
vinfo.pixclock = 160000000;
|
||||||
|
vinfo.left_margin = 32;
|
||||||
|
vinfo.right_margin = 326;
|
||||||
|
vinfo.upper_margin = 4;
|
||||||
|
vinfo.lower_margin = 12;
|
||||||
|
vinfo.hsync_len = 44;
|
||||||
|
vinfo.vsync_len = 1;
|
||||||
|
vinfo.sync = 0;
|
||||||
|
vinfo.vmode = FB_VMODE_NONINTERLACED;
|
||||||
|
vinfo.accel_flags = 0;
|
||||||
|
vinfo.activate = FB_ACTIVATE_FORCE;
|
||||||
|
|
||||||
|
// Put screen info. Sometimes this fails when trying to set the
|
||||||
|
// pixclock. This may be a bug in the driver's arithmetic.
|
||||||
|
ret = ioctl(fb, FBIOPUT_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOPUT_VSCREENINFO failed with error "
|
||||||
|
"%d, attempting To reset pixclock\n", ret);
|
||||||
|
vinfo.pixclock = 6250;
|
||||||
|
ioctl(fb, FBIOPUT_VSCREENINFO, &vinfo);
|
||||||
|
vinfo.pixclock = 160000000;
|
||||||
|
ret = ioctl(fb, FBIOPUT_VSCREENINFO, &vinfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOPUT_VSCREENINFO failed "
|
||||||
|
"with error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("x:%d y:%d activate:%d bpp:%d rotate:%d hsync_len:%d"
|
||||||
|
"vsync_len: %d sync:%d\n",
|
||||||
|
vinfo.xres, vinfo.yres, vinfo.activate,
|
||||||
|
vinfo.bits_per_pixel, vinfo.rotate, vinfo.hsync_len,
|
||||||
|
vinfo.vsync_len, vinfo.sync);
|
||||||
|
|
||||||
|
struct fb_fix_screeninfo finfo;
|
||||||
|
ret = ioctl(fb, FBIOGET_FSCREENINFO, &finfo);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "FBIOGET_FSCREENINFO failed with error "
|
||||||
|
"%d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In case the EPDC wasn't accessible
|
||||||
|
ret = ioctl(fb, MXCFB_ENABLE_EPDC_ACCESS);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_ENABLE_EPDC_ACCESS failed with "
|
||||||
|
"error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set to partial mode to control update parameters
|
||||||
|
__u32 aumode = AUTO_UPDATE_MODE_REGION_MODE;
|
||||||
|
ret = ioctl(fb, MXCFB_SET_AUTO_UPDATE_MODE, &aumode);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_SET_AUTO_UPDATE_MODE failed "
|
||||||
|
"with error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// No artifacts in display output
|
||||||
|
__u32 uscheme = UPDATE_SCHEME_SNAPSHOT;
|
||||||
|
ret = ioctl(fb, MXCFB_SET_UPDATE_SCHEME, &uscheme);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_SET_UPDATE_SCHEME failed with "
|
||||||
|
"error %d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up update (same region for all writes, gets reused)
|
||||||
|
struct mxcfb_update_data bupdate;
|
||||||
|
bupdate.update_region.left = 0;
|
||||||
|
bupdate.update_region.top = 0;
|
||||||
|
bupdate.update_region.width = 1872;
|
||||||
|
bupdate.update_region.height = 1404;
|
||||||
|
bupdate.waveform_mode = WAVEFORM_MODE_AUTO;
|
||||||
|
bupdate.update_mode = UPDATE_MODE_FULL;
|
||||||
|
bupdate.update_marker = 0;
|
||||||
|
bupdate.temp = TEMP_USE_AMBIENT;
|
||||||
|
bupdate.flags = 0;
|
||||||
|
|
||||||
|
struct mxcfb_update_marker_data updm;
|
||||||
|
updm.update_marker = 0;
|
||||||
|
|
||||||
|
// mmap to framebuffer
|
||||||
|
int buflength = vinfo.yres_virtual * finfo.line_length;
|
||||||
|
printf("buflength %d\n", buflength);
|
||||||
|
char * region = mmap(0, buflength, PROT_READ | PROT_WRITE,
|
||||||
|
MAP_SHARED, fb, (off_t)0);
|
||||||
|
if (region == MAP_FAILED) {
|
||||||
|
fprintf(stderr, "map failed!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write black
|
||||||
|
memset(region, 0x00, buflength);
|
||||||
|
ioctl(fb, MXCFB_SEND_UPDATE, &bupdate);
|
||||||
|
ioctl(fb, MXCFB_WAIT_FOR_UPDATE_COMPLETE, &updm);
|
||||||
|
|
||||||
|
// Write white
|
||||||
|
memset(region, 0xff, buflength);
|
||||||
|
ioctl(fb, MXCFB_SEND_UPDATE, &bupdate);
|
||||||
|
ioctl(fb, MXCFB_WAIT_FOR_UPDATE_COMPLETE, &updm);
|
||||||
|
|
||||||
|
// Write image
|
||||||
|
FILE *pattern = fopen(argv[1], "rb");
|
||||||
|
fseek(pattern, 0, SEEK_END);
|
||||||
|
long psize = ftell(pattern);
|
||||||
|
printf("psize is %d\n", psize);
|
||||||
|
fseek(pattern, 0, SEEK_SET);
|
||||||
|
|
||||||
|
if (psize != buflength) {
|
||||||
|
fprintf(stderr, "Image must match framebuffer size\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *buffer = malloc(psize);
|
||||||
|
fread(buffer, psize, 1, pattern);
|
||||||
|
fclose(pattern);
|
||||||
|
|
||||||
|
memcpy(region, buffer, psize);
|
||||||
|
ret = ioctl(fb, MXCFB_SEND_UPDATE, &bupdate);
|
||||||
|
ioctl(fb, MXCFB_WAIT_FOR_UPDATE_COMPLETE, &updm);
|
||||||
|
if (0 != ret) {
|
||||||
|
fprintf(stderr, "MXCFB_SEND_UPDATE failed with error "
|
||||||
|
"%d, aborting\n", ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fb);
|
||||||
|
return 0;
|
||||||
|
}
|
200
user/rm-utils/mxcfb.h
Normal file
200
user/rm-utils/mxcfb.h
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013-2015 Freescale Semiconductor, Inc. All Rights Reserved
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @file uapi/linux/mxcfb.h
|
||||||
|
*
|
||||||
|
* @brief Global header file for the MXC frame buffer
|
||||||
|
*
|
||||||
|
* @ingroup Framebuffer
|
||||||
|
*/
|
||||||
|
#ifndef __ASM_ARCH_MXCFB_H__
|
||||||
|
#define __ASM_ARCH_MXCFB_H__
|
||||||
|
|
||||||
|
#include <linux/fb.h>
|
||||||
|
|
||||||
|
#define FB_SYNC_OE_LOW_ACT 0x80000000
|
||||||
|
#define FB_SYNC_CLK_LAT_FALL 0x40000000
|
||||||
|
#define FB_SYNC_DATA_INVERT 0x20000000
|
||||||
|
#define FB_SYNC_CLK_IDLE_EN 0x10000000
|
||||||
|
#define FB_SYNC_SHARP_MODE 0x08000000
|
||||||
|
#define FB_SYNC_SWAP_RGB 0x04000000
|
||||||
|
#define FB_ACCEL_TRIPLE_FLAG 0x00000000
|
||||||
|
#define FB_ACCEL_DOUBLE_FLAG 0x00000001
|
||||||
|
|
||||||
|
struct mxcfb_gbl_alpha {
|
||||||
|
int enable;
|
||||||
|
int alpha;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_loc_alpha {
|
||||||
|
int enable;
|
||||||
|
int alpha_in_pixel;
|
||||||
|
unsigned long alpha_phy_addr0;
|
||||||
|
unsigned long alpha_phy_addr1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_color_key {
|
||||||
|
int enable;
|
||||||
|
__u32 color_key;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_pos {
|
||||||
|
__u16 x;
|
||||||
|
__u16 y;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_gamma {
|
||||||
|
int enable;
|
||||||
|
int constk[16];
|
||||||
|
int slopek[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_gpu_split_fmt {
|
||||||
|
struct fb_var_screeninfo var;
|
||||||
|
unsigned long offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_rect {
|
||||||
|
__u32 top;
|
||||||
|
__u32 left;
|
||||||
|
__u32 width;
|
||||||
|
__u32 height;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define GRAYSCALE_8BIT 0x1
|
||||||
|
#define GRAYSCALE_8BIT_INVERTED 0x2
|
||||||
|
#define GRAYSCALE_4BIT 0x3
|
||||||
|
#define GRAYSCALE_4BIT_INVERTED 0x4
|
||||||
|
|
||||||
|
#define AUTO_UPDATE_MODE_REGION_MODE 0
|
||||||
|
#define AUTO_UPDATE_MODE_AUTOMATIC_MODE 1
|
||||||
|
|
||||||
|
#define UPDATE_SCHEME_SNAPSHOT 0
|
||||||
|
#define UPDATE_SCHEME_QUEUE 1
|
||||||
|
#define UPDATE_SCHEME_QUEUE_AND_MERGE 2
|
||||||
|
|
||||||
|
#define UPDATE_MODE_PARTIAL 0x0
|
||||||
|
#define UPDATE_MODE_FULL 0x1
|
||||||
|
|
||||||
|
#define WAVEFORM_MODE_GLR16 4
|
||||||
|
#define WAVEFORM_MODE_GLD16 5
|
||||||
|
#define WAVEFORM_MODE_AUTO 257
|
||||||
|
|
||||||
|
#define TEMP_USE_AMBIENT 0x1000
|
||||||
|
|
||||||
|
#define EPDC_FLAG_ENABLE_INVERSION 0x01
|
||||||
|
#define EPDC_FLAG_FORCE_MONOCHROME 0x02
|
||||||
|
#define EPDC_FLAG_USE_CMAP 0x04
|
||||||
|
#define EPDC_FLAG_USE_ALT_BUFFER 0x100
|
||||||
|
#define EPDC_FLAG_TEST_COLLISION 0x200
|
||||||
|
#define EPDC_FLAG_GROUP_UPDATE 0x400
|
||||||
|
#define EPDC_FLAG_USE_DITHERING_Y1 0x2000
|
||||||
|
#define EPDC_FLAG_USE_DITHERING_Y4 0x4000
|
||||||
|
#define EPDC_FLAG_USE_REGAL 0x8000
|
||||||
|
|
||||||
|
enum mxcfb_dithering_mode {
|
||||||
|
EPDC_FLAG_USE_DITHERING_PASSTHROUGH = 0x0,
|
||||||
|
EPDC_FLAG_USE_DITHERING_FLOYD_STEINBERG,
|
||||||
|
EPDC_FLAG_USE_DITHERING_ATKINSON,
|
||||||
|
EPDC_FLAG_USE_DITHERING_ORDERED,
|
||||||
|
EPDC_FLAG_USE_DITHERING_QUANT_ONLY,
|
||||||
|
EPDC_FLAG_USE_DITHERING_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FB_POWERDOWN_DISABLE -1
|
||||||
|
#define FB_TEMP_AUTO_UPDATE_DISABLE -1
|
||||||
|
|
||||||
|
struct mxcfb_alt_buffer_data {
|
||||||
|
__u32 phys_addr;
|
||||||
|
__u32 width; /* width of entire buffer */
|
||||||
|
__u32 height; /* height of entire buffer */
|
||||||
|
struct mxcfb_rect alt_update_region; /* region within buffer to update */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_update_data {
|
||||||
|
struct mxcfb_rect update_region;
|
||||||
|
__u32 waveform_mode;
|
||||||
|
__u32 update_mode;
|
||||||
|
__u32 update_marker;
|
||||||
|
int temp;
|
||||||
|
unsigned int flags;
|
||||||
|
int dither_mode;
|
||||||
|
int quant_bit;
|
||||||
|
struct mxcfb_alt_buffer_data alt_buffer_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mxcfb_update_marker_data {
|
||||||
|
__u32 update_marker;
|
||||||
|
__u32 collision_test;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure used to define waveform modes for driver
|
||||||
|
* Needed for driver to perform auto-waveform selection
|
||||||
|
*/
|
||||||
|
struct mxcfb_waveform_modes {
|
||||||
|
int mode_init;
|
||||||
|
int mode_du;
|
||||||
|
int mode_gc4;
|
||||||
|
int mode_gc8;
|
||||||
|
int mode_gc16;
|
||||||
|
int mode_gc32;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure used to define a 5*3 matrix of parameters for
|
||||||
|
* setting IPU DP CSC module related to this framebuffer.
|
||||||
|
*/
|
||||||
|
struct mxcfb_csc_matrix {
|
||||||
|
int param[5][3];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MXCFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t)
|
||||||
|
#define MXCFB_SET_GBL_ALPHA _IOW('F', 0x21, struct mxcfb_gbl_alpha)
|
||||||
|
#define MXCFB_SET_CLR_KEY _IOW('F', 0x22, struct mxcfb_color_key)
|
||||||
|
#define MXCFB_SET_OVERLAY_POS _IOWR('F', 0x24, struct mxcfb_pos)
|
||||||
|
#define MXCFB_GET_FB_IPU_CHAN _IOR('F', 0x25, u_int32_t)
|
||||||
|
#define MXCFB_SET_LOC_ALPHA _IOWR('F', 0x26, struct mxcfb_loc_alpha)
|
||||||
|
#define MXCFB_SET_LOC_ALP_BUF _IOW('F', 0x27, unsigned long)
|
||||||
|
#define MXCFB_SET_GAMMA _IOW('F', 0x28, struct mxcfb_gamma)
|
||||||
|
#define MXCFB_GET_FB_IPU_DI _IOR('F', 0x29, u_int32_t)
|
||||||
|
#define MXCFB_GET_DIFMT _IOR('F', 0x2A, u_int32_t)
|
||||||
|
#define MXCFB_GET_FB_BLANK _IOR('F', 0x2B, u_int32_t)
|
||||||
|
#define MXCFB_SET_DIFMT _IOW('F', 0x2C, u_int32_t)
|
||||||
|
#define MXCFB_CSC_UPDATE _IOW('F', 0x2D, struct mxcfb_csc_matrix)
|
||||||
|
#define MXCFB_SET_GPU_SPLIT_FMT _IOW('F', 0x2F, struct mxcfb_gpu_split_fmt)
|
||||||
|
#define MXCFB_SET_PREFETCH _IOW('F', 0x30, int)
|
||||||
|
#define MXCFB_GET_PREFETCH _IOR('F', 0x31, int)
|
||||||
|
|
||||||
|
/* IOCTLs for E-ink panel updates */
|
||||||
|
#define MXCFB_SET_WAVEFORM_MODES _IOW('F', 0x2B, struct mxcfb_waveform_modes)
|
||||||
|
#define MXCFB_SET_TEMPERATURE _IOW('F', 0x2C, int32_t)
|
||||||
|
#define MXCFB_SET_AUTO_UPDATE_MODE _IOW('F', 0x2D, __u32)
|
||||||
|
#define MXCFB_SEND_UPDATE _IOW('F', 0x2E, struct mxcfb_update_data)
|
||||||
|
#define MXCFB_WAIT_FOR_UPDATE_COMPLETE _IOWR('F', 0x2F, struct mxcfb_update_marker_data)
|
||||||
|
#define MXCFB_SET_PWRDOWN_DELAY _IOW('F', 0x30, int32_t)
|
||||||
|
#define MXCFB_GET_PWRDOWN_DELAY _IOR('F', 0x31, int32_t)
|
||||||
|
#define MXCFB_SET_UPDATE_SCHEME _IOW('F', 0x32, __u32)
|
||||||
|
#define MXCFB_GET_WORK_BUFFER _IOWR('F', 0x34, unsigned long)
|
||||||
|
#define MXCFB_SET_TEMP_AUTO_UPDATE_PERIOD _IOW('F', 0x36, int32_t)
|
||||||
|
#define MXCFB_DISABLE_EPDC_ACCESS _IO('F', 0x35)
|
||||||
|
#define MXCFB_ENABLE_EPDC_ACCESS _IO('F', 0x36)
|
||||||
|
#endif
|
62
user/rm-utils/xorg.conf
Normal file
62
user/rm-utils/xorg.conf
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
Section "ServerLayout"
|
||||||
|
Identifier "reMarkable Tablet RM100"
|
||||||
|
Screen 0 "Screen0"
|
||||||
|
InputDevice "wacom" "CorePointer"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "ServerFlags"
|
||||||
|
Option "BlankTime" "0"
|
||||||
|
Option "StandbyTime" "0"
|
||||||
|
Option "SuspendTime" "0"
|
||||||
|
Option "OffTime" "0"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "Monitor"
|
||||||
|
Identifier "Monitor0"
|
||||||
|
DisplaySize 210 158 # mm, sets DPI
|
||||||
|
Modeline "1872x1404_30.00" 104.26 1872 1960 2152 2432 1404 1405 \
|
||||||
|
1408 1429 -HSync +Vsync
|
||||||
|
Option "PreferredMode" "1872x1404_30.00"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "Screen"
|
||||||
|
Identifier "Screen0"
|
||||||
|
Monitor "Monitor0"
|
||||||
|
Device "epdc0"
|
||||||
|
DefaultDepth 16
|
||||||
|
SubSectionSub "Display"
|
||||||
|
Depth 16
|
||||||
|
Modes "1872x1404_30.00"
|
||||||
|
EndSubSection
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "Device"
|
||||||
|
Identifier "epdc0"
|
||||||
|
Driver "fbdev"
|
||||||
|
Option "fbdev" "/dev/fb0"
|
||||||
|
Option "Rotate" "CW"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputDevice"
|
||||||
|
Identifier "wacom"
|
||||||
|
Driver "evdev"
|
||||||
|
Option "Protocol" "Auto"
|
||||||
|
Option "Device" "/dev/input/event0"
|
||||||
|
Option "SwapAxes" "1"
|
||||||
|
Option "InvertY" "1"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "touchscreen"
|
||||||
|
MatchIsTouchscreen "on"
|
||||||
|
MatchDevicePath "/dev/input/event1"
|
||||||
|
Driver "libinput"
|
||||||
|
Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1" # Rot 180
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "facialbuttons"
|
||||||
|
MatchIsKeyboard "on"
|
||||||
|
MatchDevicePath "/dev/input/event2"
|
||||||
|
Driver "libinput"
|
||||||
|
EndSection
|
Loading…
Reference in a new issue