[Touch-packages] [Bug 1489784] Re: No access to the FM tuner on Aquaris BQ45

2016-02-01 Thread Bartosz Kosiorek
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 changed:

  Device Aquaris BQ45 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.
+ 
+ 
+ Some more details:
+ 
+ > I've been looking at the necessary pieces for FM radio support, and I
+ > hope somebody can correct me, but it looks more complicated than I expected.
+ >
+ 
+ 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,

** Also affects: platform-api (Ubuntu)
   Importance: Undecided
   Status: New

** Also affects: media-hub (Ubuntu)
   Importance: Undecided
   Status: New

** Description changed:

  Device Aquaris BQ45 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.
  
- 
- Some more details:
- 
- > I've been looking at the necessary pieces for FM radio support, and I
- > hope somebody can correct me, but it looks more complicated than I expected.
- >
+ Some more details from mailing list:
  
  We discussed this topic lengthily on the list some time ago :) 

[Touch-packages] [Bug 1489784] Re: No access to the FM tuner on Aquaris BQ45

2016-02-01 Thread Launchpad Bug Tracker
Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: platform-api (Ubuntu)
   Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to platform-api in Ubuntu.
https://bugs.launchpad.net/bugs/1489784

Title:
  No access to the FM tuner/radio on Aquaris Bq e4.5

Status in Canonical System Image:
  In Progress
Status in media-hub package in Ubuntu:
  Confirmed
Status in platform-api package in Ubuntu:
  Confirmed
Status in qtmultimedia package in Ubuntu:
  New

Bug description:
  Device Aquaris BQ45 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.

  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,

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-devices-system-image/+bug/1489784/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1489784] Re: No access to the FM tuner on Aquaris BQ45

2016-02-01 Thread Launchpad Bug Tracker
Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: media-hub (Ubuntu)
   Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to platform-api in Ubuntu.
https://bugs.launchpad.net/bugs/1489784

Title:
  No access to the FM tuner/radio on Aquaris Bq e4.5

Status in Canonical System Image:
  In Progress
Status in media-hub package in Ubuntu:
  Confirmed
Status in platform-api package in Ubuntu:
  Confirmed
Status in qtmultimedia package in Ubuntu:
  New

Bug description:
  Device Aquaris BQ45 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.

  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,

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-devices-system-image/+bug/1489784/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1489784] Re: No access to the FM tuner on Aquaris BQ45

2016-02-01 Thread Bartosz Kosiorek
** Also affects: qtmultimedia (Ubuntu)
   Importance: Undecided
   Status: New

** Summary changed:

- No access to the FM tuner on Aquaris BQ45
+ No access to the FM tuner/radio on Aquaris BQ45

** Summary changed:

- No access to the FM tuner/radio on Aquaris BQ45
+ No access to the FM tuner/radio on Aquaris Bq e4.5

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to platform-api in Ubuntu.
https://bugs.launchpad.net/bugs/1489784

Title:
  No access to the FM tuner/radio on Aquaris Bq e4.5

Status in Canonical System Image:
  In Progress
Status in media-hub package in Ubuntu:
  Confirmed
Status in platform-api package in Ubuntu:
  Confirmed
Status in qtmultimedia package in Ubuntu:
  New

Bug description:
  Device Aquaris BQ45 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.

  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,

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-devices-system-image/+bug/1489784/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp