我需要在项目中编写一些关于串口的初始化脚本 . 我在论坛上研究过相关的帖子,但是我遇到了一些问题 .
我使用的是嵌入式linux,所以我使用chkconfig将脚本添加到系统中 .
BEGIN INIT INFO
#提供:myservice
#Required-Start:$ local_fs $ remove_fs
#Required-Stop:$ local_fs $ remove_fs
#Default-Start:2 3 4 5
#Default-Stop:0 1
#Short-Description:myservice
#说明:给予chmod o rw / dev / ttymxc0权限
END INIT INFO
. /etc/init.d/functions
案例“$ 1”in
开始)
chmod o+rw /dev/ttymxc0
;;
停)
echo -n "My service is stopped"
;;
*)退出1 esac
退出0
我保存和 chkconfig --add init.sh chkconfig init.sh on
然后我也给我的脚本chmod x init.sh权限 .
在我重新启动开发板后,我检查了我的串行端口的许可; ls -la /dev/ttymxc0
而且没有任何改变 . 我的init脚本不起作用 . 我错过了什么吗?或者我做错了吗?你能帮帮我吗?
谢谢最诚挚的问候