-
Notifications
You must be signed in to change notification settings - Fork 1.8k
The user framework module complies with s3ip sysfs specification #12894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [Unit] | ||
| Description=s3ip sysfs service | ||
| Wants=network-online.target | ||
| After=network-online.target | ||
|
|
||
| [Service] | ||
| Type=oneshot | ||
| User=root | ||
| ExecStart=/usr/bin/s3ip_sysfs_tool.sh start | ||
| ExecStop=/usr/bin/s3ip_sysfs_tool.sh stop | ||
| RemainAfterExit=yes | ||
|
|
||
| [Install] | ||
| WantedBy=default.target | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/python | ||
| # -*- coding: UTF-8 -*- | ||
| import json | ||
| import os | ||
|
|
||
| if __name__ == '__main__': | ||
| os.system("sudo rm -rf /sys_switch;sudo mkdir -p -m 777 /sys_switch") | ||
|
|
||
| with open('/etc/s3ip/s3ip_sysfs_conf.json', 'r') as jsonfile: | ||
| json_string = json.load(jsonfile) | ||
| for s3ip_sysfs_path in json_string['s3ip_syfs_paths']: | ||
| #print('path:' + s3ip_sysfs_path['path']) | ||
| #print('type:' + s3ip_sysfs_path['type']) | ||
| #print('value:' + s3ip_sysfs_path['value']) | ||
|
|
||
| if s3ip_sysfs_path['type'] == "string" : | ||
| (path, file) = os.path.split(s3ip_sysfs_path['path']) | ||
| #创建文件 | ||
| command = "sudo mkdir -p -m 777 " + path | ||
| #print(command) | ||
| os.system(command) | ||
| command = "sudo echo " + "\"" + s3ip_sysfs_path['value'] + "\"" + " > " + s3ip_sysfs_path['path'] | ||
| #print(command) | ||
| os.system(command) | ||
| elif s3ip_sysfs_path['type'] == "path" : | ||
| command = "sudo ln -s " + s3ip_sysfs_path['value'] + " " + s3ip_sysfs_path['path'] | ||
| #print(command) | ||
| os.system(command) | ||
| else: | ||
| print('error type:' + s3ip_sysfs_path['type']) | ||
| os.system("tree -l /sys_switch") | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| "s3ip_syfs_paths": [ | ||
| { | ||
| "path": "/sys_switch/temp_sensor", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/temp_sensor", | ||
| "description": "temperature information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/vol_sensor", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/vol_sensor", | ||
| "description": "voltage sensor information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/syseeprom", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/syseeprom", | ||
| "description": "ONIE EEPROM" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/fan", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/fan", | ||
| "description": "fan information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/psu", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/psu", | ||
| "description": "PSU information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/transceiver", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/transceiver", | ||
| "description": "transceiver information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/sysled", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/sysled", | ||
| "description": "SYS LED information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/fpga", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/fpga", | ||
| "description": "FPGA information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/cpld", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/cpld", | ||
| "description": "CPLD information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/watchdog", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/watchdog", | ||
| "description": "watchdog information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/curr_sensor", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/curr_sensor", | ||
| "description": "current sensor information" | ||
| }, | ||
| { | ||
| "path": "/sys_switch/slot", | ||
| "type" : "path", | ||
| "value" : "/sys/s3ip/slot", | ||
| "description": "slot information" | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #! /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 | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a platform drivers are already loaded and path to read fan_speed is
/sys/bus/i2c/devices/x-00y/fan<>_input
How can we mention this in the JSON file? Can you give an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example you want is shown below,
{
"path": "/sys_switch/fan/fan1/motor0/speed",
"type" : "path",
"value" : "/sys/bus/i2c/devices/x-00y/fan<>_input",
"description": "the motor0 of fan1 speed information"
},