apps/system/usbmsc: Added Kconfig options to configure write protection for each LUN
This commit is contained in:
parent
e2e53117a5
commit
da4472a978
@ -39,6 +39,13 @@ config SYSTEM_USBMSC_DEVPATH1
|
|||||||
The full path to the registered block driver. Default is
|
The full path to the registered block driver. Default is
|
||||||
"/dev/mmcsd0"
|
"/dev/mmcsd0"
|
||||||
|
|
||||||
|
config SYSTEM_USBMSC_WRITEPROTECT1
|
||||||
|
bool "LUN1 Write-protected"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable this if you want to write-protect the first LUN. Default is
|
||||||
|
off.
|
||||||
|
|
||||||
config SYSTEM_USBMSC_DEVMINOR2
|
config SYSTEM_USBMSC_DEVMINOR2
|
||||||
int "LUN2 Minor Device Number"
|
int "LUN2 Minor Device Number"
|
||||||
default 1
|
default 1
|
||||||
@ -54,20 +61,34 @@ config SYSTEM_USBMSC_DEVPATH2
|
|||||||
The full path to the registered block driver. Ignored if
|
The full path to the registered block driver. Ignored if
|
||||||
SYSTEM_USBMSC_NLUNS < 2. Default is "/dev/mmcsd1"
|
SYSTEM_USBMSC_NLUNS < 2. Default is "/dev/mmcsd1"
|
||||||
|
|
||||||
|
config SYSTEM_USBMSC_WRITEPROTECT2
|
||||||
|
bool "LUN2 Write-protected"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable this if you want to write-protect the second LUN. Ignored if
|
||||||
|
SYSTEM_USBMSC_NLUNS < 2. Default is off.
|
||||||
|
|
||||||
config SYSTEM_USBMSC_DEVMINOR3
|
config SYSTEM_USBMSC_DEVMINOR3
|
||||||
int "LUN3 Minor Device Number"
|
int "LUN3 Minor Device Number"
|
||||||
default 2
|
default 2
|
||||||
---help---
|
---help---
|
||||||
The minor device number of the block driver for the third LUN. For
|
The minor device number of the block driver for the third LUN. For
|
||||||
example, N in /dev/mmcsdN. Used for registering the block driver.
|
example, N in /dev/mmcsdN. Used for registering the block driver.
|
||||||
Ignored if SYSTEM_USBMSC_NLUNS < 2. Default is two.
|
Ignored if SYSTEM_USBMSC_NLUNS < 3. Default is two.
|
||||||
|
|
||||||
config SYSTEM_USBMSC_DEVPATH3
|
config SYSTEM_USBMSC_DEVPATH3
|
||||||
string "LUN3 Device Path"
|
string "LUN3 Device Path"
|
||||||
default "/dev/mmcsd2"
|
default "/dev/mmcsd2"
|
||||||
---help---
|
---help---
|
||||||
The full path to the registered block driver. Ignored if
|
The full path to the registered block driver. Ignored if
|
||||||
SYSTEM_USBMSC_NLUNS < 2. Default is "/dev/mmcsd2"
|
SYSTEM_USBMSC_NLUNS < 3. Default is "/dev/mmcsd2"
|
||||||
|
|
||||||
|
config SYSTEM_USBMSC_WRITEPROTECT3
|
||||||
|
bool "LUN3 Write-protected"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable this if you want to write-protect the third LUN. Ignored if
|
||||||
|
SYSTEM_USBMSC_NLUNS < 3. Default is off.
|
||||||
|
|
||||||
config SYSTEM_USBMSC_DEBUGMM
|
config SYSTEM_USBMSC_DEBUGMM
|
||||||
bool "USB MSC MM Debug"
|
bool "USB MSC MM Debug"
|
||||||
|
@ -510,7 +510,11 @@ int msconn_main(int argc, char *argv[])
|
|||||||
check_test_memory_usage("After usbmsc_configure()");
|
check_test_memory_usage("After usbmsc_configure()");
|
||||||
|
|
||||||
printf("mcsonn_main: Bind LUN=0 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH1);
|
printf("mcsonn_main: Bind LUN=0 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH1);
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMSC_WRITEPROTECT1
|
||||||
|
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH1, 0, 0, 0, true);
|
||||||
|
#else
|
||||||
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH1, 0, 0, 0, false);
|
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH1, 0, 0, 0, false);
|
||||||
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("mcsonn_main: usbmsc_bindlun failed for LUN 1 using %s: %d\n",
|
printf("mcsonn_main: usbmsc_bindlun failed for LUN 1 using %s: %d\n",
|
||||||
@ -524,7 +528,11 @@ int msconn_main(int argc, char *argv[])
|
|||||||
#if CONFIG_SYSTEM_USBMSC_NLUNS > 1
|
#if CONFIG_SYSTEM_USBMSC_NLUNS > 1
|
||||||
|
|
||||||
printf("mcsonn_main: Bind LUN=1 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH2);
|
printf("mcsonn_main: Bind LUN=1 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH2);
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMSC_WRITEPROTECT2
|
||||||
|
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH2, 1, 0, 0, true);
|
||||||
|
#else
|
||||||
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH2, 1, 0, 0, false);
|
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH2, 1, 0, 0, false);
|
||||||
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("mcsonn_main: usbmsc_bindlun failed for LUN 2 using %s: %d\n",
|
printf("mcsonn_main: usbmsc_bindlun failed for LUN 2 using %s: %d\n",
|
||||||
@ -538,7 +546,11 @@ int msconn_main(int argc, char *argv[])
|
|||||||
#if CONFIG_SYSTEM_USBMSC_NLUNS > 2
|
#if CONFIG_SYSTEM_USBMSC_NLUNS > 2
|
||||||
|
|
||||||
printf("mcsonn_main: Bind LUN=2 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH3);
|
printf("mcsonn_main: Bind LUN=2 to %s\n", CONFIG_SYSTEM_USBMSC_DEVPATH3);
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMSC_WRITEPROTECT3
|
||||||
|
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH3, 2, 0, 0, true);
|
||||||
|
#else
|
||||||
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH3, 2, 0, 0, false);
|
ret = usbmsc_bindlun(handle, CONFIG_SYSTEM_USBMSC_DEVPATH3, 2, 0, 0, false);
|
||||||
|
#endif
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("mcsonn_main: usbmsc_bindlun failed for LUN 3 using %s: %d\n",
|
printf("mcsonn_main: usbmsc_bindlun failed for LUN 3 using %s: %d\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user