Commit graph

2631 commits

Author SHA1 Message Date
Peter Meerwald
e798969fd5 modules: Fix )== typos
add a space between ) and ==

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Peter Meerwald
f390e6e974 Cleanup !! for bool
!!x makes no sense if x is bool (this is a leftover from the
convertion pa_bool_t -> bool, d806b197)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Tanu Kaskinen
052316e419 alsa-mixer: Merge analog-output-desktop-speaker with analog-output-speaker(-always)
According to David[1], it's unlikely that there are any sound cards
that would have separate "speaker" and "desktop speaker" paths, so
let's remove the unnecessary distinction.

[1] http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/20915/focus=21193
2014-10-28 12:29:43 +02:00
David Henningsson
cc7c626e69 module-card/device-restore: Do not legacy load an empty entry
There is no use in trying to load data in legacy format, if we
already know that there is no data at all.
Also clarify in the debug message whether there is invalid data
or no data at all.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-10-28 10:33:31 +01:00
Tanu Kaskinen
4971dc9ed6 tunnel-sink-new: Fix requested latency check
This fixes a bug in latency configuration. The wrong type in the cast
caused UINT64_MAX being not treated as special, so the configured
latency was set to UINT64_MAX usecs, which of course is absurdly huge
latency.
2014-10-19 14:16:41 +03:00
Tanu Kaskinen
0df4d56cf8 bluetooth: Move stuff to pa_bluetooth_transport_put/unlink()
This should not have any effect on behaviour. The goal is to align
with the pattern that I think we should follow:

Object initialization:
 - put() is the place to create references from other objects to the
   newly created object. In this case, adding the transport to
   discovery->transports was moved from new() to put, and adding the
   transport to device->transports was moved from set_state() to
   put().

Object destruction:
 - unlink() undoes put() and removes all references from other objects
   to the object being unlinked. In this case setting the
   device->transports pointer to NULL was moved from set_state() to
   unlink(), and setting the discovery->transports pointer to NULL was
   moved from free() to unlink().
 - free() undoes new(), but also calls unlink() so that object owners
   don't need to remember to call unlink() before free().
2014-10-19 14:04:46 +03:00
Tanu Kaskinen
9c135b998c tunnel-sink-new: Limit the maximum latency to 200 ms
The default maximum latency is 10 seconds, which is not good,
especially since the tunnel sink doesn't support rewinding. Due to the
lack of rewinding, e.g. volume changes take a long time with large
latencies.
2014-10-09 15:45:07 +03:00
Ricardo Salveti de Araujo
9dd4e8df3e module-stream-restore: use entry_write when filling up the database
It seems at some point the code migrated to use the entry_write calls,
but fill_db is still using the old syntax, causing the entry to be
invalid.

The crash happens when clean_up_db gets called, which then calls
entry_read, causing the crash.

Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
2014-10-06 15:50:03 +02:00
Tanu Kaskinen
8fb5e7c32a switch-on-connect: Initialize userdata contents to zero
This fixes userdata.only_from_unavailable being uninitialized in case
the user doesn't give the value in modargs.
2014-10-06 13:30:35 +03:00
David Henningsson
8bfd38d6ca module-mmkbd-evdev: Don't crash on failure to close fd
If the keyboard is unplugged, it looks like the kernel is reporting
back -ENODEV when trying to close the fd. This is probably a kernel
error, but still, it's better to complain than to crash.

Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=80867
Reported-by: Stelios Bounanos
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-10-03 14:23:59 +02:00
Hui Wang
0e44b127d0 module-switch-on-port-available: make the output more accurate
It is possible that the chosen active_port doesn't equal
new_data->active_port, using p->name is more accurate.

Please refer to sink_new_hook_callback()

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2014-09-28 13:55:20 +03:00
Pali Rohár
380a7fc240 bluetooth: bluez4: Add profile name to sinks and sources
Now a2dp and hsp sinks and sources will have different names which means that
applications and other modules can use sink/source to distinguish selected
profile.

Module module-device-restore uses sink/source name and port name as identifier,
so if different profiles have different names module-device-restore can store
volume settings for each profile.

So with this patch it is possible to configure different volume settings for
a2dp and hsp profiles.

This patch does not change port names so gnome applications will be happy.

Note that similar patch is needed also for bluez5, but I'm not using bluez5
so I cannot write or test it.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2014-09-28 13:34:27 +03:00
Hui Wang
1ff4f1b67a module-switch-on-connect: add an argument for conditionally connecting
On a machine without fixed connecting audio devices like internal
microphone or internal speaker, and when there is no external audio
devices plugging in, the default source/sink is alsa_input/alsa_output
and there is no input devices/output devices listed in the gnome
sound-setting.

Under this situation, if we connect a bluetooth headset, the gnome
sound-setting will list bluez input/output devices, but they are not
active devices by default. This looks very weird that sound-setting
lists only one input device and one output device, but they are not
active. To change this situation, we add an argument, the policy is
if a new source/sink is connected and current default source/sink's
active_port is AVAILABLE_NO, we let the new added one switch to
default one.

BugLink: http://bugs.launchpad.net/bugs/1369476
Signed-off-by: Hui Wang <hui.wang@canonical.com>
2014-09-22 13:26:32 +02:00
Luiz Augusto von Dentz
eb108b3539 bluetooth: Allow policy module to pick 'off' profile
This allow 'off' profile to be choosen when no other profile is available
which is considered better since it requires less resources than other
profiles.
2014-09-18 10:54:23 +03:00
João Paulo Rechi Vita
7fac520d89 bluetooth: Switch transport state to idle in case of HUP
In case the socket HUP the transport state should be set to idle which
will indicate the profile is no longer available.
2014-09-18 10:53:49 +03:00
João Paulo Rechi Vita
75bf00a507 bluetooth: Implement org.ofono.HandsfreeAudioAgent.NewConnection() 2014-09-16 14:46:40 +03:00
David Henningsson
300a5e3ed7 alsa: Remove unnecessary hctl handles being passed around
Now that we have switched to using the mixer handle only,
there is no use for sending hctl handles around.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
David Henningsson
f2120fc2b6 alsa-mixer/card: Move to use the new mixer interface
Use the new mixer API to get callbacks, instead of using the hctl
API. Using the hctl API caused a memory leak, because alsa-lib itself
used the hctl callbacks, which we were previously overriding.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
David Henningsson
1fd8848e64 alsa-util: Add functions for accessing mixer elements through mixer class
Instead of using the hctl interface, we can find controls belonging
to other iface types than "mixer". We do this by introducing a new
mixer class "SND_MIXER_ELEM_PULSEAUDIO" and create snd_mixer_elem's
for all PCM and CARD iface types (as Jacks are of the CARD type and
ELD controls are of the PCM type).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
João Paulo Rechi Vita
f7c7cd1825 bluetooth: Implement org.ofono.HandsfreeAudioAgent.Release() 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
b1a09ebf7e bluetooth: Handle CardRemoved signal 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
8f838b1f31 bluetooth: Handle CardAdded signal 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
0e7f303256 bluetooth: Track oFono service 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
c4c4de532d bluetooth: Implement transport release for hf_audio_agent transports 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
8dd4aa1f00 bluetooth: Implement transport acquire for hf_audio_agent transports 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
c098665820 bluetooth: Parse HandsfreeAudioCard properties 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
a5a0506c4e bluetooth: List HandsfreeAudioCard objects from oFono 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
374c28a40e bluetooth: Register/Unregister Handsfree Audio Agent with oFono
Register as a HandsfreeAudioAgent with oFono during backend
initialization and unregiter during backend finalization. This commit
also adds a check when receiving method calls or signals to make sure
the sender matches with the D-Bus service we're registered with.
2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
d7a8ccce89 bluetooth: Create hf_dbus_send_and_add_to_pending() for oFono backend 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
98d3d85705 bluetooth: Monitor D-Bus signals 2014-09-11 14:00:15 +03:00
Luiz Augusto von Dentz
f508b34b8b bluetooth: Add discovery to pa_bluetooth_backend_new 2014-09-10 13:25:36 +03:00
Luiz Augusto von Dentz
5c2ed8abed bluetooth: Only create backend instance once objects are listed
This makes sure the devices are discovered before the backend start
creating new transports.
2014-09-10 13:25:36 +03:00
Sjoerd Simons
594da41d07 alsa-mixer: recognize Dock headphone jack
Recognize the Dock headphone jack in the same way the normal & front
headphone jacks are detected.

Reviewed-by: David Henningsson <david.henningsson@canonical.com>
2014-09-10 09:59:00 +02:00
David Henningsson
b8656afe4a alsa-mixer: Improve workaround for Valgrind's false warnings
Valgrind is not correctly handling ALSA TLV syscalls, which leads
to false warnings, looking like this:
 "Conditional jump or move depends on uninitialised value(s)"

Unfortunately, alsa-lib itself also uses these values which valgrind
falsely believe are uninitialized, so not all warnings are removed,
but this is what we can do from PA until the valgrind bug is fixed.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-08 13:05:10 +02:00
Luiz Augusto von Dentz
19180345fa bluetooth: Add pa_bluetooth_transport_unlink 2014-09-08 13:19:59 +03:00
Luiz Augusto von Dentz
4e041f7b36 bluetooth: Add pa_bluetooth_transport_set_state 2014-09-08 13:00:54 +03:00
Tanu Kaskinen
610704d225 alsa-mixer: Mark "Line HP Swap" as required-any
In the (theoretical) case that no other elements exists but
"Line HP Swap", the presence of that element signals that there are
headphone and line-out outputs, otherwise there would be nothing to
swap.
2014-09-08 11:26:00 +03:00
Lukas Peleska
5d20f571bc jack: made it possible to use multiple jack sources and sinks 2014-09-01 08:19:17 +02:00
Tanu Kaskinen
638d0a51e2 bluetooth: Always initialize profile->available
If the transport for the profile doesn't exist, the old behaviour was
to leave cp->available at the default value, which is
PA_AVAILABLE_UNKNOWN, but if there's no transport, the profile should
be marked as unavailable.
2014-08-24 12:38:18 +03:00
Tanu Kaskinen
b1c4e7bf6b raop: Don't use incompatible default sample spec parameters
Since the RAOP sink supports only some formats and channel counts, we
shouldn't blindly use pa_core.default_sample_spec. This patch changes
things so that we default to PA_SAMPLE_S16NE and 2 channels, and only
take the sample rate from pa_core.default_sample_spec.
2014-08-24 12:08:12 +03:00
David Henningsson
2575b102b9 alsa: Remove four channel input profile
With the new multichannel profile, we can remove this one and
handle the four channel input as a generic multichannel fallback.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-23 15:54:13 +02:00
João Paulo Rechi Vita
6d88a139fc bluetooth: Create oFono backend 2014-08-22 12:26:18 +03:00
João Paulo Rechi Vita
dca5d07937 bluetooth: Create NULL backend 2014-08-22 12:24:39 +03:00
João Paulo Rechi Vita
2198048e5d bluetooth: Add BlueZ 5 headset profile names in policy module 2014-08-22 12:24:39 +03:00
Luiz Augusto von Dentz
bdef2dbd0a bluetooth: Assert transport has a matching profile
It is a bug if a transport has no matching profile.
2014-08-22 12:24:39 +03:00
João Paulo Rechi Vita
1f0de01bfc bluetooth: Add basic support for HEADSET profiles
This commit adds basic support for devices implementing HSP Headset
Unit, HSP Audio Gateway, HFP Handsfree Unit, HFP Audio Gateway to the
BlueZ 5 bluetooth audio devices driver module (module-bluez5-device).
2014-08-22 12:10:12 +03:00
Peter Meerwald
1849cfdad9 misc: Fix format specifiers
to print a pa_usec_t, the format specifier to use is "%" PRIu64

modules/module-combine-sink.c: In function 'update_latency_range':
modules/module-combine-sink.c:750:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'pa_usec_t' [-Wformat]
modules/module-combine-sink.c:750:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'pa_usec_t' [-Wformat]

to print a size_t, use %zu

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-08-18 15:31:19 +02:00
Peter Meerwald
8d2d7da5e6 echo-cancel: Fix spelling of canceller
use canceller consistently

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-08-18 15:30:38 +02:00
Tanu Kaskinen
c49c6b75f0 device-restore: Sync the database on unload
If there are unsaved changes, those need to be written to disk before
the module is unloaded, otherwise the changes are lost.
2014-08-18 13:52:11 +03:00
Tanu Kaskinen
facfd3a664 alsa-mixer: Fix path subset detection
The old logic assumed that if path A was a subset of path B, the
element list in B would have all elements of A in the beginning of
B's list, in the same order as A. This assumption was invalid, causing
some subset cases to not get detected. We need to search through the
full element list of B every time before we can conclude that B
doesn't have the element that we're inspecting.
2014-08-18 13:44:44 +03:00