Project

General

Profile

Actions

Feature #841

closed

Add PiBox FileManager app

Added by Hammel almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
UI
Target version:
Start date:
13 Jun 2021
Due date:
% Done:

100%

Estimated time:
Severity:
01 - Critical

Description

This needs to handle the configuration options found in RM #768.

This also needs to have the default fileserver UI verified working on the TFT display, which may require touchscreen calibration.

Resources:
Actions #1

Updated by Hammel over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

pisentry has been switched to use a TFT display for its system build. This addresses getting the TFT display working so it can be used for pifile and a template metabuild has been pushed for pifile. However, pifile still needs all the internals added, not to mention UI apps, appropriate for managing a file server.

Actions #2

Updated by Hammel over 2 years ago

How the app should work:

  • Thread to retrieve fs data into db.
    • Initial fs scanner: get filesystem size and usage per mount point
    • inotify for new mounts, changes under mounts - rescan
    • mounts under: /media/smb, /media/usb (configurable in pistore.cfg as stores:<dir>, multiple times allowed)
    • Avail, used totals per mount in db
    • Summary avail, used totals per /media/<dir>
    • No NFS support initially
  • mutex protected read/write db functions
  • UI
    • Main: summary page
      • Status bar
        • ssh status
        • smb status
      • separate graphs for SMB and USB avail vs used totals
    • SMB page
      • List (pageable) remote servers, show mounts per server
      • Leave page - clear offset
    • USB page
      • Paged list of mounts: used, avail, total
      • leave page - clear offset

Disk Stats

Actions #3

Updated by Hammel about 2 years ago

  • Description updated (diff)
Actions #4

Updated by Hammel about 2 years ago

  • % Done changed from 10 to 50

The UI is now working quite well. It shows all mount points with the total and available space graphed in percentages. This is different than the previous description and doesn't show the status bar as described. Instead,

Now it's time to show I/O activity.

Trying to read disk activity - it's not easy to figure out how to do this. One way is to see what iostat does. In summary:

First time setup

  1. Open /sys/block/<device>/stat and read (it's one line)
    1. device is sda1, sdb2, etc, which is what they'll look like under /media/usb and /media/smb
  2. Parse file
    1. see read_sysfs_file_stat_work()
    2. see https://www.kernel.org/doc/Documentation/block/stat.txt
  3. saveread and write IOs as lastRead
    1. read again after 20ms, save as currentRead
    2. compute change from lastRead to currentRead, store as lastChange
    3. move currentRead to lastRead, clear currentRead

Iteration

  1. Open /sys/block/<device>/stat and read (it's one line)
    1. device is sda1, sdb2, etc, which is what they'll look like under /media/usb and /media/smb
  2. Parse file
  3. saveread and write IOs as currentRead
  4. compute change from lastRead to currentRead, store as currentChange
  5. compute percentage change from lastChange to currentChange - display it.
  6. move currentChange to lastChange
  7. move currentRead to lastRead
Actions #5

Updated by Hammel about 2 years ago

  • % Done changed from 50 to 70

I dropped all of the I/O stuff. It's only purpose was to show disk I/O activity and it's hardly worth the effort since file system activity is not really based on mount points - you have to map between the two. It's just extra work for little benefit here.

So now the statuswidget is just a fullscreen popup window that shows the exports file. This allows the user to see which devices are being exported from the PiStore system. The window gets hidden and revealed by touching the left of middle columns of the display (or hitting the TAB key) and the app can be quit by touch the right column of the display (or typing Ctrl-Q or the home key, which is the ESC key on PiBox).

System is now in test. It boots and starts okay but has some problems with moving between windows and the fonts are too big.

Actions #6

Updated by Hammel about 2 years ago

  • % Done changed from 70 to 90

The UI is cleaned up for the small touchscreen, with touchscreen regions used now (instead of ABS position). I also fixed fonts to be more readable on small screens.

The only thing left to is make the app only look at mounts under /media/usb or /media/smb. Right now it shows all mount points including the the mmc boot device.

Actions #7

Updated by Hammel about 2 years ago

Additional testing:

  1. Two usb sticks
    1. One is showing 0MB/0MB and fully used; actually has 8MB and fully used.
    2. One is showing 4098MB/8192MB and about 14% used; actually has 1086MB/7856MB used and 14% used.
Bugs:
  1. Calculation of available and total are wrong.
  2. Handling of very small partition sizes is wrong.
  3. NFS is not installed in dev platform (missing /etc/exports), possibly not in kernel either.
  4. Display does not clear last entry when last mount is removed.
  5. Exports file is not fully cleared of mounts.
  6. Exports file shoud be sync'd with mounts at program startup.
Actions #8

Updated by Hammel about 2 years ago

There were some problems with plug/unplug (re: inotify handling) that are now fixed, but the bugs in the above entry still need addressing.

Actions #9

Updated by Hammel about 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

All known bugs fixed.
Changes committed and pushed.
Closing issue.

Actions

Also available in: Atom PDF