Skip to content

Instantly share code, notes, and snippets.

@NikkSaan
Last active April 2, 2021 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NikkSaan/b8dec1ddb368e0d8ea7b413d8533e2ef to your computer and use it in GitHub Desktop.
Save NikkSaan/b8dec1ddb368e0d8ea7b413d8533e2ef to your computer and use it in GitHub Desktop.
++ Project n900
++ Developer's Journal
++ For projects goals, refer to the last entry of the this document.
DAY ONE 10 Dec 2017 @ 04:30
Wireless is now working!
By disabling wpa_supplicant service.
# rc-update del wpa_supplicant
! Device died after first wireless attempt.
Might be low battery, and nothing to do with wlan0.
^ Confirmed, it was the battery!
REMOTE CONNECTION 10 Dec 2017 @ 19:22
* Secure Shell successfull!
* Secure Copy successfull!
"scp" and "cp" share sintaxis!
# scp user@host:/path/to/file /path/to/destination
+ Enabled display turning on/off by keypad slide open/close.
Implemented in /etc/acpi/handler.sh
...
display_on {
echo 0 > /sys/devices/platform/omapdrm.0/graphics/fb0/blank
}
...
case $cmd in
KP_SLADE_OPEN)
display_on
...
! Battey's companion fuel gauge IC does not show capacity.
Possible fix is to cycle the battery once.
^ It worked! ...
Fuel gauge calibrated, now reports correct battery charge.
+ Light Sensor descovered!
Here: # /sys/bus/i2c/drivers/tsl2563/2-0029
Note: Data needs to be queryed. It is NOT exposed as an event!
AUDIO INTERNALS 11 Dec 2017 @ 20:00
* twl4030 aka GAIA.
Power management unit (PMIC), keyboard matrix decoder, also
handles power and volume keys. The reason for adding it here is
that there is some sort of audio subsystem buitlt into it and
some audio related componets are connected to it's general
purpouse input outputs.
* TLV320AIC34 Stereo audio codec.
* Si4713 FM transmitter.
Connected to the same Line Out signals of TLV320AIC34
as the headphone amplifier, but can be disabled.
* TPA6130 headphone amplifier.
Still can't make sence of ALSA, ASoC, etc. Maybe Meemo Pulse Audio
config and some reading will help in the future. For now,
work on audio is postponed.
[x] Write a battery monitoring script to turn the device off when
battery is about to run out. This way the device won't just die.
DONE!
+ Battery monitoring script added.
Every 60s it reads battery status and capacity, after which it
desides whether to alert by means of a red, blinking status light,
or power off the device completely. Possible improvement could be to
program the led driver so that ~it~ will blink the light, not the cpu.
Started populating a rootFs-style direcory containing all the files I have
either created or modified. One day this could prove very usefull.
LITTLE ADVANCEMENTS 12 Dec 2017 @ 02:45
[x] Create a battery monitoring service.
+ Battery monitoring service added.
Runs "/sbin/n900-battery-monitor" upon system init. The service itself
lives in "/etc/init.d/n900-battery-monitor". Seems to be working but
both scripts are very ugly and need improvement.
I found info on programming LP5523 for notification leds. That will
unload the processor of the task of blinking the notification leds.
[x] Figure out ssh login keys.
Trying to setup FTP, I learned that I should use "inetd" to listen on
port 21, which directs the trafic to ftpd. When I tryed starting inetd
service however, it crashed!
MORE MINOR IMPROVEMENTS 14 Dec 2017 @ 6:47
+ Added a script to control keypad's backlight
# /sbin/n900-keypad-backlight {on|off}
+ Battery Monitoring service replaced by inittab entry
It is much simpler. Soon it will be superseeded anyway.
Done some reaserch on how to rewrite the battery monitor. Intended to
be much more efficient, the script will only be glue logic. No more
timers, no more blinking-LED loops.
15 Dec 2017 @ 11:27
LIRC is not packaged for alpine. Enabling Infrared Remote functionality
becomes a matter of compiling.
¡ setterm controls the terminal's properties.
Sleep timer, colors, cursor, etc.
[x] Fix inetd service crashing
The problem in inetd reported as crashing is in openrc, and not in the
daemon started. I'm closeing the issue, as I'm not going to spend time
activelly trying to fix it.
SOUND MASTER 16 Dec 2017 @ 5:30
"icrond" cannot be used monitor sysfs. Therefore, it can't be used to
track the power status of the device. However, udev rules can!
Finally managed to get automatic wifi connection.
The solution was to do:
# wpa_passphrase <SSID> > /etc/wpa_supplicont/wpa_supplicant.conf
and leave everything else as it was.
Heaphones are working
From a state of all 'off' and 'mute'...
* PCM ( Volume ) [ to taste ]
* Line ( Switch ) { on }
* Right DAC MUX ( Mux ) [ DAC_R3 ] <--o Choosing DAC_x3 for
* Left DAC MUX ( Mux ) [ DAC_L3 ] <-/ performance reasons.
* TPA6130A2 [...] ( Volume ) [ to taste ]
* Jack Function ( Switch ) { !off }
Question reamains wheather to control volume trough the
heaphone amp or PCM.
~ FM Transmitter is partially working
Most of what alsamixer shows is not connected on the board! Very few
actually are.
USB GADGET 17 Dec 2017 @ 10:17
Exposing internal EMMC as a usb drive available by
# echo /dev/mmcblk1 > /sys/devices/platform/68000000.ocp/480ab000. \
usb_otg_hs/musb-hdrc.0.auto/gadget/lun0/file
FIRST KERNEL PANIC 18 Dec 2017 @ 07:00
Sent the firs infrared signal, unfotunatelly followed by a kernel
panic. The command was:
# ir-ctl -S rc5:0x1e01
This is good and bad. It means there is a program to make use of lirc,
but it also causes a kernel panic. Investigation goes on...
AUDIO MASTER 18 Dec 2017 @ 14:27
Made sugnificant advancements in the feald of audio. After reading
the codec's datasheet, its driver, and the one on RX-51's audio
implementation, I now have a better understanging of this intricate
subsystem. There is still, however, a long way to go...
+ Switching between Speakers <-> Heaphones output added
# alsactl restore -f /var/lib/alsa/asound.state.<output>
This is somewhat primitive and has some "pops" asociated with it.
Perhaps setting some other values might help.
MAC <-> RX-51 20 Dec 2017 @ 15:40
+ Wrote a basic rsync to manage music tranfers.
TO DOs - DONE 21 Dec 2017 @ 08:35
[x] Start dvtm after log-in
[x] Focus key > Play/Pause
[x] Volume keys > Volume control
Bluetooth and FM Radio are on the same chip - BCM2048
hci_nokia and radio-bcm2048 implement the board drivers, but firmware
is closed source and missing. Both functions are not woriking!
[x] Remap media keys keys
# loadkeys -b rx51_us_alt.map > rx51_us_alt.bmap
# gzip rx51_us_alt.bmap
# cp rx51_us_alt.bmap.gz /usr/share/bkeymaps/us/
# sudo setup-keymap
Vol up, Vol down have been succssfully remaped, others - shutter,
wake/sleep, have not!
AFTER TIME Between 21 Dec 2017 and 14 Feb 2018
Alot of progress has been made:
[x] Compiled a cross-compilation toolchain arm-linux-musleabihf
[x] Compiled Qt for cross-compilation
[x] Set up Qt Creator for Embedded Devices
Working on getting started with GUI developement.
GUI IS FAST WITH CAVEATS 24 Feb 2018 @ 07:40
Using MESA's opengl llvmpipe software resterizer is slow on low-end HW.
The solution is to use QPainter as a back-end to QtQuick 2+ by setting:
QT_QUICK_BACKEND=software
This way, both the compositor, and clients open super fast. But there
are problems. Too many animations lock rendering, QT Quick Video is not
supported and, shurelly, many more... This is a temporary solution.
Looking forward to seeing PowerVR drivers...
+ Added npush - tool for simple file transfer to the device
MIGRATION 27 Feb 2018 @ 15:30
Migrating development envirionment from vm-based to native.
So far :
[x] crosstool-ng is working. Only gdb couldn't compile.
[x] Native cross-toolchain is in place.
LINUX<->UI INTERFACING 09 Apr 2018 @ 17:10
Homescreen now shows battery status and charging indicator, can receave
gpio-keys events, and proximity sensor is working.
[x] Pocket detection implemented
Realtime clock at /dev/rtc0 is on twl4030 and allows waking the device
from sleep, poweroff states.
Control is trough:
# rtcwake
or, even better,
# echo TIME_IN_FUTURE_SINCE_EPOCH > /sys/class/rtc/rtc0/wakealarm
To set new wakealarm time, first reset time to 0!
# echo 0 > /sys/class/rtc/rtc0/wakealarm
[x] Look into linux power states
Available modes are Suspend to Memory, Power Off completely and idle
[x] Prevent certain events from waking the screen
TASKS 12 Apr 2018 @ 18:39
After a recent pmos upgrade, audio stoped working.
[!] Get audio working again
Reinstaling did not fix it.
! I still can't get busybox's ftp authenticated logins to work,
only anonymous. Applet might be compiled this way.
First contirbution to pmos wiki, and participation in pmbootstap's
github discussion... Takes me away from developement.
[x] Inspect pmos' initram disk
Not interested in anything done in initramfs.
Mark for removal!? Yes, please!
MIGRATION IN PROGRESS 15 Apr 2018 @ 04:06
[~] Keep migrating dev envirionment - from guest to host
[x] npush and npull are now rsync based.
They work, but need more testing!
NEW MOON 16 Apr 2018 @ 04:00
Migration is slow and tedious!
* Added a QML deploy system for sublime
* sublimeOnSaveBuild runs the deploy-system on save
MIGRATION POSTPONED (AGAIN) 17 Apr 2018 @ 12:43
Well, that!
AUDIO BACK AGAIN 18 Apr 2018 @ 12:43
[x] Get audio working once more.
Compiled a newer kernel 4.16.2.
! Acording to some, it may break in 4.17
dmesg shows signs of Bluetooth, but bluetoothctl doesn't find any
controllers. Still needs firmware, I presume!?
RUN TO MEESO 28 Apr 2018 @ 18:00
First ever cold-boot to Meeso Runtime
Using the least possible services in the default runlevel,
* power on took 60s
~06s board and u-boot
~14s linux
~10s initramfs
~23s openrc
~07s runtime
* power off took 10s
~10s openrc
It turns out that having an init system may come in handy.
PROJECT SPLIT 16 Dec 2018 @ 12:30
Meeso has been split:
* All scripted files are handled under MacOS
* All compiled madules, including Runtime, are still in a Linux VM
UPDATES 17 Dec 2018 @ 02:18
[~] Add 'QML -> Notification Light' Control Interface
! It's very basic, and ugly. FIXIT
[x] Reboot-persistent system clock
FMTX 09 Feb 2019 @ 21:18
[x] Added _almost_ full support for the FM Transmitter.
Now Working:
* On
* Off
* Setting frequency and other paremeters
Not Working:
! Getting frequency noise level for automatic selection of
the best tune frequency. Cannot be done because it is not
supported by the driver (I think).
! Setting RDS Text - v4l2-ctl just seg-faults.
[x] Improved n900-media
* Added new output: FMTX
* Integrated into Meeso.
MESSIN 'ROUND 16 Apr 2019 @ 15:57
i More power/performance options discovered.
Governor and custom min/max cpu frueq can be set here:
# ls /sys/devices/system/cpu/cpufreq/policy0/
i Monitoring gpio can be done by:
# cat /sys/kernel/debug/gpio
...
+ Added an Analag To Digital monitoring system for aid in implementing
inline headset media controlls.
# /tests/twl_madc_readouts.sh
SYSTEM UPGRADE / MEESO BROKE 22 Apr 2019 @ 02:11
! Alpine/PMOS Updgrade broke Meeso. Python modules dissapeared.
Qt broke. System Upgrade did not finish with code 0.
After a few hours everything seem to be back to normal, but Meeso
should be made more resillient to system upgrades until Meeso gets its
own firmware.
MEESO ON X11 24 Apr 2019 @ 05:05
Greatelly improved Runtime's launcher script `/Meeso/run`.
In now supports passing a `-p <opt>` for choosing which Qt QPA Runtime
should start on. Also, there is a `-d` for increasing verbosity,
which is usefull to for Qt QPA Debugging.
Meeso works better in X11.
Besides the slower start and the unconfigured 'alt' key, animations
run smoother and display wakes up faster.
[x] Realtime Clock Improvements
Clock gets set by `/Meeso/init`. It's still a bit unreliable.
CUSTOM FIRMWARE v0 07 Jun 2019 @ 16:26
[x] Ditching PMOS and starting a buildroot-based firmware for the
Nokia n900 and Meeso.
[x] All possible migration done.
Buildroot-based Firmware OS is in VM
Meeso + Scripted parts of Firmware is in MacOs
USB NETWORKING 08 Jun 2019 @ 18:38
[x] Get USB to Ethernet Adapter working
Steps to get the gaget up, configure:
/etc/network/interfaces such that, usb0 has,
address of 172.16.42.1
netmask of 255.255.255.0
[x] Get SSH working
[x] Add ti-conectivity proprietary firmware
WATCHDOG 09 Jun 2019 @ 23:40
The watchdog timer kept resetting the board until `twl4030_wdt` was
eather modprobed or compiled in.
Worked towards removing udev from the init stage by compiling the most
crucial drivers in-kernel. Soon all unpluggleble harware will be
compiled in or carefully initialized by 'hand'.
FIRMWARE v.2 10 Jun 2019 @ 20:58
Version .2 comes with
* NEON and THUMB 2 extentions
* leaner, lzo-compressed kernel
* fresh rootfs and host overlay tools
SECOND RUN TO MEESO 12 Jun 2019 @ 02:57
Improved v.2, really happy, so far:
* Faster, quieter boot str8 into /bin/sh.
Showing only error messages.
* Custom inittab, not using /etc/init.d/runS. Simply running the
init scripts I need, while keeping the rest on stand-by.
UTF-8 12 Jun 2019 @ 02:57
* Rebuild busybox with unicode support by following the alpine bbconfig.
* Also added utf-8 as a default option for vfat mounts.
+ Included a script to manage `MyDocs` partition, called `/bin/library`.
FIXES & IMPROVEMENTS 15 Jun 2019 @ 06:12
Kerenl will panic if it tries to mount root partition before it's
being registered. This is because the kernel discovers EMMC devices
asynchronosly. Resolve it by adding `rootwait` cmd-line parameter.
CONTINUED 16 Jun 2019 @ 02:40
[x] Find another way to monitor battery/charger.
+ Added initial replacement for hotplug / battery monitoring
solutions. Located in `/sbin/hotplug.sh`, it gets called by the
kernel with info about device changes, passed in env. vars.
[x] Checked out `make busybox-menuconfig`, added a few applets. Sadly,
! there is no `make save-busybox-config`
PARTING WAYS WITH TRADITION 17 Jun 2019 @ 13:22
MILESTONE : NO BOOT/INIT MESSAGES
* Made Firmware boot quietly by default.
* Improved Runtime's build and install process.
* Camelcase'd all of Firmware's init scripts to look
more elegant, while also keeping Busybox init compatability.
+ Added a script to start a User Interface, and switch between
its GUI and TUI modes... when one exits, the other one enters.
+ Appended a `-q` option in `/Meeso/run` to supress Runtime messages.
+ Added U-Boot to
[x] Start the system in dev mode
* verbose kernel and init
* run Shell
[x] Start the system in user mode
* super quiet stack: kernel, init and Runtime
* run Meeso
CORNHOLE-ING 19 Jun 2019 @ 05:38
[x] A hotplug script triggered by a kernel event sending a power
change event to a named pipe while meeso is waiting on the other
side listenig for changes and setting its power related properties.
This is MAILBOX: a named pipe for sending notifications to Meeso!
- Removed battery protection script. Hotplug script powers off the
devece when charge level drops below 2% and charger is not plugged.
REFINEMENTS 21 Jun 2019
Having been refining Meeso for the past few days. The ToolBinder has
been rewritten, and new ideas are taking shape.
[x] Improved screen wakeup time by running Runtime on KMS Framebuffer.
========================== EVERY DAY CARRY =============================
PROJECT GOALS
R&D on a Digital Swiss Army Knife based on Nokia's RX-51 platform.
Initially running in PMOS, now running on a custom firmware.
ONGOING TASKS
* Keep archiving n900 resources from the web.
TODO @ Firmware
[~] Buildroot Board Support Package for n900
[+] wireless lan firmware ti-firmware added
[~] Simple Init ( Simply Init ) Fast init system/script
[?] Rootfs check
[x] Battery protection
[x] Starting the system in dev mode
* verbose kernel and init
* drop to a shell
[x] Starting the system in user mode
* super quiet kernel and init
* run Meeso
TODO @ Meeso
[ ] Fix a bug where the screen will not power down
if you enter Meeso with the keypad closed.
[ ] Look into properly stopping Runtime from printing to tty
[x] Battery information in Meeso is provided by `System/power.py`,
that works great, but it depend on the system having udev support,
plus pyudev module and udevd running... Too much for just
simple battery and charger indicatiors.
What we can do is have a hotplug script triggered by the a kernel
event, sending a power change event to a named pipe while meeso
is waiting on the other side, listenig for changes and acting.
This is Meeso MAILBOX: a named pipe for sending data to Meeso!
[ ] Make Meeso more resilient to system upgrades.
[ ] Compile Qt and Meeso statically.
[ ] Add python3 library and necessery modules to pyotherside. Maybe!
[ ] Reboot-persistent IP address
! Wireless assignes a new mac address after reboot.
Setting wireless mac address can be done thru sysfs!
[ ] Try IR again. [ ] Get it working!
Maybe compile LIRC ?
[!] Heaphone media controls
! not supported out of the box, however...
... an ADC readout of GPIO 2 of twl4030 should give as a voltage
readout which can then be mapped to a key action. Seems that analog
write with value of 0 on GPIO 182 could could unlock the functionality.
More documentation is available as comments in the gpio monitaring
program used for testing, so do:
# cat /tests/twl_madc_readouts.sh
Or run the program to follow voltages.
[ ] Figure out the dreaded libio. It will unlock auto-brightess as well as,
when supported, heaphone media controls.
[!] Get the GPU Working aka Meeso on EGLFS
! Not possible because powervr drivers are unavailable
* Omap Drm/Kms Alpine Help
https://github.com/postmarketOS/pmbootstrap/issues/536
[ ] Meeso WiFi control
* wpa_supplicant
http://w1.fi/cgit/hostap/plain/wpa_supplicant/README
[ ] Unison to replace rsync when bi-direction sync is needed
RESERCH THIS
* gadgetfs
* look into python services
* using overlafs
* qt configure list-features
LINKS
* Maemo Leste OS. Has some hardware support info
https://leste.maemo.org/Nokia_N900
https://github.com/maemo-leste
* Disable display sleep under X
https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling
* syncthing,
SHOW OFF
* Slider controlled Keypad and Screen Backlight
* Proximity sensor / Pocket Detection
* Sleep Mode and Indicator
* Internal Storage / Audio library
* Music Playback
* Calendar, Terminal and Multiplexing, Kernel version
* Battery Level / Charger Detection
* Headphone Detection / Auto audio output switching
SYMBOLS USED
[ ] task pending
[x] task finished
[~] task more-or-less finished, work-in-progress
[!] task cannot be completed yen
- somethig removed
+ somethig added
~ something more-or-less working
! error, warning, attention
* list entry
$ command line as regular user
# command line as root user
ARROWS
something <--------o Reffering to 'somethig',
something else <--/ and 'somethig else'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment