USB-SAMBA Service (RDK-B)
Instruction:
We use USB-SAMBA Service to control the samba service, which can help us visit the content stored in USB storage equipment through samba. Furthermore, the USB-SAMBA service is manipulated from remote ACS, in other words, we can control this service by WEB-UI from a distance.
PLUS: Provisioning and management(P&M) allows the service provider to remotely manage the device using PA data model objects.
Features:
1. Enable/Disablethe USB samba service from the remote ACS.
2. Refresh samba service after adding/removing USB storage equipment.
3. Enlighten or quench the LED light after plugging or deleting the U-disk respectively.
Required:
1. Samba function package
2. The panel can mount USB storage equipment already.
Steps:
a. Add the script in samba initialization shell script(init_samba_xx.sh) where add the function to check and add USB configuration parameters to$SAMBA_CONFIG file. In this case, after we use command nmbd& smbd, we can drive the USB storage equipment indicate in $SAMBA_CONFIG, then we can visit the USB from samba.
b. Aswe use the YOCTO build system, we should add the samba software into our imagethrough *.bb/*.bbappend file. For example, we add the following code ingenerating image bbappend file.
$cat xx_image.bbappend
IMAGE_INSTALL += “ samba \
“
c. Find the script that mount the USB storageequipment. In our project, the script is located in/etc/udev/rules.d/disk_automount.sh.
d. Add new samba service new_init_samba_xxx.service and use the command to start samba service in /etc/udev/rules.d/disk_automount.sh.
we add a new new_init_samba_xxx.service, and use
systemctlstart new_init_samba_xxx.service
or
systemctlstop new_init_samba_xxx.service
after adding/removing usb storage equipment in /etc/udev/rules.d/disk_automount.sh, instead of using the originalinit_samba_xxx.service or directly executing shell script (init_samba_xx.sh) called byinit_samba_xxx.service to stop/startthe samba service.
There are two reasons for this operation.
1. After we directly execute the init_samba_xx.shin disk_automout.sh,we find the process created byinit_samba_xx.sh or disk_automout.shwere all killed after running forfew seconds.
2. Although we want to executethe original init_samba_xxx.service, in its[unit] part, it required many other service before itcan be run the samba service, that we cannot run this service as we wish in anytime. So we add the new_ init_samba_xxx.serviceto disconnect the dependency with other service.
[Assume:] I thought the systemd kill the all the process that created by udev, as I have tried the nohup/&/setsid, which are all have no efficiency. Even I use the shellcommandwhile true called the/etc/udev/rules.d/disk_automount.sh, it executed only once reflected by the log.
[Descriptionof the problem again in Chinese:]
我在/etc/udev/rules.d/ 下添加了rule,我用这个rule调用了当前目录的一个xxx.shell脚本,在这个xxx.shell脚本中又调用了/etc/init.d/目录下的一个开机启动yyy.shell脚本,yyy.shell脚本运行后会 开启几个进程a,b,c。
现在的问题是,每次xxx.shell脚本调用yyy.shell 开启进程a,b,c之后,没过几秒 a,b,c三个进程就被神秘力量给关闭了, 我网上看了下有 调用&后台运行的,也有调用nohup 或者 at指令的,但是成功开启进程后几秒就被关闭。
e. Add the command to enlighten or quench the LED light after plugin/remove the USB storage equipment respectively. The shell commands are as following:
+ echo 80 > /sys/class/gpio/export |
+ echo out > /sys/class/gpio/gpio80/direction |
+ # Light on/off USB LED |
+ echo $1 > /sys/class/gpio/gpio80/value |
$1 is thevariable which can represent adding/removing by 1/0 respectively.