Liste des commandes de controle e-ink
[root@kobo ~]# fbdepth
FBDepth (via FBInk v1.24.0-78-g69a7f10 for Kobo)
Usage: fbdepth [-d] <bpp> [-r] <rota>
Tiny tool to set the framebuffer bitdepth and/or rotation on eInk devices.
OPTIONS:
-d, --depth <8|16|24|32>
Switch the framebuffer to the supplied bitdepth.
-h, --help
Show this help message.
-v, --verbose
Toggle printing diagnostic messages.
-q, --quiet
Toggle hiding diagnostic messages.
-g, --get
Just output the current bitdepth to stdout.
-G, --getcode
Just exit with the current bitdepth as exit code.
-r, --rota <-1|0|1|2|3>
Switch the framebuffer to the supplied rotation.
-1 is a magic value matching the device-specific Portrait orientation.
-R, --canonicalrota <UR|CW|UD|CCW>
Switch the framebuffer to the supplied canonical rotation (Linux FB convention),
automagically translating it to the mangled native one.
(i.e., requesting UR will ensure the device is actually UR, much like passing -1 to -r, --rota would).
-o, --getrota
Just output the current rotation to stdout.
-O, --getrotacode
Just exit with the current rotation as exit code.
-c, --getcanonicalrota
Just output the current rotation (converted to its canonical representation) to stdout.
-C, --getcanonicalrotacode
Just exit with the current rotation (converted to its canonical representation) as exit code.
-H, --nightmode <on|off|toggle>
Toggle hardware inversion (8bpp only, safely ignored otherwise).
[root@kobo ~]# fbink
FBInk v1.24.0-78-g69a7f10 for Kobo
Usage: fbink [OPTIONS] [STRING ...]
Print STRING on your device's screen.
EXAMPLES:
fbink -x 1 -y 10 "Hello World!"
Prints 'Hello World!' on the eleventh line, starting at the second column from the left.
fbink -pmh -y -5 "Hello World!"
Prints 'Hello World!', highlighted (i.e., white on black with the default colors), centered & padded on both sides, on the fifth line starting from the bottom.
fbink -pmM -y -8 "Hello World!"
Prints 'Hello World!', centered & padded on both sides, eight lines above the center of the screen.
Options affecting the message's position on screen:
-x, --col NUM Begin printing STRING @ column NUM (Default: 0).
You might consider beginning at column 1 instead of 0, as column 0 (the leftmost one) may sometimes be slightly obscured by a bezel.
Use a negative value to count back from the right edge of the screen.
-y, --row NUM Begin printing STRING @ row NUM (Default: 0).
You might consider beginning at row 1 instead of 0, as row 0 (the topmost one) may sometimes be slightly obscured by a bezel, especially on Kobos.
Use a negative value to count back from the bottom of the screen.
-X, --hoffset NUM Adjust final text position by NUM pixels on the horizontal axis (Default: 0).
Honors negative values, and will let you push stuff off-screen, often without warning.
-Y, --voffset NUM Adjust final text position by NUM pixels on the vertical axis (Default: 0).
Honors negative values, and will let you push stuff off-screen, often without warning.
-m, --centered Dynamically override col to print STRING at the center of the screen.
Special care is taken to avoid the very edges of the screen, to ensure the complete legibility of the message.
-M, --halfway Dynamically adjust row to print STRING in the middle of the screen.
The value specified in row then becomes an offset, starting from the middle of the screen.
-p, --padded Left pad STRING with blank spaces.
Most useful when combined with --centered to ensure a line will be completely filled, while still centering STRING,
i.e., padding it on both sides.
-r, --rpadded Right pad STRING with blank spaces.
Options affecting the message's appearance:
-h, --invert Print STRING in <background color> over <foreground color> instead of the reverse.
-f, --flash Ask the eInk driver to do a black flash when refreshing the area of the screen where STRING will be printed.
-c, --clear Clear the full screen before printing.
Honors -B, --background; -h, --invert; -H, --nightmode; -W, --waveform; -D, --dither; -b, --norefresh; -w, --wait.
Can be specified on its own, without any STRING.
NOTE: If your intent is to simply clear the screen and *nothing else*, use -k, --cls instead!
-W, --waveform MODE Request a specific waveform update mode from the eInk controller, if supported (mainly useful for images).
Available waveform modes: A2, DU, GL16, GC16 & AUTO
As well as GC4, REAGL & REAGLD. And GU16, GCK16, GLK16 & GCC16 on Mk. 8. And DU4, GCK16 & GLKW16 on Mk. 9.
Unsupported modes *should* safely downgrade to AUTO. Operative word being 'should' ;).
On some devices, REAGL & REAGLD expect to be flashing in order to behave properly.
-D, --dither Request a specific hardware dithering mode from the eInk controller, if supported (mainly useful for images).
Available dithering modes: PASSTHROUGH, FLOYD_STEINBERG, ATKINSON, ORDERED, QUANT_ONLY & LEGACY
Note that this is only supported on recent devices, and that only a subset of these options may actually be supported by the HW (usually, PASSTHROUGH & ORDERED, check dmesg).
LEGACY may be supported on more devices, but what exactly it does in practice (and how well it works) depends on the exact device and/or FW version.
-H, --nightmode Request full hardware inversion from the eInk controller, if supported.
Note that this can be used *in combination* with -h, --invert! One does not exclude the other, which may lead to some confusing behavior ;).
Note that this may be ignored on some specific devices where it is known to be or have been unstable at some point.
-b, --norefresh Only update the framebuffer, but don't actually refresh the eInk screen (useful when drawing in batch).
NOTE: Due to the way buffers are handled on that platform, this will not behave as expected on sunxi SoCs!
-w, --wait Block until the kernel has finished processing the *last* update we sent, if any.
The actual delay depends for the most part on the waveform mode that was used.
See the API documentation around fbink_wait_for_submission & fbink_wait_for_complete for more details.
As a point of reference, eips only does a wait_for_complete after the flashing refresh of an image.
We used to do that by default for *all* flashing updates until FBInk 1.20.0.
-S, --size Override the automatic font scaling multiplier (Default: 0, automatic selection, ranging from 1 (no scaling), to 4 (4x upscaling), depending on screen resolution).
Note that user-supplied values will be clamped to safe boundaries (from 1 to around 45 for most fonts, and from 1 to around 30 for TALL).
The exact upper value depends on the resolution of your screen.
-F, --font NAME Render glyphs from builtin font NAME (Default: IBM).
Available font families: IBM, UNSCII, ALT, THIN, FANTASY, MCR, TALL, BLOCK,
LEGGIE, VEGGIE, KATES, FKP, CTRLD, ORP, ORPB, ORPI, SCIENTIFICA, SCIENTIFICAB, SCIENTIFICAI, TERMINUS, TERMINUSB, FATTY, SPLEEN, TEWI, TEWIB, TOPAZ, MICROKNIGHT, VGA, COZETTE
NOTE: On low dpi, 600x800 devices, ORP or TEWI's form factor may feel more familiar at default scaling.
NOTE: If you're looking for vector font rendering, see the OpenType section a few lines down!
-C, --color NAME Color the text will be printed in (Default: BLACK).
-B, --background NAME Color of the background the text will be printed on (Default: WHITE).
Available colors: BLACK, GRAY1, GRAY2, GRAY3, GRAY4, GRAY5, GRAY6, GRAY7,
GRAY8, GRAY9, GRAYA, GRAYB, GRAYC, GRAYD, GRAYE, WHITE
-o, --overlay Don't draw background pixels, and compute foreground pixel color based on the inverse of the underlying framebufer pixel.
Obviously ignores -h, --invert & -C, --color *as far as glyphs are concerned*.
-B, --background is still honored if you combine this with -c, --clear
-O, --bgless Don't draw background pixels.
Obviously mutually exclusive with -o, --overlay, because it's simply a subset of what overlay does. If both are enabled, -o, --overlay takes precedence.
-T, --fgless Don't draw foreground pixels.
Mutually exclusive with -o, --overlay or -O, --bgless, and takes precedence over them.
NOTE: Due to the way buffers are handled on that platform, -o, --overlay; -O, --bgless and -T, --fgless will not behave as expected on sunxi SoCs!
Options affecting the program's verbosity:
-v, --verbose Toggle printing diagnostic messages.
-q, --quiet Toggle hiding hardware setup messages.
-G, --syslog Send output to syslog instead of stdout & stderr.
Ought to be the first flag passed, otherwise, some commandline parsing errors might not honor it.
Options affecting the program's behavior:
-I, --interactive Enter a very basic interactive mode.
-L, --linecountcode When successfully printing text, returns the total amount of printed lines as the process exit code.
NOTE: Will be inaccurate if there are more than 255 rows on screen!
-l, --linecount When successfully printing text, outputs the total amount of printed lines in the final line of output to stdout (NOTE: enforces quiet & non-verbose!).
NOTE: With OT/TTF rendering, will output a top margin value to use as-is instead (or 0 if there's no space left on screen)!
The OT/TTF codepath also returns more data, including the results of the line-breaking computations, so it's in an eval-friendly format instead.
-E, --coordinates When printing something, outputs the coordinates & dimensions of what was printed to stdout, in a format easily consumable by eval (NOTE: enforces quiet & non-verbose!).
NOTE: For both -l, --linecount & -E, --coordinates, output will only be sent to stdout on *success*. On error, the usual error message is sent to stderr.
Given that, you may want to store stdout only in a variable and check the return code for success before running eval on that var!
-P, --progressbar NUM Draw a NUM% full progress bar (full-width). Like other alternative modes, does *NOT* have precedence over text printing.
Ignores -o, --overlay; -x, --col; -X, --hoffset; as well as -m, --centered & -p, --padded
-A, --activitybar NUM Draw an activity bar on step NUM (full-width). NUM must be between 0 and 16. Like other alternative modes, does *NOT* have precedence over text printing.
NOTE: If NUM is negative, will cycle between each possible value every 750ms, until the death of the sun! Be careful not to be caught in an involuntary infinite loop!
Ignores -x, --col; -X, --hoffset; as well as -m, --centered & -p, --padded
-V, --noviewport Ignore any & all viewport corrections, be it from Kobo devices with rows of pixels hidden by a bezel, or a dynamic offset applied to rows when vertical fit isn't perfect.
NOTES:
You can specify multiple STRINGs in a single invocation of fbink, each consecutive one will be printed on the subsequent line.
Although it's worth mentioning that this will lead to undesirable results when combined with --clear,
because the screen is cleared before each STRING, meaning you'll only get to see the final one.
If you want to properly print a long string, better do it in a single argument, FBInk will do its best to spread it over multiple lines sanely.
It will also honor the linefeed character (and I do mean the actual control character, not the human-readable escape sequence),
which comes in handy when passing a few lines of logs straight from tail as an argument.
-t, --truetype regular=FILE,bold=FILE,italic=FILE,bolditalic=FILE,size=NUM,px=NUM,top=NUM,bottom=NUM,left=NUM,right=NUM,padding=PAD,style=STYLE,format,notrunc,compute
regular, bold, italic & bolditalic should point to the font file matching their respective font style. At least one of them MUST be specified.
size sets the rendering size, in points. Defaults to 12pt if unset. Can be a decimal value.
px sets the rendering size, in pixels. Optional. Takes precedence over size if specified.
top, bottom, left & right set the margins used to define the display area. Defaults to 0, i.e., the full screen, starting at the top-left corner.
NOTE: If a negative value is supplied, counts backward from the opposite edge. Mostly useful with top & left to position stuff relative to the bottom right corner.
padding can optionally be set to ensure the drawing area on both sides of the printed content is padded with the background color on one or both axis.
Available padding axis: HORIZONTAL, VERTICAL, or BOTH (Defaults to NONE). Useful to avoid overlaps on consecutive prints at the same coordinates.
If style is specified, it dictates the default font style to use (e.g., REGULAR, BOLD, ITALIC or BOLD_ITALIC). Defaults to REGULAR.
If format is specified, instead of the default style, the underscore/star Markdown syntax will be honored to set the font style (i.e., *italic*, **bold** & ***bold italic***).
If notrunc is specified, truncation will be considered a failure.
NOTE: This may not prevent drawing/refreshing the screen if the truncation couldn't be predicted at compute time!
On the CLI, this will prevent you from making use of the returned computation info, as this will chain a CLI abort.
If compute is specified, no rendering will be done, and only the line-breaking computation pass will run. You'll generally want to use that combined with -l, --linecount.
Honors -h, --invert; -f, --flash; -c, --clear; -W, --waveform; -D, --dither; -H, --nightmode; -b, --norefresh; -m, --centered; -M, --halfway; -o, --overlay; -T, --fgless; -O, --bgless; -C, --color; -B, --background; -l,
--linecount
EXAMPLES:
fbink -t regular=/mnt/onboard/fonts/NotoSans-Regular.ttf,bold=/mnt/onboard/fonts/NotoSans-Bold.ttf,size=24,top=100,bottom=500,left=25,right=50,format "Hello **world**!"
Will use NotoSans to print 'Hello world!' at 24pt in a display area starting from 100px down the top of the screen to 500px before the bottom of the screen,
from 25px of the left edge of the screen until 50px before the right edge.
Honoring the Markdown syntax, 'Hello' will be printed with the Regular font style, while 'world' will use the Bold font style.
NOTE: You will NOT be able to use obfuscated or encrypted fonts.
Please note that this means you will NOT be able to use system fonts, because they're all obfuscated.
You can also eschew printing a STRING, and simply refresh the screen as per your specification, without touching the framebuffer:
-s, --refresh [top=NUM,left=NUM,width=NUM,height=NUM]
EXAMPLES:
fbink -s top=20,left=10,width=500,height=600 -W GC16 -D ORDERED
Refreshes a 500x600 rectangle with its top-left corner at coordinates (10, 20) with a GC16 waveform mode and ORDERED hardware dithering.
NOTES:
The specified rectangle *must* completely fit on screen, or the ioctl will fail.
Note that this will also honor -W, --waveform; -H, --nightmode & -f, --flash
Note that the arguments are passed as-is to the ioctl, no viewport or rotation quirks are applied!
If you just want a full-screen refresh (which will honor -f, --flash), don't pass any suboptions,
e.g., fbink -s (if you group short options together, it needs to be the last in its group, i.e., -fs and not -sf).
NOTE: Due to the way buffers are handled on that platform, this will not behave as expected on sunxi SoCs!
You'll just end up with solid black inside your refresh region.
Specifying one or more STRING takes precedence over this mode.
A variant of the above allows you to also clear specific rectangular regions of the screen:
-k, --cls [top=NUM,left=NUM,width=NUM,height=NUM]
Clear the screen (or a region of it), and abort early.
Honors -B, --background; -h, --invert; -H, --nightmode; -W, --waveform; -D, --dither; -b, --norefresh; -w, --wait.
This takes precedence over *everything* and will abort as soon as it's done.
If you just want a full-screen clear (which will honor -f, --flash), don't pass any suboptions,
e.g., fbink -k (if you group short options together, it needs to be the last in its group, i.e., -fk and not -kf).
You can use this to effectively paint arbitrary background colored rectangular shapes.
You can also eschew printing a STRING, and print an IMAGE at the requested coordinates instead:
-g, --image file=PATH,x=NUM,y=NUM,halign=ALIGN,valign=ALIGN,w=NUM,h=NUM,dither [-i, --img PATH]
Supported ALIGN values: NONE (or LEFT for halign, TOP for valign), CENTER or MIDDLE, EDGE (or RIGHT for halign, BOTTOM for valign).
If dither is specified, *software* dithering (ordered, 8x8) will be applied to the image, ensuring it'll match the eInk palette exactly.
This is *NOT* mutually exclusive with -D, --dither!
w & h *may* be used to request scaling. If one of them is set to 0, aspect ratio will be respected.
Set to -1 to request the viewport's dimension for that side.
If either side is set to something lower than -1, the image will be scaled to the largest possible dimension that fits on screen while honoring the original aspect ratio.
They both default to 0, meaning no scaling will be done.
EXAMPLES:
fbink -g file=hello.png
Displays the image "hello.png", starting at the top left of the screen.
fbink -i hello,world.png -g x=-10,y=11 -x 5 -y 8
Displays the image "hello,world.png", starting at the ninth line plus 11px and the sixth column minus 10px.
fbink -g file=hello.png,halign=EDGE,valign=CENTER
Displays the image "hello.png", in the middle of the screen, aligned to the right edge.
fbink -g file=hello.png -W A2
Displays the image "hello.png", in monochrome.
fbink -i wheee.png
Displays the image "wheee.png" with the default settings.
Options affecting the image's appearance:
-a, --flatten Ignore the alpha channel.
NOTES:
Supported image formats: JPEG, PNG, TGA, BMP, GIF & PNM
Note that, in some cases, exotic encoding settings may not be supported.
Transparency is supported, but it may be slightly slower (because we may need to do alpha blending).
You can use the --flatten flag to avoid the potential performance penalty by always ignoring alpha.
As an additional quirk, you can't pass paths with commas in it to file. Pass those to the -i, --img flag instead.
And if you want to read image data from stdin, make sure to pass "-" as the file name.
This honors -f, --flash, as well as -c, --clear; -W, --waveform; -D, --dither; -H, --nightmode; -b, --norefresh & -h, --invert
Note that this also honors -x, --col & -y, --row (taking -S, --size into account), in addition to the coordinates you specify.
The aim is to make it easier to align small images to text.
And to make pixel-perfect adjustments, you can also specifiy negative values for x & y.
Specifying one or more STRING takes precedence over this mode.
-s, --refresh also takes precedence over this mode.
NOTES:
Shell script writers can also use the -e, --eval flag to have FBInk just spit out a few of its internal state variables to stdout,
e.g., eval $(fbink -e)
NOTES:
For more complex & long-running use-cases involving *text* only (or a progress/activity bar), you can also switch to daemon mode, via -d, --daemon NUM_LINES
It expects a single argument: the amount of lines consecutive prints can occupy before wrapping back to the original coordinates.
It it's set to 0, the behavior matches what usually happens when you pass multiple strings to FBInk (i.e., the only wrapping happens at screen egde).
While, for example, setting it to 1 will ensure every print will start at the same coordinates.
In this mode, FBInk will daemonize instantly, and then print its PID to stdout. You should consume stdout, and check the return code:
if it's 0, then you have a guarantee that what you've grabbed from stdout is *strictly* a PID.
You can then send a kill -0 to that PID to check for an early abort.
By default, it will create a named pipe for IPC: /tmp/fbink-fifo (if the file already exists, whatever type it may be, FBInk will abort).
You can ask for a custom path by setting FBINK_NAMED_PIPE to an absolute path in your environment.
Creating and removing that FIFO is FBInk's responsibility. Don't create it yourself.
Make sure you kill FBInk via SIGTERM so it has a chance to remove it itself on exit.
(Otherwise, you may want to ensure that it doesn't already exist *before* launching a daemon mode session).
With the technicalities out of the way, it's then as simple as writing to that pipe for stuff to show up on screen ;).
e.g., echo -n 'Hello World!' > /tmp/fbink-fifo
Remember that LFs are honored!
Also, the daemon will NOT abort on FBInk errors, and it redirects stdout & stderr to /dev/null, so errors & bogus input will be silently ignored!
It can abort on early setup errors, though, before *or* after having redirected stderr...
It does enforce logging to the syslog, though, but, again, early commandline parsing errors may still be sent to stderr...