FM radio: testing instructions and feedback
-
Hi all!
I got to a point where I'm ready to share the work I've been doing on the FM radio service, because it should be testable already. But please note, this is only for the adventurous ones .Enabling your device
Unfortunately there is only a handful of devices supported at the moment:
- BQ E4.5: install the kernel from this release.
- BQ E5: install the kernel from this release.
- Xiaomi Redmi Note 7 Pro: should work out of the box, but you might need to reflash it from the installer (ticking the "bootstrap" checkbox) if you flashed it long ago
- Xiaomi Redmi Note 9 Pro: follow these instructions.
- Are you a maintainer of another device port which has hardware support for FM radio? Get in touch!
NOTE: the warning sign () means that there is a concrete risk to break your device if something goes wrong while following the operations to enable the FM radio, so it's a procedure recommended for expert users only.
Installing the FM radio service
If your device appears in the list above and you've followed the instructions to enable the FM radio on it, the next step is to install the fm-radio-service in your Ubuntu Touch device:
- Download the
fm-radio-service
andfm-radio-tools
packages matching your device's architecture from the latest build. - Copy them to your device, make the root partition writable and install them:
adb push fm-radio-*.deb /home/phablet/ sudo mount -o remount,rw / sudo dpkg -i fm-radio-*.deb
- Start the command-line client:
fm-radio-client.py
- Make sure your wired earphones are connected.
- Press
2
for "Open tuner", then Enter. - Press
7
for "Start playback", then Enter. - You can move to the next or previous station with
5
and6
, and you can change the volume with4
(values are from 0 to 100) - Press
1
to quit the program and stop the radio.
Known issues
- On the BQ phones, the volume is not controllable via the hardware keys. It is probably possible to fix this by writing a pulseaudio module, but before spending time to work on this I'd like to understand how many devices would benefit from this. It's an issue that affects Mediatek-based devices only, and probably not all of them.
- On the Xiaomi devices, radio playback consumes about 10% of the CPU. There should be a way to establish a direct path from the FM radio to the audio device, but so far I haven't been able to find it.
Debugging
If things don't work, please do the following:
- Quit the client application (press
1
, then Enter) - Run
on one terminal and leave it running while executing the next stepFM_RADIO_SERVICE_TIMEOUT=999 fm-radio-service
- Launch the
fm-radio-client.py
program again, and repeat the commands to open the tuner and start the playback - Attach here (or send them privately to me) the output from the
fm-radio-service
program you started on step 2 and the syslog (/var/log/syslog
)
Feedback
Please let me know how it goes. If I get at least some positive feedback, there's a chance we'll see this in one of the next OTAs. I already have a UI application ready -- ugly, but working.
-
@mardy
Tried with BQ 4.5:I don't have any output from fm-radio-client.py , but as i'm underground, it may be because i have no FM signal at all
e.g:1) Quit 2) Open tuner Choose an action: 2 1) Quit 2) Close 3) Set frequency 4) Set volume 5) Scan forward 6) Scan backward 7) Start playback Choose an action: 7 1) Quit 2) Close 3) Set frequency 4) Set volume 5) Scan forward 6) Scan backward 7) Start playback Choose an action:
here is my debug output:
https://paste.ubuntu.com/p/6d5X9ZBbVM/
Will try later on better spot
[EDIT]: Tried with another spot, but where i live the FM signal is very weak. I hear something but sound is choppy
[EDIT]: 2nd try in another spot: It Works
-
@mardy I tried on my BQ U Plus (I'm the official porter, even though the device is not officially in the list).
Error:phablet@ubuntu-phablet:~$ fm-radio-client.py 1) Quit 2) Open tuner Choose an action: 2 Traceback (most recent call last): File "/usr/bin/fm-radio-client.py", line 226, in pick_action command.action() File "/usr/bin/fm-radio-client.py", line 156, in open_tuner tuner_path = service.open_tuner() File "/usr/bin/fm-radio-client.py", line 26, in open_tuner return self.__service.OpenTuner() File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 70, in __call__ return self._proxy_method(*args, **keywords) File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__ **keywords) File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking message, timeout) dbus.exceptions.DBusException: com.lomiri.FMRadioService.Error.ResourceError: Radio backend not available
I checked what CONFIGs are enabled in the kernel:
phablet@ubuntu-phablet:~$ sudo zless /proc/config.gz | grep -iE 'RADIO|FM' CONFIG_BINFMT_ELF=y CONFIG_BINFMT_SCRIPT=y # CONFIG_BINFMT_MISC is not set # CONFIG_HAMRADIO is not set # CONFIG_BTFM_SLIM is not set # CONFIG_BRCMFMAC is not set CONFIG_MEDIA_RADIO_SUPPORT=y CONFIG_RADIO_ADAPTERS=y # CONFIG_RADIO_SI470X is not set # CONFIG_RADIO_SI4713 is not set # CONFIG_RADIO_SHARK is not set # CONFIG_RADIO_SHARK2 is not set # CONFIG_RADIO_TEA5764 is not set # CONFIG_RADIO_SAA7706H is not set # CONFIG_RADIO_TEF6862 is not set # CONFIG_RADIO_WL1273 is not set # Texas Instruments WL128x FM driver (ST based) # CONFIG_RADIO_WL128X is not set CONFIG_RADIO_IRIS=y CONFIG_RADIO_IRIS_TRANSPORT=y CONFIG_RADIO_SILABS=y CONFIG_MMC_SDHCI_PLTFM=y # CONFIG_RTC_DRV_FM3130 is not set # CONFIG_FMC is not set # CONFIG_QFMT_V1 is not set # CONFIG_QFMT_V2 is not set phablet@ubuntu-phablet:~$
CONFIG_RADIO_IRIS
is the module, but it seems to have some issue.
The rootfs.img I actually use is a stable one with some months old. Might it be useful to test with more recent version of edge one for armh?
Btw, the installation of the 3 debs went fine. -
@guf said in FM radio: testing instructions and feedback:
@mardy I tried on my BQ U Plus (I'm the official porter, even though the device is not officially in the list).
Thanks for trying!
CONFIG_RADIO_IRIS
is the module, but it seems to have some issue.
The rootfs.img I actually use is a stable one with some months old. Might it be useful to test with more recent version of edge one for armh?No, a newer rootfs would not help. The service backend does not implement support for the Iris module, but I can try to add it, since it should be exposed as a standard V4L2 device. What does the following command say?
ls -l /dev/fm* /dev/radio*
-
@mardy The output of command:
phablet@ubuntu-phablet:~$ sudo ls -l /dev/fm* /dev/radio* ls: cannot access '/dev/fm*': No such file or directory crw-rw----+ 1 system system 81, 18 Apr 14 1971 /dev/radio0 phablet@ubuntu-phablet:~$
Btw:
phablet@ubuntu-phablet:~$ sudo zless /proc/config.gz | grep -iE 'V4L2' CONFIG_VIDEO_V4L2_SUBDEV_API=y CONFIG_VIDEO_V4L2=y CONFIG_MSM_VIDC_V4L2=y CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE=y # CONFIG_MSM_BA_V4L2 is not set phablet@ubuntu-phablet:~$
-
It's great that you have put effort into this for those who use the feature a lot!
But...
I am not one of those people so I won't be testing this on my BQ E5 HD
Sorry!
-
@guf said in FM radio: testing instructions and feedback:
@mardy The output of command:
phablet@ubuntu-phablet:~$ sudo ls -l /dev/fm* /dev/radio* ls: cannot access '/dev/fm*': No such file or directory crw-rw----+ 1 system system 81, 18 Apr 14 1971 /dev/radio0 phablet@ubuntu-phablet:~$
This looks promising! But you will have to play with the udev rules to change the group of the file to
android_media
, otherwise thephablet
user will not be able to open the device. -
-
Re: FM radio: testing instructions and feedback
Enabling my device, the Xperia X -- First:
phablet@ubuntu-phablet:~$ sudo ls -l /dev/fm* /dev/radio*
[sudo] password for phablet:
ls: cannot access '/dev/fm*': No such file or directory
crw-rw----+ 1 system system 81, 18 Oct 27 1971 /dev/radio0Second: Install the .debs (fm-radio-service; fm-radio-tools). No problem!
Third, Start the command-line client:
phablet@ubuntu-phablet:~$ fm-radio-client.py- Quit
- Open tuner
Choose an action: 2
That is the result:
Traceback (most recent call last):
File "/usr/bin/fm-radio-client.py", line 226, in pick_action
command.action()
File "/usr/bin/fm-radio-client.py", line 156, in open_tuner
tuner_path = service.open_tuner()
File "/usr/bin/fm-radio-client.py", line 26, in open_tuner
return self.__service.OpenTuner()
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 70, in call
return self._proxy_method(*args, **keywords)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in call
**keywords)
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: com.lomiri.FMRadioService.Error.ResourceError: Radio backend not availableSeems to be similar to the output from BQ U Plus, isnΒ΄t it?
(IΒ΄m not a porter or expert, only a user - but really like fm on my phone and missing that in UT.)So, thank u for your work!
-
What should be the next for the Xperia X?
-
@mardy
Wow! FM radio on Ubports would be a dream!It is for sure not one of the priority devices but could fm radio potentially also work on the S3Neo?
zcat /proc/config.gz | grep -n RADIO_IRIS
gives:2587:CONFIG_RADIO_IRIS=y 2588:CONFIG_RADIO_IRIS_TRANSPORT=y
https://forums.ubports.com/topic/3652/call-for-testing-samsung-s3-neo-s3ve3g-owners/91
-
@mardy I have the Redmi Note 9 Pro since yesterday. Since I have to go back from Android 11 to Android 10 anyway, I will download this global version V12.0.3.0.QJZMIXM. Everything else that has to do with the radio I will do at a later date. I tried to get the Redmi Note 7 Pro but no chance.
-
@eichenbast said in FM radio: testing instructions and feedback:
What should be the next for the Xperia X?
The syslog (
/var/log/syslog
) captured while trying the FM radio would be helpfulEdit: ah, sorry, now I see, that this device exposes with the
/dev/radio0
device. That's currently not supported, but I'm working on that too.
Can you please download the fmbin program from here (for 64bit devices) or here (for 32 bit devices), then copy it to the device, make it executable, and run it?Once it starts, type:
init enable
and paste here the syslog.
-
@hsce1 said in FM radio: testing instructions and feedback:
@mardy
Wow! FM radio on Ubports would be a dream!It is for sure not one of the priority devices but could fm radio potentially also work on the S3Neo?
zcat /proc/config.gz | grep -n RADIO_IRIS
gives:2587:CONFIG_RADIO_IRIS=y 2588:CONFIG_RADIO_IRIS_TRANSPORT=y
https://forums.ubports.com/topic/3652/call-for-testing-samsung-s3-neo-s3ve3g-owners/91
Nice! Please follow the instructions from the comment just above this one
-
@dpitti said in FM radio: testing instructions and feedback:
@mardy I have the Redmi Note 9 Pro since yesterday. Since I have to go back from Android 11 to Android 10 anyway, I will download this global version V12.0.3.0.QJZMIXM. Everything else that has to do with the radio I will do at a later date. I tried to get the Redmi Note 7 Pro but no chance.
The Redmi Note 9 Pro works as well, but you need to get a couple of binaries into your vendor partition. I created a script to do it, but it's for advanced users only
https://gitlab.com/mardy/xiaomi-miatoll/-/tree/fm-radio/tools
-
@mardy I'll get that somehow, still have to wait until the bootloader is up. If not, I know there will be radio sometime in the future. I still have my radio app, luckily it works somehow. But I'll try your script first. If I've already read everything, 2 files have to be copied.
-
Hey @mardy, I modified the vendor partition like on Redmi Note 9 Pro for my Poco X3 NFC, which I ported myself and noticed that the FM radio only works after setting
vendor.bluetooth.soc
tocherokee
(It's empty on my device) manually. I could create an overlay for my port which sets that property, but I don't know if it's the best idea or is there something wrong with the FM service? -
@ungeskriptet said in FM radio: testing instructions and feedback:
Hey @mardy, I modified the vendor partition like on Redmi Note 9 Pro for my Poco X3 NFC, which I ported myself and noticed that the FM radio only works after setting
vendor.bluetooth.soc
tocherokee
(It's empty on my device) manually. I could create an overlay for my port which sets that property, but I don't know if it's the best idea or is there something wrong with the FM service?Wow, good work!! The fm-radio service explicitly checks for that property to be set to
cherokee
, but that's just because I saw that the qualcomm FM radio app does the same. You could try to run agetprop
on the device and see if there's some other property which can be used to identify the bluetooth/radio chipset, and then I could add it to the fm-radio-service. Or, indeed, setting that property in the vendor partition would be a solution. -
@mardy Found it. It's called
vendor.qcom.bluetooth.soc
on my device.phablet@ubuntu-phablet:~$ getprop|grep cherokee [vendor.qcom.bluetooth.soc]: [cherokee]
-
@ungeskriptet said in FM radio: testing instructions and feedback:
@mardy Found it. It's called
vendor.qcom.bluetooth.soc
on my device.phablet@ubuntu-phablet:~$ getprop|grep cherokee [vendor.qcom.bluetooth.soc]: [cherokee]
OK, I'll update the service to check that property too.
-
Hi @ungeskriptet, could you please give a try to the fm-radio-service package at https://ci.ubports.com/blue/organizations/jenkins/UBportsCore%2FFM radio service/detail/MR-4/1/artifacts?
Please write your feedback as a comment to https://gitlab.com/ubports/core/fm-radio-service/-/merge_requests/4