This shows you the differences between two versions of the page.
sdk:scripts:mount-media [2015/05/05 15:04] – external edit 127.0.0.1 | sdk:scripts:mount-media [2022/09/05 12:08] (current) – schmitt | ||
---|---|---|---|
Line 2: | Line 2: | ||
<code c mount-media.are> | <code c mount-media.are> | ||
/* DESC: This script can be used to mount an USB storage stick. | /* DESC: This script can be used to mount an USB storage stick. | ||
- | * Copyright (C) 2012 NetModule AG, Switzerland | + | * Copyright (C) 2012-2016 NetModule AG, Switzerland |
*/ | */ | ||
- | device = " | + | device = " |
- | mntpoint = "/ | + | mntpoint = sprintf("/ |
+ | printf(" | ||
ret = nb_media_mount(device); | ret = nb_media_mount(device); | ||
if (ret == 0) { | if (ret == 0) { | ||
- | printf(" | + | printf(" |
- | } | + | } else { |
- | else { | + | printf(" |
- | printf(" | + | exit(1); |
} | } | ||
Line 19: | Line 20: | ||
mounted = nb_media_getmount(); | mounted = nb_media_getmount(); | ||
printf(" | printf(" | ||
- | |||
printf(" | printf(" | ||
- | |||
handle = opendir(mntpoint); | handle = opendir(mntpoint); | ||
if (handle != -1) { | if (handle != -1) { | ||
Line 34: | Line 33: | ||
} | } | ||
+ | |||
+ | printf(" | ||
nb_media_umount(device); | nb_media_umount(device); | ||
exit(0); | exit(0); | ||
+ | |||
</ | </ | ||