Skip to content
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

Take input from file for write keyword #598

Open
wants to merge 1 commit into
base: 1110
Choose a base branch
from

Conversation

branupama
Copy link

This commit adds code to read keyword’s value from the local file to update keyword’s value. User can provide file path where the value exists using --file option.

Output:
‘’’
Write keyword using object path (both primary and backup path VPD gets updated)

Before update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r {
"/system/chassis/motherboard": {
"BR": "S0"
}
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H {
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"BR": "S0"
}
}

Input file (In ASCII format):
root@p10bmc:/tmp# cat input.txt
A2

Update keyword command:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -w --file input.txt Data updated successfully

After update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r {
"/system/chassis/motherboard": {
"BR": "A2"
}
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H {
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"BR": "A2"
}
}

Write keyword using hardware path (updates only given hardware path):

Input file (In hexadecimal format):
root@p10bmc:/tmp# cat input.txt
0x5330

Update keyword command:
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -w -H --file input.txt Data updated successfully

After update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r {
"/system/chassis/motherboard": {
"BR": "A2"
}
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H {
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"BR": "S0"
}
}
‘’’

This commit adds code to read keyword’s value from the local file to
update keyword’s value. User can provide file path where the value
exists using --file option.

Output:
‘’’
Write keyword using object path (both primary and backup path VPD gets updated)

Before update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r
{
    "/system/chassis/motherboard": {
        "BR": "S0"
    }
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H
{
    "/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
        "BR": "S0"
    }
}

Input file (In ASCII format):
root@p10bmc:/tmp# cat input.txt
A2

Update keyword command:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -w --file input.txt
Data updated successfully

After update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r
{
    "/system/chassis/motherboard": {
        "BR": "A2"
    }
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H
{
    "/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
        "BR": "A2"
    }
}

Write keyword using hardware path (updates only given hardware path):

Input file (In hexadecimal format):
root@p10bmc:/tmp# cat input.txt
0x5330

Update keyword command:
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -w -H --file input.txt
Data updated successfully

After update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r
{
    "/system/chassis/motherboard": {
        "BR": "A2"
    }
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H
{
    "/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
        "BR": "S0"
    }
}
‘’’

Signed-off-by: Anupama B R <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant