Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

Enable/Disable CIRCUITPY mount?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Enable/Disable CIRCUITPY mount?

by proshow on Wed May 06, 2020 4:44 pm

I have a project that is using HID to control a piece of software on a PC. Now that my code is complete, it would be nice to be able to not mount the CIRCUITPY drive unless I need to edit something, so that users can't mess with the code. Is there any way to make the state of an input disable/enable the drive mounting?

Thanks

proshow
 
Posts: 10
Joined: Wed Nov 16, 2011 9:16 pm

Re: Enable/Disable CIRCUITPY mount?

by mikeysklar on Wed May 06, 2020 5:25 pm

Hi proshow,

It looks looks like you have a few options to prevent users from messing with code.

1) You can mount the drive as read only with a custom boot.py.

2) You can rename the device to something more obscure that might not even show up in a finder (.name)?

3) You could mount under a more obscure directory so it is not on the desktop.

https://learn.adafruit.com/welcome-to-c ... itpy-drive

Code: Select all | TOGGLE FULL SIZE
 import storage

storage.remount("/", readonly=True)

m = storage.getmount("/")
m.label = "NEW_NAME"

storage.remount("/", readonly=False)

mikeysklar
 
Posts: 1185
Joined: Mon Aug 01, 2016 8:10 pm

Re: Enable/Disable CIRCUITPY mount?

by proshow on Wed May 06, 2020 5:32 pm

Thanks. Based on your comments I was able to modify my search terms and found this link https://learn.adafruit.com/circuitpython-essentials/circuitpython-storage which looks like a good option for me.

proshow
 
Posts: 10
Joined: Wed Nov 16, 2011 9:16 pm

Re: Enable/Disable CIRCUITPY mount?

by mikeysklar on Wed May 06, 2020 5:43 pm

cool. good find.

mikeysklar
 
Posts: 1185
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.