I have a rooted Xperia E C1504 on which I would like to access the FM receiver chipset for a custom FM radio app I'm working on. Trouble is that my fcntl open() call to /dev/radio0 keeps returning EBUSY (errno 16: device or resource busy). Here is the code I'm using to try to open the device (executed in a root shell):
#define DEFAULT_RADIO_DEVICE "/dev/radio0"
...
radio_fd = open(DEFAULT_RADIO_DEVICE, O_RDWR);
I also tried open(DEFAULT_RADIO_DEVICE,O_RDONLY), though I'm pretty sure I need write access to the device, and still received EBUSY.
I verified that the radio device is functional with the stock FM Radio app, which was able to tune to a frequency and receive PCM successfully. I turned this app off via its power button icon (this should release /dev/radio0, correct?) and explicitly force-stopped the stock FM Radio app from the Settings->Apps menu, and even deleting Radio.apk (the stock FM Radio app package) from /system/apps with Root Browser and then rebooting the phone, but my program continues to return EBUSY when it executes the above instruction.
What is the best way to investigate what process might be holding a lock on /dev/radio0 and kill it? I tried [adb shell "su -c 'lsof /dev/radio0'"] but the returned list didn't have any entries exactly matching /dev/radio0. There were quite a few cases of '/dev/log/radio' and almost 300 cases of just the word 'radio', but I was expecting to see something listed as using exactly /dev/radio0. I also tried [adb shell ps | grep radio] which returned
root 79 2 0 0 ffffffff 00000000 S kfmradio
radio 155 140 20416 3232 ffffffff 00000000 S /system/bin/rild
radio 178 140 7820 2472 ffffffff 00000000 S /system/bin/cnd
radio 215 140 6152 500 ffffffff 00000000 S /system/bin/qmuxd
radio 231 140 7288 752 ffffffff 00000000 S /system/bin/netmgrd
radio 610 157 311448 35704 ffffffff 00000000 S com.android.phone
the kfmradio process looked suspicious so I tried killing it, which didn't return any errors, but re-running the filtered ps list above showed that kfmradio was still in the process list (I suppose the OS restarted it?) Any advice regarding troubleshooting EBUSY returns from fcntl open() calls would be very helpful.
Device Model: Sony Xperia E C1504
Linux kernel: 3.4.0
Android OS: 4.1.1
Firmware version: Stock Kernel Xperia E C1505_11.3.A.0.47 (supposed to work for the C1504 as well)
Rooted with: SRSRoot and the 'Gandalf' exploit.