Read/Write Data from/to USB Thumb Drive on Windows IoT Core




About this project

Currently, universal apps are sandboxed to the point of blocking you from reading/writing data files to a removable USB drive on Windows IoT Core devices. This post will show you a work around that if you really need to do this. Now, understand that this is not for store apps. If you submit an app using this work around, it will likely get rejected. However, for internal projects, it will definitely work, and work well.

read-write-data-from-to-usb-thumb-drive-on-windows-iot-core

This is a great way of reading application initialization data and writing log data in a test apparatus and laboratory setting. Particularly when a network or internet connection is not reliable or available in your test apparatus/laboratory setting. You can manage application settings by editing a simple JSON file at your convenience and copying it onto a thumb drive. Then just plug it into an IoT device-based system. Data gets read and written to the thumb drive and is easily accessible by just removing the thumb drive.

The Process

The first thing you need to do to your Windows Universal application is enable a couple of capabilities.

read-write-data-from-to-usb-thumb-drive-on-windows-iot-core1

Step 1

The “Pictures Library” and the “Removable Storage” capabilities need to be enabled. Why the “Pictures Library”? Because, as of build 14393, you can’t read or write files other than what are recognized as those that belong in the “Pictures Library” when you have that capability enabled. If you enabled the video or music capabilities, you could write those kind of files as well. There is no option for text, doc, or any other files. In this example, we’re going to stick with picture files.

Step 2

Now you need an initialization file to put onto your thumb drive. We’re going to set key/value pairs in a JSON format. In this example, we’ll have a value that updates our page title, an integer value, and the log filename.

{ 
“MAINPAGETITLE”:”My Removable Title”, 
“MAININT”:3, 
“LOGFILENAME”:”MyLogFile”, 
} 

Create a new text file in your favorite editor, but when you save it to the root of your thumb drive make sure you save it with a .jpg extension. This is what it should look like.

Read More:  Read/Write Data from/to USB Thumb Drive on Windows IoT Core


© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top