Commit Graph

617 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
fe4cbedb1e plugins/policy: Reword audio policy code in a simple plugin
This moves audio device policy to a plugin and removes any dependency of
audio plugin to it.
2013-07-12 15:05:49 +03:00
Anderson Lizardo
83ecd743a9 core: Avoid unnecessary gboolean on pincode callback API
Use standard "bool" type instead. Callers in plugins/* are fixed on the
same commit to avoid compilation errors.
2013-06-13 17:24:20 +03:00
Anderson Lizardo
0743aa5a6f plugins: Use open()/read() instead of fopen()/fread() on autopair
open()/read() is more common on BlueZ code. Incidentally, get rid of
this compilation error (using gcc 4.6.3):

plugins/autopair.c: In function ‘autopair_init’:
plugins/autopair.c:154:8: error: ignoring return value of ‘fread’,
declared with attribute warn_unused_result [-Werror=unused-result]
2013-06-13 17:24:20 +03:00
Johan Hedberg
a7171953ac autopair: Clean up coding style 2013-05-10 10:35:54 +03:00
Alex Deymo
dc3a586501 autopair: Try a fixed pincode for keyboards rejecting random codes
This patch makes the autopair plugin try a fixed "0000" pincode for
keyboards that reject the pincode too fast (less than 500ms). This too
short delay rejecting the pincode means that the user didn't have time
to type the random pincode in the bluetooth keyboard and was the
keyboard who actually rejected it.
2013-05-10 10:26:19 +03:00
Alex Deymo
4cf14a98e5 autopair: Add the autopair plugin
The autopair plugin tries standard pincodes for different devices with
dumb pincodes. It also generates a random 6 digit pincode for keyboards
that support any pincode but fallbacks to the agent call in case the
random generated pincode didn't work.
2013-05-10 10:21:39 +03:00
Alex Deymo
fa73398ae6 plugins: Extend the pin code callback with the call number
The plugin's pin code callback doesn't know about the pairing process.
It just provides a pin code based on the information provided to this
function. Although limited state could be added through other new
callbacks, this fix achieves this by providing more information to the
callback itself. The new argument "attempt" states the pin callback
attempt of the particular plugin for the current pairing of the device.
This allows a plugin to try different pincodes for the same device in
the same pairing process.

To signal that the plugin doesn't provide any pin code for the provided
device the current implementation returns 0 (an empty pin code).
Analogously, with this fix, a plugin should return 0 when it doesn't
have any other pin code to provide for the given device.
2013-05-10 10:16:48 +03:00
Szymon Janc
34e99c8328 neard: Fix reading local OOB data when adapter is not powered
Read Local OOB data only if adapter is powered. This fix replying with
error instead of CPS set to inactive when adapter is not powered.
2013-05-08 10:12:23 +03:00
Szymon Janc
88daad9402 neard: Fix checking for unknown carrier power state
Message might not contain State field and CPS needs to be set to
unknown before processing message from neard. This fix processing
RequestOOB called without parameters.
2013-05-08 10:12:08 +03:00
Lucas De Marchi
6f4bdbef1e plugins: Get rid of gint
Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.
2013-05-01 09:08:56 +03:00
Johan Hedberg
d56685d057 core: Fix storing info for private addressed devices
Devices with private addresses cannot persistently be identified by
their address. Therefore it doesn't make sense to store any information
about them as the information couldn't be looked up later once the
remote address has changed.

Once the kernel receives support for private address resolution we'll
start getting the public address of such devices to user space. However,
until then we just have to ignore such devices from a storage
perspective.
2013-04-29 14:02:34 +03:00
Johan Hedberg
ab5be5cb35 neard: Use more appropriate log levels than info() 2013-02-15 16:32:38 +02:00
Szymon Janc
cc2a84bf16 neard: Add fallback to legacy register if register failed
This will allow to work with neard 0.9 which doesn't support handover
agent register with carrier type.
2013-02-15 16:30:10 +02:00
Ravi kumar Veeramally
6a3debadb3 neard: Updated neard handover registration agent API calls
neard RegisterHandoverAgent and UnregisterHandoverAgent APIs need an
extra parameter of carrier type(e.g. bluetooth).
2013-02-15 16:29:46 +02:00
Szymon Janc
a629abd62f neard: Update copyright information 2013-02-15 16:29:33 +02:00
Szymon Janc
c7521adc2f neard: Use bool instead of gboolean for agent_register_postpone
There is no need to use gboolean as this flag is not used with any
glib function.
2013-02-15 16:29:19 +02:00
Szymon Janc
46d9e2693d neard: Restrict method calls only to neard process
Disallow methods calls from processes other than registered to as
agent.
2013-02-15 16:28:48 +02:00
Szymon Janc
66d880d232 neard: Use service name and not boolean to track if registered to neard 2013-02-15 16:28:06 +02:00
Szymon Janc
6960cb73b2 hostname: Fallback to static hostname if pretty hostname is not set
If pretty hostname is not set fallback to static hostname (if it is
set). If static or pretty hostname is not set appropriate properties
are empty strings not NULLs. This behaviour is recomended by hostnamed.
2013-02-15 12:50:41 +02:00
Szymon Janc
f0c8fed306 hostname: Fix setting adapter name to empty string
If pretty hostname is not set empty string is received. Don't update
adapters' names is such case.
2013-02-15 12:48:35 +02:00
Szymon Janc
4345fd9154 neard: Add support for setting power state in RequestOOB reply
This allows neard to properly set Bluetooth carrier power state in
handover message.
2013-02-15 10:42:21 +02:00
Szymon Janc
127b948210 neard: Check if adapter is powered in PushOOB
For PushOOB adapter needs to be powered as bluetoothd daemon is
expected to perform action on success.
2013-02-15 10:41:22 +02:00
Szymon Janc
d5672b8869 neard: Move pairable check from check_adapter
If device is already paired there is no need to fail with handover
if adapter is not pairable.
2013-02-15 10:40:23 +02:00
Szymon Janc
fe7f8fd83a neard: Add ability to parse 'State' field
This contains hint for power state of remote device Bluetooth adapter.
2013-02-15 10:38:49 +02:00
Szymon Janc
ac83286bb2 neard: Refactor message processing
This refactor code for message processing for future feature addition.
nokia.com:bt and EIR processing is now separated from performing
actions based on received data.
2013-02-15 10:37:55 +02:00
Szymon Janc
2cf03cc883 neard: Adjust errors to latest API changes
neard Handover API was stripped of not really usefull error codes.
2013-02-15 10:36:17 +02:00
Szymon Janc
ee9c08452c neard: Fix memory leak on registering as agent
Message reference was not dropped in register_agent. This fix following
memory leak reported by valgrind:

454 (184 direct, 270 indirect) bytes in 1 blocks are definitely lost in loss record 207 of 220
   at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x513DCF2: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514222E: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149F46: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514A070: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514AA63: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514B0A5: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149E0C: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5134D24: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5136088: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5135643: dbus_connection_send_with_reply_and_block (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5130C93: dbus_bus_register (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)

102 bytes in 1 blocks are indirectly lost in loss record 154 of 220
   at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x514F02F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F0DD: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F239: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514DE0A: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514E3D3: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x513C138: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x513FF4D: dbus_message_iter_append_basic (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5141790: dbus_message_new_error (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5135C70: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x40A747: message_dispatch (mainloop.c:76)
   by 0x4E7A91A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)

168 bytes in 1 blocks are indirectly lost in loss record 185 of 220
   at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x514F02F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F0DD: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F239: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x513A3B3: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514228F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149F46: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514A070: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514AA63: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514B0A5: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149E0C: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5134D24: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
2013-01-29 15:57:31 -06:00
Szymon Janc
e5b216061b neard: Fix passing negative error code to strerror
error_reply expects non-negative error code.
2013-01-29 15:57:27 -06:00
Johan Hedberg
7cd4d622f9 neard: Update to new adapter_get_device API 2013-01-25 11:00:02 +02:00
Anderson Lizardo
dbb2b838c7 plugins: Fix remaining references to bluetooth/uuid.h
These headers are not public anymore, so need to use "lib/uuid.h".
2013-01-10 15:10:44 +02:00
Johan Hedberg
1678083247 core: Make hash & randomizer const in oob_read_local_cb_t 2013-01-06 19:03:33 +02:00
Marcel Holtmann
d29d258758 plugins: Use btd_adapter_get_index instead of adapter_get_dev_id 2013-01-05 15:29:08 -08:00
Marcel Holtmann
a67c35315c plugins: Use btd_adapter_get_default instead of adapter_get_default 2013-01-05 15:19:10 -08:00
Marcel Holtmann
94f7e306f0 plugins: Remove the total silly usage of gchar and replace it with char 2013-01-04 12:24:09 -08:00
Johan Hedberg
143c325fa4 neard: Prefer adapter_get_default() over manager function 2013-01-03 14:15:37 +02:00
Johan Hedberg
4cb7c10de1 hostname: Prefer adapter_get_default() over manager function 2013-01-03 14:15:23 +02:00
Johan Hedberg
f632a0c43a hostname: Prefer adapter_foreach over manager function 2013-01-03 14:11:02 +02:00
Marcel Holtmann
cfb0a6a5f9 hostname: No need to restrict adapter name changes anymore 2012-12-29 21:10:56 -08:00
Marcel Holtmann
f1f6a1ae88 plugins: Remove no longer needed formfactor plugin 2012-12-29 15:57:21 -08:00
Marcel Holtmann
d523d8e46d hostname: Add fallback to DMI information for class of device 2012-12-29 15:56:15 -08:00
Marcel Holtmann
d4cbe27507 plugins: Remove no longer needed adaptername plugin 2012-12-29 15:32:55 -08:00
Marcel Holtmann
26d6372b2c hostname: Use numbered pretty hostnames for multiple adapters 2012-12-29 15:29:20 -08:00
Marcel Holtmann
7279e8508e plugins: Add support for systemd's hostname daemon 2012-12-29 14:46:19 -08:00
Marcel Holtmann
2935c04e3d build: Remove support for external OOB plugin 2012-12-20 00:23:53 +01:00
Johan Hedberg
1ff99151e0 neard: Fix agent reference leak 2012-12-18 11:20:01 +02:00
Szymon Janc
6827f2a0b3 adapter: Add btd_adapter_get_pairable function
Add btd_adapter_get_pairable and remove pairable argument from
btd_adapter_get_mode. Use btd_adapter_get_pairable to get pairable
state where needed.
2012-12-17 16:59:24 +02:00
Luiz Augusto von Dentz
643ad03cf2 dbusoob: Append version to OutOfBand interface 2012-12-14 11:24:26 +02:00
Johan Hedberg
c4c9436697 plugins: Remove service plugin (replaced by Profile interface) 2012-12-12 14:01:14 +02:00
Johan Hedberg
405c68c6dc core: Pass explicit address type info when creating device objects 2012-12-10 13:13:24 +02:00
Marcel Holtmann
149803cffb build: Remove unused empty storage plugin stub 2012-12-09 01:32:09 +01:00