3636BOOT_PARAMETER_BOOT_INITIATOR_INFO = 6
3737BOOT_PARAMETER_BOOT_INITIATOR_MAILBOX = 7
3838
39+
3940class BootDevice (str , Enum ):
4041 NO_OVERRIDE = "no override" ,
4142 PXE = "pxe" ,
@@ -91,6 +92,7 @@ def data_to_boot_mode(data):
9192 boot_mode = "legacy" if boot_mode_raw == 0 else "efi"
9293 return boot_mode
9394
95+
9496def data_to_boot_persistency (data ):
9597 """
9698 Convert a `GetSystemBootOptions(BOOT_PARAMETER_BOOT_FLAGS)` response data
@@ -99,6 +101,7 @@ def data_to_boot_persistency(data):
99101 boot_persistent_raw = (data [0 ] >> 6 ) & 1
100102 return boot_persistent_raw == 1
101103
104+
102105def data_to_boot_device (data ):
103106 """
104107 Convert a `GetSystemBootOptions(BOOT_PARAMETER_BOOT_FLAGS)` response data
@@ -107,6 +110,7 @@ def data_to_boot_device(data):
107110 boot_device_raw = (data [1 ] >> 2 ) & 0b1111
108111 return CONVERT_RAW_TO_BOOT_DEVICE [boot_device_raw ]
109112
113+
110114def boot_options_to_data (boot_device , boot_mode , boot_persistency ):
111115 """
112116 Convert a boot mode (string), boot device (string) and boot persistency (bool)
@@ -138,6 +142,7 @@ def boot_options_to_data(boot_device, boot_mode, boot_persistency):
138142 data = ByteBuffer ([boot_mode_raw | boot_persistent_raw , device_raw << 2 , 0 , 0 , 0 ])
139143 return data
140144
145+
141146class Chassis (object ):
142147 def get_chassis_status (self ):
143148 return ChassisStatus (self .send_message_with_name ('GetChassisStatus' ))
@@ -223,9 +228,9 @@ class ChassisStatus(State):
223228 fault = None
224229 control_fault = None
225230 restore_policy = None
226- id_cmd_state_info_support = None
227- chassis_id_state = None
228- front_panel_button_capabilities = None
231+ id_cmd_state_info_support = None
232+ chassis_id_state = None
233+ front_panel_button_capabilities = None
229234 last_event = []
230235 chassis_state = []
231236
@@ -236,10 +241,12 @@ def _from_response(self, rsp):
236241 self .fault = bool (rsp .current_power_state .power_fault )
237242 self .control_fault = bool (rsp .current_power_state .power_control_fault )
238243 self .restore_policy = rsp .current_power_state .power_restore_policy
239- self .id_cmd_state_info_support = bool (rsp .misc_chassis_state .id_cmd_state_info_support )
240- self .chassis_id_state = rsp .misc_chassis_state .chassis_id_state
244+ self .id_cmd_state_info_support = \
245+ bool (rsp .misc_chassis_state .id_cmd_state_info_support )
246+ self .chassis_id_state = rsp .misc_chassis_state .chassis_id_state
241247 if rsp .front_panel_button_capabilities is not None :
242- self .front_panel_button_capabilities = rsp .front_panel_button_capabilities
248+ self .front_panel_button_capabilities = \
249+ rsp .front_panel_button_capabilities
243250
244251 if rsp .last_power_event .ac_failed :
245252 self .last_event .append ('ac_failed' )
0 commit comments