Skip to content

Commit b12aee3

Browse files
Update SMC error messages
1 parent e3524fd commit b12aee3

File tree

1 file changed

+54
-52
lines changed

1 file changed

+54
-52
lines changed

SystemMonitor/SensorsHandler.swift

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -276,57 +276,59 @@ func acceptKey(key: UInt32, type: UInt32) -> Bool {
276276

277277
func errorCodeToString(errorCode: Int32) -> String {
278278
let map = [
279-
kIOReturnSuccess: "success",
280-
kIOReturnError: "general error",
281-
kIOReturnNoMemory: "memory allocation error",
282-
kIOReturnNoResources: "resource shortage",
283-
kIOReturnIPCError: "Mach IPC failure",
284-
kIOReturnNoDevice: "no such device",
285-
kIOReturnNotPrivileged: "privilege violation",
286-
kIOReturnBadArgument: "invalid argument",
287-
kIOReturnLockedRead: "device is read locked",
288-
kIOReturnLockedWrite: "device is write locked",
289-
kIOReturnExclusiveAccess: "device is exclusive access",
290-
kIOReturnBadMessageID: "bad IPC message ID",
291-
kIOReturnUnsupported: "unsupported function",
292-
kIOReturnVMError: "virtual memory error",
293-
kIOReturnInternalError: "internal driver error",
294-
kIOReturnIOError: "I/O error",
295-
kIOReturnCannotLock: "cannot acquire lock",
296-
kIOReturnNotOpen: "device is not open",
297-
kIOReturnNotReadable: "device is not readable",
298-
kIOReturnNotWritable: "device is not writeable",
299-
kIOReturnNotAligned: "alignment error",
300-
kIOReturnBadMedia: "media error",
301-
kIOReturnStillOpen: "device is still open",
302-
kIOReturnRLDError: "rld failure",
303-
kIOReturnDMAError: "DMA failure",
304-
kIOReturnBusy: "device is busy",
305-
kIOReturnTimeout: "I/O timeout",
306-
kIOReturnOffline: "device is offline",
307-
kIOReturnNotReady: "device is not ready",
308-
kIOReturnNotAttached: "device/channel is not attached",
309-
kIOReturnNoChannels: "no DMA channels available",
310-
kIOReturnNoSpace: "no space for data",
311-
kIOReturnPortExists: "device port already exists",
312-
kIOReturnCannotWire: "cannot wire physical memory",
313-
kIOReturnNoInterrupt: "no interrupt attached",
314-
kIOReturnNoFrames: "no DMA frames enqueued",
315-
kIOReturnMessageTooLarge: "message is too large",
316-
kIOReturnNotPermitted: "operation is not permitted",
317-
kIOReturnNoPower: "device is without power",
318-
kIOReturnNoMedia: "media is not present",
319-
kIOReturnUnformattedMedia: "media is not formatted",
320-
kIOReturnUnsupportedMode: "unsupported mode",
321-
kIOReturnUnderrun: "data underrun",
322-
kIOReturnOverrun: "data overrun",
323-
kIOReturnDeviceError: "device error",
324-
kIOReturnNoCompletion: "no completion routine",
325-
kIOReturnAborted: "operation was aborted",
326-
kIOReturnNoBandwidth: "bus bandwidth would be exceeded",
327-
kIOReturnNotResponding: "device is not responding",
328-
kIOReturnInvalid: "unanticipated driver error",
329-
0: "null"
279+
kIOReturnSuccess: "KERN_SUCCESS",
280+
kIOReturnError: "general error",
281+
kIOReturnNoMemory: "can't allocate memory",
282+
kIOReturnNoResources: "resource shortage",
283+
kIOReturnIPCError: "error during IPC",
284+
kIOReturnNoDevice: "no such device",
285+
kIOReturnNotPrivileged: "privilege violation",
286+
kIOReturnBadArgument: "invalid argument",
287+
kIOReturnLockedRead: "device read locked",
288+
kIOReturnLockedWrite: "device write locked",
289+
kIOReturnExclusiveAccess: "exclusive access and device already open",
290+
kIOReturnBadMessageID: "sent/received messages had different msg_id",
291+
kIOReturnUnsupported: "unsupported function",
292+
kIOReturnVMError: "misc. VM failure",
293+
kIOReturnInternalError: "internal error",
294+
kIOReturnIOError: "General I/O error",
295+
kIOReturnCannotLock: "can't acquire lock",
296+
kIOReturnNotOpen: "device not open",
297+
kIOReturnNotReadable: "read not supported",
298+
kIOReturnNotWritable: "write not supported",
299+
kIOReturnNotAligned: "alignment error",
300+
kIOReturnBadMedia: "Media Error",
301+
kIOReturnStillOpen: "device(s) still open",
302+
kIOReturnRLDError: "rld failure",
303+
kIOReturnDMAError: "DMA failure",
304+
kIOReturnBusy: "Device Busy",
305+
kIOReturnTimeout: "I/O Timeout",
306+
kIOReturnOffline: "device offline",
307+
kIOReturnNotReady: "not ready",
308+
kIOReturnNotAttached: "device not attached",
309+
kIOReturnNoChannels: "no DMA channels left",
310+
kIOReturnNoSpace: "no space for data",
311+
kIOReturnPortExists: "port already exists",
312+
kIOReturnCannotWire: "can't wire down physical memory",
313+
kIOReturnNoInterrupt: "no interrupt attached",
314+
kIOReturnNoFrames: "no DMA frames enqueued",
315+
kIOReturnMessageTooLarge: "oversized msg received on interrupt port",
316+
kIOReturnNotPermitted: "not permitted",
317+
kIOReturnNoPower: "no power to device",
318+
kIOReturnNoMedia: "media not present",
319+
kIOReturnUnformattedMedia: "media not formatted",
320+
kIOReturnUnsupportedMode: "no such mode",
321+
kIOReturnUnderrun: "data underrun",
322+
kIOReturnOverrun: "data overrun",
323+
kIOReturnDeviceError: "the device is not working properly!",
324+
kIOReturnNoCompletion: "a completion routine is required",
325+
kIOReturnAborted: "operation aborted",
326+
kIOReturnNoBandwidth: "bus bandwidth would be exceeded",
327+
kIOReturnNotResponding: "device not responding",
328+
kIOReturnIsoTooOld: "isochronous I/O request for distant past!",
329+
kIOReturnIsoTooNew: "isochronous I/O request for distant future",
330+
kIOReturnNotFound: "data was not found",
331+
kIOReturnInvalid: "should never be seen"
330332
]
331-
return map[errorCode] ?? "null"
333+
return map[errorCode] ?? "no defined"
332334
}

0 commit comments

Comments
 (0)