Changes

Jump to navigation Jump to search
3,510 bytes added ,  17:10, 12 June 2022
Line 66: Line 66:  
| 29 || [7.0.0+] [[#FinalizeWlan]]
 
| 29 || [7.0.0+] [[#FinalizeWlan]]
 
|-
 
|-
| 30 || [8.0.0+]
+
| 30 || [8.0.0+] [[#SetWowlDelayedWakeTime]]
 
|-
 
|-
 
| 31 || [11.0.0+]
 
| 31 || [11.0.0+]
Line 202: Line 202:     
Sends command messages 0x24 (DisconnectRequest), 0x34 (RequestSleep), 0x3D and 0x3E to the state machine.
 
Sends command messages 0x24 (DisconnectRequest), 0x34 (RequestSleep), 0x3D and 0x3E to the state machine.
 +
 +
First message GetState is sent, if state is 0x3 it does the following:
 +
 +
* Sends message 0x3D. If successful and the output u8 is 0, this then does the following:
 +
** Uses GetState to check for state 0x2/0x3. On success message DisconnectRequest is sent. If state is invalid or the command message failed, this will Abort.
 +
** Uses GetState to check for state 0x1/0x2/0xA. On success message 0x9A with param=0 is sent. If state is invalid or the command message failed, this will Abort.
 +
 +
Then message RequestSleep is sent. If the Result is not 0x146B (including success), it returns the Result. Otherwise when the Result is that value, it does the following:
 +
 +
* Sends message 0x3E.
 +
** Uses GetState to check for state 0x2/0x3. On success message DisconnectRequest is sent. If state is invalid or the command message failed, this will Abort.
 +
** Uses GetState to check for state 0x1/0x2/0xA. On success message 0x9A with param=0 is sent. If state is invalid or the command message failed, this will Abort.
 +
** Then this cmpl impl func will return the Result from calling itself.
    
This is used by [[Network_Interface_services|nifm]].
 
This is used by [[Network_Interface_services|nifm]].
Line 237: Line 250:  
This copies the input data into state, and sets a flag in state. The input is written into state with the following structure: [[#MacAddress]], '''SrcIp''', '''DstIp''', '''SrcPort''', '''DstPort''', '''Unk1''', '''Unk0'''.
 
This copies the input data into state, and sets a flag in state. The input is written into state with the following structure: [[#MacAddress]], '''SrcIp''', '''DstIp''', '''SrcPort''', '''DstPort''', '''Unk1''', '''Unk0'''.
   −
This data is used during RequestSleep if a state field is set for using it (the codepath using this will throw an error if this data was not set). This data is cleared afterwards regardless of whether it was used. This is used for configuring various config related to wowl/tcpka/etc (wake-on-WLAN/TCP keep-alive). Note that an error is thrown if "wowl_activate" isn't set but sysmodule-side doesn't do so - this seems to be set automatically at some point.
+
This data is used during RequestSleep if a state field is set for using it (the codepath using this will throw an error if this data was not set). This data is cleared afterwards unless sleep was successfully entered with wowl. This is also cleared during RequestWakeUp. This is used for configuring various config related to wowl/tcpka/etc (wake-on-WLAN/TCP keep-alive). Note that an error is thrown if "wowl_activate" isn't set but sysmodule-side doesn't do so - this seems to be set automatically at some point.
    
This is used by [[Network_Interface_services|nifm]].
 
This is used by [[Network_Interface_services|nifm]].
Line 270: Line 283:     
== Cmd24 ==
 
== Cmd24 ==
No input, returns a 0x20-byte struct and a 0x38-byte struct.
+
No input, returns a [[#WakeUpStats]] and a [[#SleepStats]].
    
Sends command message 0x39 to the state machine, with 0x20-bytes from the output being copied to the first output struct. Sends command message 0x3A to the state machine, with 0x38-bytes from the output being copied to the second output struct.
 
Sends command message 0x39 to the state machine, with 0x20-bytes from the output being copied to the first output struct. Sends command message 0x3A to the state machine, with 0x38-bytes from the output being copied to the second output struct.
Line 283: Line 296:  
When the first bool flag is set, sends command message 0x3B to the state machine. When the second bool flag is set, sends command message 0x3C to the state machine. Then 0 is returned.
 
When the first bool flag is set, sends command message 0x3B to the state machine. When the second bool flag is set, sends command message 0x3C to the state machine. Then 0 is returned.
   −
Both requests are handled by clearing various data in state.
+
Both requests are handled by clearing various data in state. The first request clears the first state struct returned by [[#Cmd24]], likewise with the second request and the second state struct from [[#Cmd24]].
    
This is not used on retail.
 
This is not used on retail.
Line 317: Line 330:  
This is not used on retail.
 
This is not used on retail.
   −
== Cmd30 ==
+
== SetWowlDelayedWakeTime ==
Takes an input s32, no output.
+
Unofficial name.
 +
 
 +
Takes an input s32 '''WowlDelayedWakeTime'''. No output.
   −
The input s32 must be <=0xE10 (3600) and >= -1. The input value is written into state, then this returns 0.
+
'''WowlDelayedWakeTime''' must be <=0xE10 (3600) and >= -1. This value is written into state (last field in the state struct also used by [[#Cmd19]], which [[#Cmd19]] doesn't write), then this returns 0.
    
The user-process code using this cmd also has the above bounds check.
 
The user-process code using this cmd also has the above bounds check.
Line 327: Line 342:     
This cmd is used by [[Network_Interface_services|nifm]] with a value from state, prior to using RequestSleep.
 
This cmd is used by [[Network_Interface_services|nifm]] with a value from state, prior to using RequestSleep.
 +
 +
If wificore gets to the point of actually using this for TCP-keep-alive, then it does the following:
 +
* This is only used when the [[#Cmd19|TCP]] connection is RST.
 +
** '''WowlDelayedWakeTime''' is the time in seconds to schedule a timer which will wake the system. 0 will schedule it for immediately.
 +
** -1 will skip scheduling that timer, hence waking the system is disabled when RST is received.
 +
** The wificore also supports -3 for immediately waking the system from the frame-handler, however wlan-sysmodule doesn't allow that.
 +
* Frames where the TCP flags do not match ACK will immediately wake the system, + other wake cause(s).
    
== Cmd31 ==
 
== Cmd31 ==
Line 886: Line 908:  
= WpsPin =
 
= WpsPin =
 
This is a 0x8-byte string.
 
This is a 0x8-byte string.
 +
 +
= MulticastList =
 +
This is a 0x31-byte struct.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x1 || Count
 +
|-
 +
| 0x1 || 0x30 || Array of [[#MacAddress]]
 +
|}
 +
 +
= WakeUpStats =
 +
This is a 0x20-byte struct.
 +
 +
This is updated during RequestWakeUp. The fields starting with offset +0x4 are updated when handling [[#Cmd19|wowl]], which counter is updated depends on the value of iovar "tcpka_wake_cause".
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x4 || Number of normal non-wowl wakeups. Also incremented during wowl handling if the output from the func using "tcpka_wake_cause" is 0.
 +
|-
 +
| 0x4 || 0x4 ||
 +
|-
 +
| 0x8 || 0x4 ||
 +
|-
 +
| 0xC || 0x4 ||
 +
|-
 +
| 0x10 || 0x4 ||
 +
|-
 +
| 0x14 || 0x4 ||
 +
|-
 +
| 0x18 || 0x4 ||
 +
|-
 +
| 0x1C || 0x4 || Number of wowl wakeups where the cause is unrecognized.
 +
|}
 +
 +
= SleepStats =
 +
This is a 0x38-byte struct.
 +
 +
During RequestWakeUp when handling [[#Cmd19|wowl]], this data in state is updated by adding each field with the corresponding field from iovar "sleep_stats_get".
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x4 ||
 +
|-
 +
| 0x4 || 0x4 ||
 +
|-
 +
| 0x8 || 0x4 ||
 +
|-
 +
| 0xC || 0x4 ||
 +
|-
 +
| 0x10 || 0x4 ||
 +
|-
 +
| 0x14 || 0x4 ||
 +
|-
 +
| 0x18 || 0x4 ||
 +
|-
 +
| 0x1C || 0x4 ||
 +
|-
 +
| 0x20 || 0x4 ||
 +
|-
 +
| 0x24 || 0x4 ||
 +
|-
 +
| 0x28 || 0x4 ||
 +
|-
 +
| 0x2C || 0x4 ||
 +
|-
 +
| 0x30 || 0x4 ||
 +
|-
 +
| 0x34 || 0x4 ||
 +
|}
    
= FwVersion =
 
= FwVersion =

Navigation menu