Debugging hardware can be tricky especially when doing kernel and drivers development. It might become handy for you to add serial console to your device as well as using JTAG to debug your code.

Serial Port




gdb a very short introduction on the GNU Debugger

perf/oprofile cpu profiling


When encountering wireless bugs, such as connection drop or wpa rekeying issues, it is possible to remotely run tcpdump in order to capture wireless management traffic for later analysis of the communication leading to the problem.

Capture Management Traffic

The command below will spawn a monitor interface with a mac80211 based driver, start tcpdump and save the captured data locally into /tmp:

ssh root@ 'grep -q mon0 /proc/net/dev || /usr/sbin/iw phy phy0 interface add mon0 type monitor;
    /sbin/ifconfig mon0 up; /usr/sbin/tcpdump -s 0 -i mon0 -y IEEE802_11_RADIO -w -' > /tmp/wifi.pcap

A smaller alternative to tcpdump is the iwcap utility. Its MIPS binary only ~5KB large and it does not require libpcap to function. It also supports the filtering of data frames through the -D switch to cut down the amount of captured traffic;

ssh root@ 'grep -q mon0 /proc/net/dev || /usr/sbin/iw phy phy0 interface add mon0 type monitor;
    /sbin/ifconfig mon0 up; /usr/sbin/iwcap -i mon0 -s' > /tmp/wifi.pcap

Logging hostapd behaviour

The following command restarts hostapd in debug mode and stores the log into the local /tmp directory.

ssh root@ 'killall -9 hostapd; /usr/sbin/hostapd -dd /var/run/hostapd-phy0.conf' > /tmp/hostapd.log

Back to top

doc/devel/debugging.txt · Last modified: 2012/11/30 16:48 by karlp