Skip to content

Instantly share code, notes, and snippets.

@MMcM
Last active May 29, 2023 05:23
Show Gist options
  • Save MMcM/0c149d7ba83fffdd5f5081b334ed5865 to your computer and use it in GitHub Desktop.
Save MMcM/0c149d7ba83fffdd5f5081b334ed5865 to your computer and use it in GitHub Desktop.
CoreELEC on M92S PLUS

A cheap Android TV Box from a few years ago.

The standard CoreELEC works with gxm_q200_2g, except the clock and remote.

The clock itself works as an m82, but not the dots.

  • The GPIOs are correct and it is transposed.
  • But the common anode transposed grids and segments put the dots not at the last segment #8 (decimal point) but at the first segment #1.
  • If it were possible to say 7 in vfd_chars, that would work, but the array isn't that long.
  • Since it isn't possible to have anything in that bit, a patch to make the first and last segments be the same works instead.
  • Finally vfd_dot_bits needs to be adjusted to swap alarm and eth, and usb and wifi.

The remote is similar to one from other such boxes, but not quite the same as anything in the database.

# table M92S, type: NEC
0x140 KEY_POWER
0x1f1 KEY_POWER # TV Control - Power
0x1f2 KEY_CONFIG # TV Control - Set
0x1f3 KEY_HOMEPAGE # TV Control - TV In
0x1f4 KEY_VOLUMEDOWN # TV Control - Vol-
0x1f5 KEY_VOLUMEUP # TV Control - Vol+
0x14b KEY_PREVIOUSSONG
0x14f KEY_NEXTSONG
0X10f KEY_WWW
0x143 KEY_HELP
0x118 KEY_VOLUMEUP
0x110 KEY_VOLUMEDOWN
0x111 KEY_HOME
0x119 KEY_BACK
0x116 KEY_UP
0x151 KEY_LEFT
0x113 KEY_ENTER
0x150 KEY_RIGHT
0x11a KEY_DOWN
0x14c KEY_MENU
0x100 KEY_CONTEXT_MENU
0x14e KEY_1
0x10d KEY_2
0x10c KEY_3
0x14a KEY_4
0x109 KEY_5
0x108 KEY_6
0x146 KEY_7
0x105 KEY_8
0x104 KEY_9
0x101 KEY_0
0x141 KEY_MUTE
0x142 KEY_BACKSPACE
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Arthur Liberman (arthur_liberman@hotmail.com)
PKG_NAME="openvfd-driver"
PKG_VERSION="917e6e29a39633841268c08961097cf87aec38e6"
PKG_SHA256="8ffbfee8793929fab3391d3b48b7ec1c99c6558c6a1ea53864f09968fcb65ffd"
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPLv3"
PKG_SITE="https://github.com/MMcM/linux_openvfd"
PKG_URL="https://github.com/MMcM/linux_openvfd/archive/$PKG_VERSION.tar.gz"
PKG_SOURCE_DIR="linux_openvfd-$PKG_VERSION*"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_LONGDESC="openvfd-driver: an open source Linux driver for VFD displays"
PKG_TOOLCHAIN="manual"
pre_make_target() {
unset LDFLAGS
}
make_target() {
make ARCH=$TARGET_KERNEL_ARCH \
CROSS_COMPILE=$TARGET_KERNEL_PREFIX \
-C "$(kernel_path)" M="$PKG_BUILD/driver"
make OpenVFDService
}
makeinstall_target() {
mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME
find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \;
mkdir -p $INSTALL/usr/sbin
cp -P OpenVFDService $INSTALL/usr/sbin
}
post_install() {
enable_service openvfd.service
}
# Keymaps table
#
# This table creates an association between a keycode file and a kernel
# driver. It can be used to automatically override a keycode definition.
#
#
# Format:
# driver - name of the driver provided via uevent - use * for any driver
# table - RC keymap table, provided via uevent - use * for any table
# file - file name. If directory is not specified, it is first looked up
# in /storage/.config/rc_keymaps, then /usr/lib/udev/rc_keymaps
#
# For example:
#
# driver table file
#
# gpio-rc-recv rc-streamzap streamzap
# gpio-rc-recv * justboom
# * rc-rc6-mce rc6_mce_new
# * * hauppauge_new
meson-ir * m92s
#!/bin/bash
# Run outside CoreELEC.
source vfd.conf
insmod ../linux_openvfd/driver/openvfd.ko vfd_gpio_clk=${vfd_gpio_clk} \
vfd_gpio_dat=${vfd_gpio_dat} \
vfd_gpio_stb=${vfd_gpio_stb:-0,0,0xFF} \
vfd_gpio0=${vfd_gpio0:-0,0,0xFF} \
vfd_gpio1=${vfd_gpio1:-0,0,0xFF} \
vfd_gpio2=${vfd_gpio2:-0,0,0xFF} \
vfd_gpio3=${vfd_gpio3:-0,0,0xFF} \
vfd_gpio_protocol=${vfd_gpio_protocol:-0,0} \
vfd_chars=${vfd_chars} vfd_dot_bits=${vfd_dot_bits} \
vfd_display_type=${vfd_display_type}
../linux_openvfd/OpenVFDService
# This file must be renamed to vfd.conf and placed in the /storage/.config/ folder.
#
# M92S configuration
#--------------------
#gpio_xxx:
# [0] 0 = &gpio, 1 = &gpio_ao.
# [1] pin number - https://github.com/openSUSE/kernel/blob/master/include/dt-bindings/gpio/meson-gxl-gpio.h
# [2] Reserved - must be 0.
vfd_gpio_clk='0,74,0'
vfd_gpio_dat='0,73,0'
vfd_gpio_stb='0,69,0'
#chars:
# < DHHMM > Order of display chars (D=dots, represented by a single char)
vfd_chars='0,3,4,5,6'
#dot_bits:
# Order of dot bits. Typical configurations:
# Display Type 0, 1 usually has Alarm, USB, Play, Pause, Col, Ethernet, Wifi dots
# Alarm = 0, USB = 1, Play = 2, Pause = 3, Col = 4, Eth = 5, Wifi = 6
# Display Type 2 usually has APPS, USB, SETUP, CARD, Col, HDMI, CVBS dots
# APPS = 0, USB = 1, SETUP = 2, CARD = 3, Col = 4, HDMI = 5, CVBS = 6
# Display Type 3 Power, LAN, Col, Low Wifi, High Wifi
# N/A = 0, N/A = 1, Power = 2, LAN = 3, Col = 4, Low Wifi = 5, High Wifi = 6
vfd_dot_bits='5,6,2,3,4,0,1'
#display_type:
# [0] - Display type.
# [1] - Reserved - must be 0.
# [2] - Flags. (bit 0 = '1' - Common Anode display, bits [1-7] - Reserved.)
# [3] - Controller.
vfd_display_type='0x00,0x00,0x01,0x00'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment