No access to the FM tuner/radio on Aquaris Bq e4.5, e5 and m10

Bug #1489784 reported by Serge CLAUS
102
This bug affects 37 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
Wishlist
Unassigned
media-hub (Ubuntu)
Confirmed
Undecided
Unassigned
platform-api (Ubuntu)
Confirmed
Undecided
Unassigned
qtmultimedia (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Device Aquaris BQ e45, e5, m10 as a buitin hardware FM tuner.
On "factory" mode this device works.

The device does not seem known by the kernel and there is no API to develop an FM radio application.

The C code for the FM chip:
https://github.com/Sturmflut/mtkfmcli
Still missing Audio part.

Some more details from mailing list:

We discussed this topic lengthily on the list some time ago :) It's
not like we don't want to
support FM radio, but the lack of a common Android HAL for FM radio
access would force us to
maintain an FM radio abstraction ourselves (more on that below). In
addition, most of the device-specific
radio apps require elevated privileges to run as they directly access
the FM radio HW (not multiplexed by a system service).

> For some reason Android doesn't have an FM radio API and leaves it up to
> the manufacturers to come up with something. I've looked at several
> devices, among them the bq Aquaris E4.5, and every SoC manufacturer
> seems to have a different opinion on how to do it.
>
> Some ship no FM radio at all.
>
> Some seem to ship drivers for the Linux V4L subsystem.
>
> MediaTek (Aquaris E4.5 and E5) decided to implement custom kernel
> drivers with a custom character device (/dev/fm) and custom ioctl
> commands. There seem to be userspace libraries (libfm*) including a JNI
> wrapper in /system/lib of the Android container on our Ubuntu phones.
>
> Because there is no standard API, there are no generic FM radio apps for
> Android, and pretty much every manufacturer ships a custom app for his
> own SoC(s) and/or device(s).
>
>
> I'll try to come up with a piece of C code for the command line that can
> at least initialize and tune the FM radio on the Aquaris E4.5 and E5.
> The long-term goal could be to turn this into plugins for an extended
> media-hub.
>

If you are interested in helping to enable the functionality, the
correct chain for integrating the feature would be:

[1.] Add a (potentially limited) API to lp:platform-api, that exposes
a simple common C interface to the Ubuntu side.
[2.] Provide an implementation of the API in platform-api/android (see
http://bazaar.launchpad.net/~phablet-team/platform-api/trunk/files/head:/android/)
[2.1] Provide a dummy fallback implementation for devices that do not
support FM radio of any kind.
[3.] Expose the respective hardware functionality to media-hub.
Multiple ways are possible, but we would need to significantly adjust
the interfaces
to support fm radio semantics (switching stations, rds, automatic scans etc.)
[4.] Adjust Qt's radio abstraction and come up with a Ubuntu Touch
specific backend implementation, that either:
  [4.1] Leverages the API in [1.] directly (would require any app to
have special privileges in accessing the system).
  [4.2] Leverages the API in [3.] (which is the clean way of
integration FM radio support).

For starters, [1.], [2.], [2.1] and [4.1] should be good enough to get started.

Cheers,

Changed in canonical-devices-system-image:
assignee: nobody → John McAleely (john.mcaleely)
importance: Undecided → Wishlist
status: New → Confirmed
Sturm Flut (sturmflut)
Changed in canonical-devices-system-image:
assignee: John McAleely (john.mcaleely) → Simon Raffeiner (sturmflut)
status: Confirmed → In Progress
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Here are some details taken from mailing list:

Good morning dear list,

it's time for the "good news, bad news" part again.

The good news: I managed to attach gdb to the Factory Mode [1] binary,
and with some debugging-symbol-building and gdb-command-writing it's now
starting to get possible to catch every ioctl and semi-automatically
dump the parameters. Those of you who know a bit about debugging may see
the value in a gdb output like this one:

Breakpoint 1, 0xb6f41298 in ioctl () from /system/lib/libc.so

lrwx------ root root 2015-12-16 21:44 25 -> /dev/fm
FM_IOCTL_POWERUP
$5 = {err = 0 '\000', band = 1 '\001', space = 1 '\001', hilo = 0
'\000', freq = 880}

Turns out you only need three ioctl()s to power on and tune the whole FM
chip: FM_IOCTL_POWERUP, FM_IOCTL_MUTE and FM_IOCTL_ANA_SWITCH.

The bad news: We also catched all the ioctls necessary to tell the audio
chip to forward the FM signal to the headphones, and it's 90 (!) calls.
So our problem isn't the FM radio, it actually seems to be the audio
subsystem.

cheers,
Simon

[1]
http://sturmflut.github.io/ubuntu/bq/2015/05/04/hacking-the-bq-part-2-factory-mode/

description: updated
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in media-hub (Ubuntu):
status: New → Confirmed
Changed in platform-api (Ubuntu):
status: New → Confirmed
summary: - No access to the FM tuner on Aquaris BQ45
+ No access to the FM tuner/radio on Aquaris BQ45
summary: - No access to the FM tuner/radio on Aquaris BQ45
+ No access to the FM tuner/radio on Aquaris Bq e4.5
summary: - No access to the FM tuner/radio on Aquaris Bq e4.5
+ No access to the FM tuner/radio on Aquaris Bq e4.5, e5 and m10
description: updated
Revision history for this message
Krzysztof Tataradziński (ktatar156) wrote :

I think there is similar problem with MX4.

Revision history for this message
Krzysztof Tataradziński (ktatar156) wrote :

Any progress/ETA?

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in qtmultimedia (Ubuntu):
status: New → Confirmed
summary: - No access to the FM tuner/radio on Aquaris Bq e4.5, e5 and m10
+ No access to the FM tuner/radio on Meizu MX4, Aquaris Bq e4.5, e5 and
+ m10
Revision history for this message
adasiko (adasiko256) wrote : Re: No access to the FM tuner/radio on Meizu MX4, Aquaris Bq e4.5, e5 and m10

Meizu MX4 hasn't FM radio support by hardware.

summary: - No access to the FM tuner/radio on Meizu MX4, Aquaris Bq e4.5, e5 and
- m10
+ No access to the FM tuner/radio on Aquaris Bq e4.5, e5 and m10
Changed in canonical-devices-system-image:
status: In Progress → Confirmed
assignee: Sturm Flut (sturmflut) → nobody
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.