Search

Ubuntu 16.04 LTS - Browse FlashAir card thru Wifi in Nautilus

Contents[Hide]

dropcap flashair

Toshiba FlashAir is a very versatile Wifi enabled SD card. It includes a wifi acces point and an embedded HTTP server to serve the SD card content to any browser. Toshiba provides some Flashair clients for Android and Windows, but as usual, Linux has been forgotten. So I decided to write a Linux client that allows to browse Flashair card content straight from Nautilus file manager.

This article explains how to setup a Linux workstation to be able to browse a Toshiba FlashAir SD card directly from Nautilus file manager.

We'll setup a specific directory on your computer which will become an online/offline mirror of your SD card. When you connect for the first time, most of the files will be only thumbnails not to overload the wifi connexion. But you'll be able to download any image or video with a simple right click from Nautilus. Once you disconnect your Flashair card, all downloaded files remain on your computer. You'll be able to connect anytime to your FlashAir card to update its content.

This has been setup and tested on an Ubuntu Gnome 16.04 LTS, but it should be applicable to any modern Linux distribution.

1. Basic principle

The basic principle is to create a /media/flashair directory structure on the computer and to keep it synchronised with Flashair card content when connected to a Flashair card network.

Everything should be automatic so that you just need to connect or disconnect your Flashair card thru wifi and all synchronisation process is handled automatically.

But synchronisation process can not be handled as a full realtime synchronisation as wifi connection is not fast enough.

It must be handled in a specific way to remain confortable when browsing the card content :

  • Directory content is mirrored in realtime as soon as you enter a directory
  • Files are only recovered as thumbnails to minimise size
  • They can be downloaded from a right click action on the thumbnail file

When file is a thumbnail, it's size is displayed to indicate how heavy it will be to download it.

nautilus flashair thumbnails

Few actions are available on files thru some right click menus  :

  • Download : recover file from FlashAir card to replace the thumbnail
  • Delete : suppress the file on Flashair card
  • Upload : send the file to the Flashair card

nautilus flashair download  nautilus flashair upload

With this approach, you are able to go thru your Flashair card and local content and to decide whatever file you want to download or upload.

As soon as you change directory in Nautilus, directory content is automatically updated with missing thumbnails from Flashair card content.

When offline, as local directory is a mirror, whatever file has beeen previously downloaded remains available.

Online and offline state are automatically handled by detecting wifi connection to a Flashair card network.

Local Flashair directory content is accessible thru a Nautilus favorite which displays the wifi connexion status (connected / disconnected).

nautilus flashair favorite

2. Technical overview

Synchronisation between Nautilus and the Flashair card is handled by 3 main scripts.

2.1. Network Detection Script

Network detection script is called everytime you connect/disconnect your computer to a network.

It is in charge of setting up the environment to handle the online & offline status according to the Flashair network availability.

FlashAir wifi network is detected thru its SSID which always starts with flashair_

When Flashair network is connected, it starts the Daemon Synchronisation Script.

It also kills this script when Flashair network is disconnected.

2.2. Daemon Synchronisation Script

Daemon scrit is in charge of the directory content synchronisation between the computer and the Flashair card.

This simple script is loaded when Flashair card is online and starts an inotifywait event on the local directory structure.

Thru inotify, it triggers directory content synchronisation events everytime you change directory in Nautilus.

Thanks to this script, every subdirectory you browse is synchronised in realtime by the Worker Synchronisation Script.

2.3. Worker Synchronisation Script

Worker Synchronisation Script is in charge of handling main synchronisation tasks.

It is triggered by the Daemon Synchronisation Script and by some Nautilus actions.

It handles the full communication process with Flashair HTTP server :

  • Flashair network connection
  • Flashair network disconnection
  • Directory content update
  • File download
  • File upload
  • File suppression

As soon as some communication is taking place between your computer and your FlashAir card, a background notification dialog is displayed.

nautilus flashair notification

During Flashair network connexion, the script is handling few actions :

  1. detect card access type (read only or read/write)
  2. declare flashair IP address in /etc/hosts
  3. update Nautilus bookmark status
  4. enable Nautilus actions according to card access type

Directory content update is triggered by a inotify event. It consists of few actions :

  1. read directory file list on Flashair card
  2. get new files attributes (type, size, …)
  3. generate thumbnails according to attributes
  4. create new sub-directories

File download, upload and suppression are triggered by some specific Nautilus actions on thumbnails or files.

These Nautilus actions are declared at connexion/disconnexion time so that :

  • they are only available on local directory structure
  • they are only available when the Flashair card is connected
  • download is only available for thumbnails of Flashair files
  • upload is only available for local files if card is writable (upload allowed)
  • suppression is only available for Flashair files if card is writable (upload allowed

3. Read/write access

By default, your FlashAir card is accessible thru Wifi in Read only mode.

You'll be able to download all your photos, but you won't be able to delete photos on the card or to upload new photos on the card.

If you want to be able to access your FlashAir in Read/Write mode, you first need to plug your card in a card reader and to add UPLOAD=1 to SD_WLAN/CONFIG configuration file.

SD_WLAN/CONFIG
[Vendor]
...
UPLOAD=1

Once done, next Wifi FlashAir connexion will allow Read/Write mode.

nautilus flashair connected

4. Configuration

You can configure few behaviour aspects of the FlashAir synchronisation process thru /etc/flashair.conf

Main parameters are :

  • flashair-mount - Path where to mount FlashAir card content (/media/flashair by default)
  • flashair-filelist - cache file present in every subdirectory holding directory content (.filelist by default)

You can also configure confirmation display according to actions :

  • confirm-download - Display confirmation dialog everytime you download some files from FlashAir card
  • confirm-upload - Display confirmation dialog everytime you upload some files to FlashAir card
  • confirm-delete - Display confirmation dialog everytime you delete some files on FlashAir card

5. Installation

All needed files are available from my GitHub repository :

  • network detection script
  • daemon script
  • worker script
  • Nautilus actions .desktop files
  • icons

Scripts need inotify-tools, imagemagick, curl and yad packages to be installed.

A pre-requisite is to install the background notification environment that is used by FlashAir synchronisation tools. They are also available from the same GitHub repository.

Terminal
# wget https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/desktop/desktop-display-install.sh
# chmod +x desktop-display-install.sh
# ./desktop-display-install.sh

You can now install all FlashAir synchronisation environment thru a complete installation script. This script checks all dependencies, install all the files and setup everything.

Terminal
# wget https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/flashair/flashair-install.sh
# chmod +x flashair-install.sh
# ./flashair-install.sh

You now just need to logout from your session and to login again.

You'll then be able to :

  1. connect to your Flashair card network
  2. start to browse your card content straight from Nautilus

 

Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus