f7d80e63db
Why I did it The user framework module complies with s3ip sysfs specification How I did it 1、 create a s3ip_sysfs service 2、 the s3ip_sysfs service call the “s3ip_sysfs_tool.sh” to install kernel module and run s3ip_load.py 3、 s3ip_load.py will parse the s3ip_sysfs_conf.json configuration file and create /sys_switch/ directory How to verify it A demo driver base on this framework will display the sysfs node wich conform to the s3ip sysfs specification
60 lines
1.7 KiB
Bash
Executable File
60 lines
1.7 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
s3ip_start(){
|
|
sudo insmod /lib/modules/s3ip/s3ip_sysfs.ko
|
|
sudo insmod /lib/modules/s3ip/syseeprom_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/fan_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/cpld_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/sysled_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/psu_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/transceiver_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/temp_sensor_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/vol_sensor_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/fpga_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/watchdog_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/curr_sensor_device_driver.ko
|
|
sudo insmod /lib/modules/s3ip/slot_device_driver.ko
|
|
sudo rm -rf /sys_switch
|
|
sudo /usr/bin/s3ip_load.py
|
|
echo "s3ip service start"
|
|
}
|
|
s3ip_stop(){
|
|
sudo rmmod slot_device_driver
|
|
sudo rmmod curr_sensor_device_driver
|
|
sudo rmmod watchdog_device_driver
|
|
sudo rmmod fpga_device_driver
|
|
sudo rmmod vol_sensor_device_driver
|
|
sudo rmmod temp_sensor_device_driver
|
|
sudo rmmod transceiver_device_driver
|
|
sudo rmmod psu_device_driver
|
|
sudo rmmod sysled_device_driver
|
|
sudo rmmod cpld_device_driver
|
|
sudo rmmod fan_device_driver
|
|
sudo rmmod syseeprom_device_driver
|
|
sudo rmmod s3ip_sysfs
|
|
sudo rm -rf /sys_switch
|
|
echo "s3ip service stop"
|
|
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
s3ip_start
|
|
;;
|
|
stop)
|
|
s3ip_stop
|
|
;;
|
|
status)
|
|
sudo tree -l /sys_switch
|
|
;;
|
|
restart)
|
|
s3ip_stop
|
|
s3ip_start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|restart}"
|
|
exit 1
|
|
esac
|
|
exit
|
|
|