Diags

From The iPhone Wiki
Jump to: navigation, search

Diags is a diagnostic image that is installed on devices, and is used for testing in factories. It is commonly located in /AppleInternal/Diags/bin/diag.img4 for 64 bit devices, or /AppleInternal/Diags/bin/diag.img3 for 32 bit devices.

A iPhone 8 running diags

Commands

32 bit Diags

EDK Boot Loader commands (help <command> for more info):

 "3dbli2bb2rcv"	Reverse Receiver test - Record LI - 3db down
 "3dbli2bb2rcv2"	Reverse Receiver test -  Playback RCVR/ Record MIC  - 3db down
 "3dbli2bb2spk"	Reverse Speaker test - Record  - 3db down
 "3dbli2bb2spk2"	Reverse Speaker test -  Playback - 3db down
 "aboutCB"	display conrolbit information on the screen
 "aboutdev"	display device information on the screen
 "accdet"	Get ACCDet pin status
 "accel"	Test accelermeter in fct &fatp station
 "accid"	Read Acc Identify
 "accsw"	--[on|off|auto]: Diagnostic Acc3V3
 "adc"		get the ADC value from the PMU
 "als"		[--raw|--iqc|--tilt|--ircal|--luxcal|--lux|--commit|--interrupt]ALS calibration and tests
 "alsprox"	[--ui|--sample|--interval]; Sample refrences number of samples taken, interval is the wait time in ms between samplesALS and PROX Logging test
 "amcss"	 :Run AudioDE
 "ap2codec"	 --[hp|lo|spk|ear|len [length]]: Playback audio data to headphone, lineout, speaker, or earpiece for length seconds (default 2s)
 "ap2hpi2s2ap"	Codec I2S Loopback Test - Playback/Record Codec
 "ap2hppcm2ap"	Codec PCM Loopback Test - Playback/Record Codec
 "ap2hppcm2ap2"	Codec PCM Loopback Test - Playback HP
 "ap2rcv"	AP to receiver or speaker or HP
 "audioinit"	- Initialize the codec
 "bat"		Read battery information
 "batdev"	Read or Write to battery
 "batdisconnect"	Disable battery power at the terminals.
 "batfwupdate"	Download firmware to battery 
 "batgg"	Diag test to check FCC and Ra corruption
 "batqmax"	QMax Cell Test
 "batreadblock"	Read battery block 

 "batSN"	Read battery SN 
 "battool"	List the Battery information
 "batwriteblock"	Write battery block 
 "bbinit"	power on baseband and check BB response
 "bboff"	use gpio single power donwn Baseband
 "bbon"		use gpio single power on Baseband
 "bl"		BackLight Test
 "blockdevice"	Show information about boot devices
 "BPC"		Switch to Uart to BB passthrough mode
 "bt"		check BT response and verify
 "bthostwake"	Test BT_HOST_WAKE line by checking PMU GPIO10
 "buck"		set the buck voltage value
 "button0"	Test buttons without menu key of the unit
 "buttont"	[--alt] Test buttons on the unit
 "camera"	camera command that can run canned tests.
 "camisp"	camera command that can run in seperat steps.
 "cat"		Print the contents of a file.
 "charge"	set charge for system
 "chipid"	 :Show ChipID
 "clcd"		[--id (--iqc)]
 "clkmon"	[signal/off]; Set Clock Test out pin to specified signal or switch it off
 "codec"	 -[r/w/a][reg][data]
 "codec2ap"	 --[li|intmic|extmic|len [length]]: Record audio data from linein, internal mic, or external mic for length seconds (default 2s)
 "compass"	Compass tests
 "confct"	[R G B]
 "cvbs"		[get] external Video device
 "d2bb"		Enable dock uart directly to Baseband
 "dacff"	:write 0xffff to DAC's for 1 sec. output on HP/LO
 "debug"	Turns debugging on/off.
 "device"	Interfaces with a devices of the system.
 "dfufile"	Use dfu protocol to transfer file.
 "directory"	 dirdev [*match]; directory listing of dirdev. opt match a substring
 "DisCfg#"	Display CFG systemcfg
 "DisOpts"	Display OPTS systemcfg
 "displayPort"	Tests various DisplayPort functionalities - HotPlugDetect, EDID, BIST patterns, FrameBuffers
 "duplexaudio"	Duplexes I2s/PCM format audio over an I2s interface specified (relative to the AP).
 "flin2rcv"	:Linein-Receiver, MicIn-LO passthrough
 "flin2rcvh"	:Linein-Receiver, MicIn-LO passthrough
 "flin2spk"	:Linein-Speaker, MicIn-LO passthrough
 "flin2spkh"	:Linein-Speaker, MicIn-LO passthrough
 "fm"		--[port [0|1]|portcfg [i2s|pcm]|mode [master|slave]|rec|pbk|passthrough|len [length]|analyse]
 "fwp"		Test FireWire Present
 "gpio"		Test button status of unit
 "grape"	 [--power(--on|--off)|--rawdata|--1v8(--on|--off)|--18v(--on|--off)        |--fwdl|--ver|--critical|--trailtest [--iqc]|--ninesquare|--digitest(--board|--grape|--open|--shorts)]
 "grapecs"	: Test SPI4_GRAPE_CS_L
 "gyro"		Gryoscope test
 "help"		[cmd]; Help on cmd or a list of all commands if cmd is ommited
 "hm2bb2hp"	:Audio test-WiredMic to BB to HeadPhone - Record
 "hm2bb2hp2"	:Audio test-WiredMic to BB to HeadPhone - Playback
 "HP"		Tool to init/reset Hightland Park as well as read/write it registers
 "HPct"		Highland Park CloseTalk Setup
 "HPft"		Highland Park FarTalk Setup
 "HPhpm"	Highland Park Audio test-HeadPhone Test:multi tone stereo 8kHz 16bit
 "HPloop"	Highland Park Audio loop back
 "hpm"		:Audio test-HeadPhone Test:multi tone
 "HPplay"	Highland Park Audio Playback from file
 "HPrec"	Highland Park Audio Record to file
 "hps"		:Audio test-HeadPhone Test:single tone
 "HPspr"	Highland Park Simultaneous Audio Playback and Record
 "HPspur"	Highland Park Simultaneous Playback and Record via arbitrary ports
 "i2c"		generic read/write to I2C device
 "i2cdevice"	generic read from I2C device by register
 "iis2mic"	Microphone test - Record
 "iis2mic2"	Microphone test -  Playback
 "iis2rcv"	Receiver test - Record
 "iis2rcv2"	Receiver test -  Playback
 "iis2spk"	Speaker test - Record
 "iis2spk2"	Speaker test -  Playback
 "im2hp"	:Audio test-INT mic hp passthrough
 "im2lo"	:Audio test-INT mic hp passthrough
 "im2rcv"	:Audio test-INT mic - receiver passthrough
 "im2spk"	:Audio test-INT mic spk passthrough
 "imei"		Print IMEI information
 "LCM"		 --on:Turn on the LCD interface
 --off:Turn off the LCD interface
 "legal"	Outputs the copyright for any libraries used by Diags.
 "li2bb2rcv"	Reverse Receiver test - Record LI
 "li2bb2rcv2"	Reverse Receiver test -  Playback RCVR/ Record MIC
 "li2bb2rcv3"	Reverse Receiver test -  Playback LO
 "li2bb2spk"	Reverse Speaker test - Record
 "li2bb2spk2"	Reverse Speaker test -  Playback
 "li2bt2hp"	BlueTooth Test - Playback/Record BlueTooth
 "li2bt2hp2"	BlueTooth Test - Playback HP
 "lilo"		:LineIn to LineOut/HP bypass
 "lin2rcv"	:Linein-Receiver passthrough
 "lin2spk"	:LineIn-Speaker passthrough
 "lipm"		:Audio Test-play recorded wave file
 "lirm"		:Audio test-recordd audio file
 "listclocks"	List frequency of PMGR clocks
 "loopaudio"	Loops I2s/PCM format audio over an I2s interface specified (relative to the AP). [DEPRECATED - use duplexaudio instead.]
 "memrw"	[r/w/o/a] [address] [value] Read/write/or/and from memory
 "menu"		: Navigate menu items in Display
 "micpm"	:Audio Test-play recorded wave file
 "micrm"	:Audio test-recordd audio file
 "mictest"	--[len[length]|passthreshold|override|dumpstart|print|stats]: Internal mic self test
 "mikey"	 Mikey Tests
 "mipi"		 on [lanes(1|2|4)] [bpp(2|4)] [freq] | off | enable | disable | sleep [on|off] | highspeed [on|off] | idle | file | backlight [on|off] | invert [on|off] | fill [hex] [hex] | power [on|off] | gamma [file] | write | longwrite | read | longread
 "mipitest"	[--ecc (--iqc)]
 "nandcsid"	 Read Nand Chip ID and detect ID mismatch
 "nandlayout"	 Verify the Nand layout is correct
 "nandsize"	 Nand testing
 "nanduid"	 Read Unique ID from each Nand die
 "OTASMS"	Test the OTA and SMS
 "pattern"	[--iqc [#]|--fatp [#]] [n]:Test LCD display pattern[n]
 "playaudio"	Plays audio from the selected output(s).
 "pmuadc"	PMU ADC test
 "pmubutton"	pmu button test
 "pmustat"	[all|chipid|btn|vbus|chgr|gpio|misc|temp] 
 "pmuswif"	Test pmu swi interface
 "pmutemp"	PMU TEMP test
 "prox"		 Return prox raw data
 "quit"		Quit EBL
 "recordaudio"	Records I2S/PCM audio data from a specified I2S port (relative to the AP)
 "reset"	; Resets the whole system
 "routeaudio"	Sets up audio routing.
 "rstbb"	use bb_rst single reset Baseband
 "rtc"		Set or get the RTC from PMU
 "sdiospeed"	 targetspeed (Hz)
 "setu2sto"	Set u2s timeout in micro secs
 "setvol"	 - Sets volumes (run with no argument for help)
 "setvol"	 set Headphone/LineIn/LineOut
 "simdet"	Sim Tray and Card detect
 "sleep"	Set system to sleep state
 "sn"		Read/Write serial number
 "strobe"	--[init|set_power <mode> <level>|set_mode <mode>|set_duration <us>|sw_sync|hw_sync|on|off
 "swif"		backlight test using SWIF
 "syscfg"	[init | add | print | list | type] <KEY> <value1> <value2> ...; System Config
 "tag"		Turns tagging of data on/off.
 "tat"		Send"AT+COPS=0" to BB after removing dummy cable
 "temp"		Return various temperatures by SerialIoBB from BB
 "testmemory"	Run data and address patterns to exercise DRAM subsystem
 "u2g"		Switch to Uart to GPS passthrough mode
 "u2s"		 Switch to Uart to SDIO passthrough mode
 "u2u"		Switch to Uart to BT passthrough mode
 "uart"		Test the uart receive command
 "usbp"		Test USB Present
 "version"	Diag Version
 "vfct"		[R G B]
 "vibrator"	Vibrator Test
 "vof"		Video off
 "von"		Video on
 "wait"		[ms]; Wait ms milliseconds
 "wakeevent"	Select wake event for wakeup for PMU STANDBY or Hibernate mode
 "wakeoncall"	test wake on call by checking PMU GPIO2
 "wdmic"	:Audio test-HP mic passthrough
 "wifi"		: WiFi Full Self test
 "wlanhostwake"	Test the WLAN_HOST_WAKE line - PMU GPIO 7

64 bit Diags

DiagShell builtin commands:
 "time"		time <command-line ...>
 "echo"		echo <arguments ...>
 "waitfor"	waitfor <timeout-milliseconds> <string-to-match>
 "lua"		lua [options] [script [args]]
 "repeat"	repeat <time-spec> <command line ...>
 "alias"	alias [<name>[=<command line>]]
 "unalias"	unalias <name>
 "true"		true
 "false"	false
 "args"		args <command line ...>
EDK Boot Loader commands (help <command> for more info):
 "aboutCB"	display conrolbit information on the screen
 "aboutdev"	display device information on the screen
 "accessory"	Command to change power settings as well as identifying accessories connected to the unit
 "aes"		Command for AES encryption/decryption
 "als"		ALS Tests and Calibration
 "amux"		Analog Mux selection command
 "aspversion"	ASP Protocol Version - current and expected
 "audio"	General command to hande resetting/blanking/scripting of the audio subsystem
 "audioparam"	Audio parameter retrieval/setting utility
 "audioreg"	Manages register operations on audio blocks in the system
 "barcode"	Show S/N and ECID barcode
 "baseband"	Command to control/test baseband functionality
 "battery"	Command to display basic information about the battery
 "baud"		<baud rate> : Set UART Baud rate
 "bl"		BackLight Test
 "blockdevice"	Show information about boot devices
 "bluetooth"	Command to control/test bluetooth functionality
 "boardid"	Get the board ID
 "boardrev"	Get the board revision
 "bonfire"	Run Bonfire
 "bootcfg"	Get the boot configuration
 "buckcheck"	Buck voltage check
 "button"	Test individual buttons on the unit
 "buttoncnt"	[--dqe] Count button presses on the unit
 "camisp"	camera command that can run in seperat steps.
 "cat"		Print the contents of a file.
 "cbcolor"	iPX Control Bit - Set screen color based on number of passed stations
 "cbdump"	iPX Control Bit - Dump the CB area from the NAND
 "cberase"	iPX Control Bit - Erase a control bit
 "cbinit"	iPX Control Bit - Initialize control bit area
 "cbread"	iPX Control Bit Read
 "cbreadall"	iPX Control Bit - read all
 "cbwrite"	iPX Control Bit Write
 "charge"	set charge for system
 "chipid"	 :Show ChipID
 "clcd"		[--id (--iqc)]
 "clkmon"	[signal/off]; Set Clock Test out pin to specified signal or switch it off
 "consoleformat"	Command to control the formatting of text display on serial output mediums like the console
 "consolerouter"	Main command that deals with all things console in the system
 "daisy"	return X162 daisy chain  GPIO state
 "debug"	Turns on/off global debug levels in the system
 "device"	Interfaces with a devices of the system.
 "dfufile"	Use dfu protocol to transfer file.
 "directory"	 dirdev [*match]; directory listing of dirdev. opt match a substring
 "DisCfg#"	Display CFG systemcfg
 "DisOpts"	Display OPTS systemcfg
 "display"	Command to control display
 "displayid"	Get the display ID
 "displaytext"	Display text on the unit's screen
 "dumpmemmap"	Dumps memory map
 "dwi"		backlight test using DWI
 "filelog"	Log formatted console output to a file
 "getnonce"	iPX Control Bit - generate a salt value for control-bit write authentication
 "getvol"	Gets volume information/values from the various audio blocks
 "hash"		compute Hash
 "help"		[cmd]; Help on cmd or a list of all commands if cmd is ommited
 "i2c"		generic read/write to I2C device
 "key"		Read buttons' status from AP side and PMU side
 "legal"	Outputs the copyright for any libraries used by Diags.
 "loopaudio"	Plays/Record full-duplex audio out/in through selected 'playable' and 'recordable' ports on an audio block
 "mbt"		Menu Button Test
 "memcat"	Read memory into file or a file into memory
 "memrw"	Read/write/or/and from memory
 "menu"		: Navigate menu items in Display
 "meta"		[cmd]; Execute cmd as if it was entered at the shell (useful for scripting)
 "mikey"	 Mikey Tests
 "mipi"		Command to interact with mipi
 "mipitest"	[--ecc (--iqc)]
 "mkdir"	mkdir directory_name ...
 "nandcsid"	 Read Nand Chip ID and detect ID mismatch
 "nandppnfwver"	 Prints the PPN Firmware version for all populated CE's
 "nandsize"	 Nand testing
 "nanduid"	 Read Unique ID from each Nand die
 "network"	Command to control network interfac
 "nvram"	Print or modify NVRAM variables
 "oscar"	General command that manages the Oscar chipset
 "pattern"	[--iqc [#]|--dqe [#]|--fatp [#]|--other [#]|--fill [rgb #] [n]:Test LCD display pattern[n]
 "pcie"		qucik pcie test
 "physaddr"	Decodes a physical address into bank/column/row/etc
 "playaudio"	Plays audio out through a selected 'playable' port
 "pmuadc"	PMU ADC Command for Calibration/Reading/Listing Channels
 "pmubutton"	pmu button test
 "pmuevent"	[all|chipid|btn|vbus|chgr|gpio|misc|temp|fault|ouv|clear] 
 "pmugpio"	Set a PMU GPIO to a certain state
 "pmureg"	Print the values of all the pmu registers
 "pmurw"	generic read/write to PMU Registers
 "pmuset"	set the buck and ldo voltages value
 "pmustat"	[all|chipid|btn|vbus|chgr|gpio|misc|temp|fault] 
 "pmutemp"	PMU TEMP test
 "processaudio"	Post-processes audio data using various audio filters registered in the system
 "profile"	Turns profiling on/off, dumps data, and resets profiling data.
 "qrbarcode"	Command for showing the QRbarcode
 "quit"		Quit EBL
 "ramdisk"	Mount/Eject a RAM disk from a dmg file downloaded through USB/DFU.
 "ramlog"	Command to manage the ramlog console sink which can be used for logging text to RAM for timing sensitive issues
 "recordaudio"	Records audio in through a selected 'recordable' port
 "reset"	Resets the system
 "routeaudio"	Sets up audio routing.
 "rtc"		Set or get the RTC from PMU
 "script"	[filename]; Execute the commands in the specified file
 "sensor"	General command that interfaces with the various sensors in the system
 "sensorreg"	General command that allows for reading/writing sensor chipset registers
 "setvol"	Sets volume levels within the various audio blocks
 "sha"		compute sha1
 "siostart"	Starts SIO block 
 "sleep"	Set system to specified sleep state
 "smokey"	EFI diag scripting sequencer
 "smokeyshell"	EFI diag scripting sequencer debug shell
 "sn"		Read/Write serial number
 "soc"		Command for displaying SoC info
 "socgpio"	Set a GPIO to a certain state
 "spi"		Test Spi buses
 "spkid"	Return 1 bit Speaker ID
 "stockholm"	Command to control/test stockholm functionality
 "strobe"	Command to control the Strobe on the System
 "syscfg"	[init | add | print | list | type | delete] <KEY> <value1> <value2> ...; System Config
 "sysinfo"	Dumps system information
 "system"	Command to display basic information about the unit
 "tag"		Turns tagging of data on/off.
 "temperature"	Dump Readings from various Temperature Sensors in the System
 "testCDMADDR"	CDMA DDR test
 "testmemory"	Run data and address patterns to exercise DRAM subsystem
 "touch"	Command for the Touch subsystem
 "tristar"	TriStar test commands
 "uartloopback"	Perform a loopback test on the specified uart. Note that you will have to put the chip into loopback mode using separate commands.
 "uartpassthrough"	pass through uart traffic from dock uart to select uart
 "uartrx"	Receive and store message from uart <uart #>. It will send the message back to uart <uart #> when a <ExitString> is detected.
 "uarttx"	send message to the selected uart
 "usbfs"	Enables/Disables UsbFS (Filesystem-over-USB)
 "usbp"		Test USB Present
 "vbat"		Get the battery voltage from the PMU ADC channel
 "version"	Diag Version
 "vibrator"	Vibrator Test
 "wait"		[ms]; Wait ms milliseconds
 "wakeevent"	Select wake event for wakeup for PMU STANDBY or Hibernate mode
 "wifi"		Command to control/test wifi functionality
 "writefile"	Overwrite the contents of an existing file with console input
 "zerofile"	Zero the contents of an existing file