For some reason the geniuses at Huawei decided to disable logcat on the Huawei U8185. No doubt they view it as a security (by obscurity) measure, but it’s really freakin’ annoying as I’m actually trying to do some development on this device. Despite logging being ON in the kernel, logcat is not happy.
$ adb logcat Unable to open log device '/dev/log/main': No such file or directory
HUAWEI, Y U HATE DEVS?
Enabling logcat: the lame way
The lame way to enable this is to toggle the LOG state to ON from the secret menu on a stock ROM, dial
*#*#2846579#*#* and then:
- Background setting
- Log setting
- Log switch
- LOG on
Now reboot your phone and logcat should be working. I got the tip about the secret menu from a U8815 thread over at Modaco. By the way, this way is lame because it only works in Huawei’s stock ROM.
Enabling logcat: the l33t way
In comparing the U8185 kernel’s logger.c with one from a device with a working logcat, I noticed that Huawei modified their kernel to conditionally enable the log device depending on the state of a flag in nvram. This is the flag we’re toggling using the secret menu in the stock ROM.
Anyways, it’s easy enough to just disable Huawei’s addition, and initialize the log device unconditionally. See my commit on github.
Now I can get back to solving real problems (as opposed to fake ones, imposed by Huawei’s weird engineering policy decisions!).