info-beamer

Read files from USB stick

I’m trying to figure out how to read files from an USB stick plugged into the pi. I know that there is an USB import option: Device Configuration - info-beamer but I don’t want all files to be uploaded as assets (it’s a 128GB stick).

I was looking for the code that is executed when the /config/importer file exists, but while looking through the code in /service/importer/run , I got stranded in the /syncer directory where I suspect the file importer.pyo is executed. Is there any place where I can find the source code for that file?

For example, do I need to mount the USB stick manually like in Raspberry Pi Mount a USB Drive Tutorial - Pi My Life Up in order to access the files?

Thanks for your help! It’s always fun to play around with info-beamer, I love the project, thanks for conceiving and maintaining it.

Cheers,
Chris

The source code for that is not available. But I doubt it would be very useful: The importer implements a low level FAT32 reader that takes a lot of shortcuts as it only has to recursively traverse the complete USB drive and import files while completely ignoring paths and filenames. As such it cannot open specific files, cannot seek, cannot handle long filenames and so on. The reason it’s implemented this way is to handle removal of the USB drives at any time without using mount/umount at all.

If you want to use files on an USB drive, the only way is to create a package service with run-as-root and unboxed permissions. Within the service must then implement some logic to detect an inserted or removed card and call mount (best read-only) or umount to mount the USB drive to a path like /tmp/usb and the potentially symlink file you need into /space/root.

The package service can be terminated at any time, so you’ll have to handle the case of the drive already being mounted. All in all: It’s probably going to be a bit messy.

info-beamer - Digital Signage for the Raspberry Pi community forum - Imprint