Helper Program: Tibbo Device Monitor

One of the biggest problems for the embedded system developers is to debug low-level serial port communication protocols.

Tibbo Device Monitor is a useful and portable part of the IONinja package which can run as a low-level driver/sniffer + agent pair in LTPS.

Tibbo Device Monitor is available as a pre-build ready-to-install package in LTPS repository.

Installation (in CLI mode)

1.1 Open SSH connection for your LTPS box (assuming that your LTPS IP is 192.168.75.218):

[dv@dvh ~]$ ssh root@192.168.75.218
Password:
root@tpp:~#

Factory credentials for SSH are: user:'root', password:'123'.

1.2 Search and install TDevmon package:

root@tpp:~# dnf install tdevmon
Last metadata expiration check: 0:03:58 ago on Fri Sep 22 15:20:05 2017 UTC.
Dependencies resolved.
=============================================================================
 Package   Arch            Version  Repository                          Size
=============================================================================
Installing:
 tdevmon   cortexa8hf_neon 3.2.4-r0 oe-remote-repo-downloads-LTPS-repo 136 k
Installing dependencies:
 kernel-module-tdevmon-4.10.15-tpp
           tpp             3.2.4-r0 oe-remote-repo-downloads-LTPS-repo  21 k
 tdevmon-kernel
           tpp             3.2.4-r0 oe-remote-repo-downloads-LTPS-repo 5.3 k

Transaction Summary
=============================================================================
Install  3 Packages

Total download size: 163 k
Installed size: 382 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): tdevmon-kernel-3.2.4-r0.tpp.rpm        27 kB/s | 5.3 kB     00:00    
(2/3): kernel-module-tdevmon-4.10.15-tpp-3.2  68 kB/s |  21 kB     00:00    
(3/3): tdevmon-3.2.4-r0.cortexa8hf_neon.rpm  316 kB/s | 136 kB     00:00    
-----------------------------------------------------------------------------
Total                                        326 kB/s | 163 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Installing  : kernel-module-tdevmon-4.10.15-tpp-3.2.4-r0.tpp           1/3 
warning: Unable to get systemd shutdown inhibition lock: The name org.freedesktop.login1 was not provided by any .service files
  Installing  : tdevmon-kernel-3.2.4-r0.tpp                              2/3 
  Installing  : tdevmon-3.2.4-r0.cortexa8hf_neon                         3/3 
  Verifying   : tdevmon-3.2.4-r0.cortexa8hf_neon                         1/3 
  Verifying   : tdevmon-kernel-3.2.4-r0.tpp                              2/3 
  Verifying   : kernel-module-tdevmon-4.10.15-tpp-3.2.4-r0.tpp           3/3 

Installed:
  tdevmon.cortexa8hf_neon 3.2.4-r0                                           
  kernel-module-tdevmon-4.10.15-tpp.tpp 3.2.4-r0                             
  tdevmon-kernel.tpp 3.2.4-r0                                                

Done!

Installation (in GUI mode)

2.1 Open LTPS web interface in your favourite browser (assuming that your LTPS IP is 192.168.75.218 at http://192.168.75.218/).

Factory credentials for web interface are: user:'admin', password:'123'.

2.2 Go to 'Packet Manager' (in the left menu) and search for 'tdevmn' package.

2.3 Click on 'Install' in front of 'tdevmon' package and wait for a while.

Done!

Usage

Load the kernel module and check for the device file:

root@tpp:~# modprobe tdevmon permissions=0666
root@tpp:~# ls -l /dev/tdevmon 
crw-rw-rw- 1 root root 244, 0 Sep 22 15:29 /dev/tdevmon

Check for the driver working capacity:

root@tpp:~# tdevmon --stats
tdevmon.ko stats:
Total devices:    0
Connections:      0

Run sniffer on /dev/ttyO0 (OS console):

root@tpp:~# tdevmon --monitor /dev/ttyO0 
Monitoring /dev/ttyO0 (module: <unknown>), hit Ctrl+C to interrupt...

15:30:45.132 write
    pid:             22191
    tid:             22191
    result:          1
    file id:         00000000de7ce480
    offset:          0
    buffer size:     1
    data size:       1

    0000  0a                                               

15:30:45.132 unlocked_ioctl
    pid:             22191
    tid:             22191
    result:          0
    file id:         00000000de7ce480
    ioctl code:      00005403
    ioctl arg:       00000000beac124c
....

And so on...

Now it works. It hooks up the serial interface low-level functions and sends information about data flow to the controlling terminal. Don't forget to "unhook" the functions as soon as you finish debugging:

root@tpp:~# tdevmon --unhook /dev/ttyO0
Unhooking device: /dev/ttyO0...

Read more on IO Ninja Documentation.