Log in

No account? Create an account
Two scripts for photo-related devices. - Alex Belits
Two scripts for photo-related devices.

Download files from Toshiba FlashAir SD card over Wi-Fi: https://github.com/abelits/flashair-download

Print on Canon SELPHY 1200: https://github.com/abelits/canon-selphy-print

FlashAir script is for the configuration with FlashAir card as the access point, it uses Network Manager through nmcli utility to temporarily switch the access point, download files that are not present on the host, then restore the original state of Wi-Fi connection. It requires Network Manager having a configuration for the card, with the connection name the same as SSID name.

SELPHY support assumes that the printer configured in CUPS and accessible over Wi-Fi. The driver chosen for this printer is irrelevant, script uses raw mode and sends JPEG file with dimensions used by the printer.

I did not want to use a printer as an access point because it may interfere with the CUPS spooler -- spooler may be still talking to the printer while everything else is done, or printer may be in an error/out of supplies state, so keeping the connection on while the queue is not empty is not a good idea, either. Printer indicates its connection status on its built-in screen, so setup is sufficiently convenient, at least with my phone acting as a mobile access point.

On FlashAir, on the other hand, access point mode is more convenient because it does not tie the setup to any particular external access point, so photos can be downloaded at the first opportunity.


6 comments or Leave a comment
fatoff From: fatoff Date: February 20th, 2017 07:14 am (UTC) (Link)
Часть похожей задачи для WiFi камер удалось всё сделать без Network Manager, но пора браться за аутенфикацию.
abelits From: abelits Date: February 20th, 2017 10:45 pm (UTC) (Link)
У меня вся идея в том, что я держу аутентикацию за пределами скрипта, в Network Manager'е. При этом я могу восстановить исходное соединение с его параметрами и аутентикацией, не пытаясь их где-либо найти -- Network Manager их уже знает.

Я это делал для лаптопа, на который нужно скопировать фотографии как можно быстрее, и с наименьшим вмешательством в то, что я делаю на этом лаптопе (обычно редактирование уже полученных фотографий и передачу их куда-либо по сети через ближайший Wi-Fi или телефон). Поэтому Network Manager там обычно уже есть и всем заправляет, и вмешиваться в его работу не хочется.
fatoff From: fatoff Date: February 20th, 2017 11:59 pm (UTC) (Link)
Да, отличается назначение, что мы в домашнем хозяйстве, и что мы в народном, когда отдыхаем от домашнего. Вот, есть коллега. Для нашего же тач-скрина в небольшой коробочке аутенфикация просто неотъемлимая часть, там нет собственно "морды" линукса совсем.

[Spoiler (click to open)]Если интересно, в народное и домашнее хозяйство внедряется 360fly камера, снимает полусферу вокруг себя. Для неё уже напридумывали, и патентуют применения. Рынок продуцирует нам работу.
abelits From: abelits Date: February 24th, 2017 11:13 pm (UTC) (Link)
I have updated the printer script. Now it:

1. Matches the printer resolution, and printer does not have to rescale the image.
2. Resize filtering options are changed to reduce the aliasing.
3. Supports "Card" size (86x54mm) with both card-sized and mini-stickers layouts. Card can be printed with either no border, plain border or rounded-corners border.

abelits From: abelits Date: March 1st, 2017 08:18 pm (UTC) (Link)
Just added Transcend card support.
abelits From: abelits Date: March 2nd, 2017 03:43 am (UTC) (Link)
Being an 31337 h4x0r, I was able to successfully update FlashAir firmware under Linux. The procedure is:

Take FlashAir updater for Mac. There are two variants for two card models: https://www.toshiba.co.jp/p-media/english/download/wl/updatetool02.htm (Class 6, older 8G variant) and https://www.toshiba.co.jp/p-media/english/download/wl/updatetool02_w02.htm (class 10, new 8G, 16G and 32G). Mac version is a zip archive. Unpack it.

Mount the card, it has FAT filesystem.

From Contents/Resources copy fwupdate.fbn and 00files.txt to the root directory of the card.
Copy BCONFIG, backup.htm, List.htm, CONFIG.htm, bwelcome.htm, header.jpg, file.jpg, folder.jpg, go.jpg, gear.jpg, man.jpg, ico_card.gif and ico_lock.gif to SD_WLAN directory on the card.
Copy ICONINF.TXT, ICON_128.PNG and ICON_32.PNG to GUPIXINF/CARDICON directory on the card.

In SD_WLAN directory on the card rename CONFIG to CONFIG.old
From Contents/Resources copy CONFIG_up to CONFIG in SD_WLAN directory on the card.

Unmount the card and disconnect it.

Connect the card again, wait for it to power up. It will boot and start the access point with default "flashair_<MAC address>" SSID. It will not be mountable.

Disconnect the card.

Connect the card. This time it will be mountable. Mount it.

Verify that fwupdate.fbn in the root directory of the card is gone, and SD_WLAN/CONFIG on the card contains
"VERSION=<new version number>"

In SD_WLAN directory on the card rename CONFIG.old to CONFIG

Edit the above mentioned CONFIG, so
line will contain actual key instead of the "***********" placeholder.

Unmount the card and disconnect it.

Connect the card and mount it.

Verify that SD_WLAN/CONFIG on the card contains
"VERSION=<new version number>"

The card should now be accessible. You can verify that files on it are accessible over the wireless network, and unmount it.

Edited at 2017-03-02 03:44 am (UTC)
6 comments or Leave a comment