Silver Seams

Back to the Pi

Mon, 07 Aug 2023

As some of you may remember, my embroidery machines have wireless USB drives plugged into them. They're little single-board computers that look like a USB drive to the machine, but make their drives available on my wifi network. I have two directories, /mnt/janome and /mnt/brother, that I can copy things into and they'll show up on the respective machines, voila.

Right now the Janome is the only machine running (yes, of four) and it sits right next to my PC, but if I decide to play with a design on my laptop upstairs, I can send it down and it'll be waiting for me.

There's been just one smidge of a problem: a USB drive, by its physical nature, only gets used by one machine at a time. Normally computers that share things do various things to make sure they're not colliding, but not in cases where they assume they've got the place to themselves. Some embroidery machines take "notes" on the design (apparently) and if it's trying to write to the drive at the same time you're changing designs on it, the drive can be corrupted.

This is annoying, but I never have the only copy of things on the USB (never do that, even with a regular USB drive). I just have to ssh in, run the ./newusb script, and it will erase the broken virtual drive and create a new one.

Oh, and then I have to re-mount it on my PC, re-copy all the files over... like I said, annoying.

So I am trying out an alternative. Separate directories, so the machine and PC are never writing to the same thing. A watchdog script that watches the directory I'm working in, and if it sees some changes, it "unplugs" the machine's directory, copies them over, and "plugs in" the machine's directory again. There's still a chance for corruption, if the machine happened to be scribbling on its version when the watchdog yanked it, but that's not bad: there's an un-corrupted copy waiting to be copied over as soon as the corrupt version is wiped and re-created.

(Yes, getting a little nerdy here.)

Anyway, I have it set up that way right now. If it continues to work, I'll change the how-to and the pre-made downloadable image to match.

Comments are not available.


Patreon logo

Even non-members can shop on Patreon now!

Coffee logo

Was my site helpful? Buy me a Ko-Fi!