0

I have an older industrial instrument running Windows CE that I would like to access data from remotely over WiFi. The instrument saves data (10-20 kB for each test) to a USB stick, so leveraging that I am attempting to create a WiFi enabled USB stick emulator using a Raspberry Pi Zero W (Zero 2 might also work, but it uses more power and I'm not sure how much the instrument's USB port can provide). Data can be read-only by the Windows 11 machine I am using to access the shared folder.

I followed this tutorial and have almost been able to get it to work.

To test, I have connected the Pi Zero to the instrument with a USB cable (to the Pi USB data port, not the power only USB port), run the instrument, and verified that the data was saved to the card.

Connecting to the Pi over wifi from a Windows 11 computer I am able to see the old data files in File Explorer, but new data files do not appear. Refreshing the folder doesn't show the new data either. If I reboot the Pi Zero and reconnect the new data shows on the Windows machine. Doing some research I found that running this command also causes the new data files to appear:

echo 1 | sudo tee /proc/sys/vm/drop_caches 

I wrote a script that repeats this command every 15 seconds that worked; I was able to have have the instrument repeatedly create new data files, and they would all appear in the Windows machine file explorer. However, I need some way to do this on boot, so the process is fully functional without the user having to enter any commands - just plug it in and go. Furthermore, I don't fully understand what the command does and whether it's a good idea to repeat it every x seconds.

Is there a way to use Watchdog to run the drop_caches command any time the mounted USB mass storage file is changed? Or a way to run it every x seconds, auto starting on boot?

I am aware this can cause file corruption but I don't think there is a better way to accomplish what we need.

2
  • please do not assume that the watchdog timer is the solution to the problem ... or even that drop_caches command is the solution ... please ask about the problem, not about your perceived solution to the problem Commented Dec 10, 2023 at 20:34
  • OK @jsotola I struck out that comment Commented Dec 14, 2023 at 20:09

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.