mirror of https://gitee.com/openkylin/bluez.git
parent
ff29f075af
commit
7648e382b4
|
@ -317,11 +317,12 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
|
||||||
src/dbus-common.c src/dbus-common.h \
|
src/dbus-common.c src/dbus-common.h \
|
||||||
src/eir.h src/eir.c \
|
src/eir.h src/eir.c \
|
||||||
src/adv_monitor.h src/adv_monitor.c \
|
src/adv_monitor.h src/adv_monitor.c \
|
||||||
src/battery.h src/battery.c
|
src/battery.h src/battery.c \
|
||||||
|
src/kylin_bluetooth.h src/kylin_bluetooth.c
|
||||||
src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
|
src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
|
||||||
gdbus/libgdbus-internal.la \
|
gdbus/libgdbus-internal.la \
|
||||||
src/libshared-glib.la \
|
src/libshared-glib.la \
|
||||||
$(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \
|
$(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -lgobject-2.0 -lgio-2.0 -ldl -lrt \
|
||||||
$(builtin_ldadd)
|
$(builtin_ldadd)
|
||||||
src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
|
src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
|
||||||
-Wl,--version-script=$(srcdir)/src/bluetooth.ver
|
-Wl,--version-script=$(srcdir)/src/bluetooth.ver
|
||||||
|
|
30
Makefile.in
30
Makefile.in
|
@ -1159,7 +1159,8 @@ am__src_bluetoothd_SOURCES_DIST = plugins/hostname.c plugins/wiimote.c \
|
||||||
src/profile.c src/service.h src/service.c src/gatt-client.h \
|
src/profile.c src/service.h src/service.c src/gatt-client.h \
|
||||||
src/gatt-client.c src/device.h src/device.c src/dbus-common.c \
|
src/gatt-client.c src/device.h src/device.c src/dbus-common.c \
|
||||||
src/dbus-common.h src/eir.h src/eir.c src/adv_monitor.h \
|
src/dbus-common.h src/eir.h src/eir.c src/adv_monitor.h \
|
||||||
src/adv_monitor.c src/battery.h src/battery.c
|
src/adv_monitor.c src/battery.h src/battery.c \
|
||||||
|
src/kylin_bluetooth.h src/kylin_bluetooth.c
|
||||||
@ADMIN_TRUE@am__objects_13 = plugins/bluetoothd-admin.$(OBJEXT)
|
@ADMIN_TRUE@am__objects_13 = plugins/bluetoothd-admin.$(OBJEXT)
|
||||||
@NFC_TRUE@am__objects_14 = plugins/bluetoothd-neard.$(OBJEXT)
|
@NFC_TRUE@am__objects_14 = plugins/bluetoothd-neard.$(OBJEXT)
|
||||||
@SAP_TRUE@am__objects_15 = profiles/sap/bluetoothd-main.$(OBJEXT) \
|
@SAP_TRUE@am__objects_15 = profiles/sap/bluetoothd-main.$(OBJEXT) \
|
||||||
|
@ -1245,7 +1246,8 @@ am_src_bluetoothd_OBJECTS = $(am__objects_23) $(am__objects_24) \
|
||||||
src/bluetoothd-dbus-common.$(OBJEXT) \
|
src/bluetoothd-dbus-common.$(OBJEXT) \
|
||||||
src/bluetoothd-eir.$(OBJEXT) \
|
src/bluetoothd-eir.$(OBJEXT) \
|
||||||
src/bluetoothd-adv_monitor.$(OBJEXT) \
|
src/bluetoothd-adv_monitor.$(OBJEXT) \
|
||||||
src/bluetoothd-battery.$(OBJEXT)
|
src/bluetoothd-battery.$(OBJEXT) \
|
||||||
|
src/bluetoothd-kylin_bluetooth.$(OBJEXT)
|
||||||
nodist_src_bluetoothd_OBJECTS = $(am__objects_12)
|
nodist_src_bluetoothd_OBJECTS = $(am__objects_12)
|
||||||
src_bluetoothd_OBJECTS = $(am_src_bluetoothd_OBJECTS) \
|
src_bluetoothd_OBJECTS = $(am_src_bluetoothd_OBJECTS) \
|
||||||
$(nodist_src_bluetoothd_OBJECTS)
|
$(nodist_src_bluetoothd_OBJECTS)
|
||||||
|
@ -2240,6 +2242,7 @@ am__depfiles_remade = android/$(DEPDIR)/a2dp-sink.Po \
|
||||||
src/$(DEPDIR)/bluetoothd-storage.Po \
|
src/$(DEPDIR)/bluetoothd-storage.Po \
|
||||||
src/$(DEPDIR)/bluetoothd-textfile.Po \
|
src/$(DEPDIR)/bluetoothd-textfile.Po \
|
||||||
src/$(DEPDIR)/bluetoothd-uuid-helper.Po src/$(DEPDIR)/eir.Po \
|
src/$(DEPDIR)/bluetoothd-uuid-helper.Po src/$(DEPDIR)/eir.Po \
|
||||||
|
src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Po \
|
||||||
src/$(DEPDIR)/log.Po src/$(DEPDIR)/oui.Po \
|
src/$(DEPDIR)/log.Po src/$(DEPDIR)/oui.Po \
|
||||||
src/$(DEPDIR)/sdp-client.Po src/$(DEPDIR)/sdp-xml.Po \
|
src/$(DEPDIR)/sdp-client.Po src/$(DEPDIR)/sdp-xml.Po \
|
||||||
src/$(DEPDIR)/sdpd-database.Po src/$(DEPDIR)/sdpd-request.Po \
|
src/$(DEPDIR)/sdpd-database.Po src/$(DEPDIR)/sdpd-request.Po \
|
||||||
|
@ -3288,7 +3291,8 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
|
||||||
src/dbus-common.c src/dbus-common.h \
|
src/dbus-common.c src/dbus-common.h \
|
||||||
src/eir.h src/eir.c \
|
src/eir.h src/eir.c \
|
||||||
src/adv_monitor.h src/adv_monitor.c \
|
src/adv_monitor.h src/adv_monitor.c \
|
||||||
src/battery.h src/battery.c
|
src/battery.h src/battery.c \
|
||||||
|
src/kylin_bluetooth.h src/kylin_bluetooth.c
|
||||||
|
|
||||||
src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
|
src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
|
||||||
gdbus/libgdbus-internal.la \
|
gdbus/libgdbus-internal.la \
|
||||||
|
@ -5609,6 +5613,8 @@ src/bluetoothd-adv_monitor.$(OBJEXT): src/$(am__dirstamp) \
|
||||||
src/$(DEPDIR)/$(am__dirstamp)
|
src/$(DEPDIR)/$(am__dirstamp)
|
||||||
src/bluetoothd-battery.$(OBJEXT): src/$(am__dirstamp) \
|
src/bluetoothd-battery.$(OBJEXT): src/$(am__dirstamp) \
|
||||||
src/$(DEPDIR)/$(am__dirstamp)
|
src/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
src/bluetoothd-kylin_bluetooth.$(OBJEXT): src/$(am__dirstamp) \
|
||||||
|
src/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
|
||||||
src/bluetoothd$(EXEEXT): $(src_bluetoothd_OBJECTS) $(src_bluetoothd_DEPENDENCIES) $(EXTRA_src_bluetoothd_DEPENDENCIES) src/$(am__dirstamp)
|
src/bluetoothd$(EXEEXT): $(src_bluetoothd_OBJECTS) $(src_bluetoothd_DEPENDENCIES) $(EXTRA_src_bluetoothd_DEPENDENCIES) src/$(am__dirstamp)
|
||||||
@rm -f src/bluetoothd$(EXEEXT)
|
@rm -f src/bluetoothd$(EXEEXT)
|
||||||
|
@ -6766,6 +6772,7 @@ distclean-compile:
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-storage.Po@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-storage.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-textfile.Po@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-textfile.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-uuid-helper.Po@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-uuid-helper.Po@am__quote@ # am--include-marker
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/eir.Po@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/eir.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/log.Po@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/log.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/oui.Po@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/oui.Po@am__quote@ # am--include-marker
|
||||||
|
@ -9477,6 +9484,21 @@ src/bluetoothd-battery.obj: src/battery.c
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_bluetoothd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/bluetoothd-battery.obj `if test -f 'src/battery.c'; then $(CYGPATH_W) 'src/battery.c'; else $(CYGPATH_W) '$(srcdir)/src/battery.c'; fi`
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_bluetoothd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/bluetoothd-battery.obj `if test -f 'src/battery.c'; then $(CYGPATH_W) 'src/battery.c'; else $(CYGPATH_W) '$(srcdir)/src/battery.c'; fi`
|
||||||
|
|
||||||
|
src/bluetoothd-kylin_bluetooth.o: src/kylin_bluetooth.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_bluetoothd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/bluetoothd-kylin_bluetooth.o -MD -MP -MF src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Tpo -c -o src/bluetoothd-kylin_bluetooth.o `test -f 'src/kylin_bluetooth.c' || echo '$(srcdir)/'`src/kylin_bluetooth.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Tpo src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/kylin_bluetooth.c' object='src/bluetoothd-kylin_bluetooth.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_bluetoothd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/bluetoothd-kylin_bluetooth.o `test -f 'src/kylin_bluetooth.c' || echo '$(srcdir)/'`src/kylin_bluetooth.c
|
||||||
|
|
||||||
|
src/bluetoothd-kylin_bluetooth.obj: src/kylin_bluetooth.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_bluetoothd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/bluetoothd-kylin_bluetooth.obj -MD -MP -MF src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Tpo -c -o src/bluetoothd-kylin_bluetooth.obj `if test -f 'src/kylin_bluetooth.c'; then $(CYGPATH_W) 'src/kylin_bluetooth.c'; else $(CYGPATH_W) '$(srcdir)/src/kylin_bluetooth.c'; fi`
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Tpo src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/kylin_bluetooth.c' object='src/bluetoothd-kylin_bluetooth.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_bluetoothd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/bluetoothd-kylin_bluetooth.obj `if test -f 'src/kylin_bluetooth.c'; then $(CYGPATH_W) 'src/kylin_bluetooth.c'; else $(CYGPATH_W) '$(srcdir)/src/kylin_bluetooth.c'; fi`
|
||||||
|
|
||||||
|
|
||||||
unit/test_mesh_crypto-test-mesh-crypto.o: unit/test-mesh-crypto.c
|
unit/test_mesh_crypto-test-mesh-crypto.o: unit/test-mesh-crypto.c
|
||||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(unit_test_mesh_crypto_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unit/test_mesh_crypto-test-mesh-crypto.o -MD -MP -MF unit/$(DEPDIR)/test_mesh_crypto-test-mesh-crypto.Tpo -c -o unit/test_mesh_crypto-test-mesh-crypto.o `test -f 'unit/test-mesh-crypto.c' || echo '$(srcdir)/'`unit/test-mesh-crypto.c
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(unit_test_mesh_crypto_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unit/test_mesh_crypto-test-mesh-crypto.o -MD -MP -MF unit/$(DEPDIR)/test_mesh_crypto-test-mesh-crypto.Tpo -c -o unit/test_mesh_crypto-test-mesh-crypto.o `test -f 'unit/test-mesh-crypto.c' || echo '$(srcdir)/'`unit/test-mesh-crypto.c
|
||||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) unit/$(DEPDIR)/test_mesh_crypto-test-mesh-crypto.Tpo unit/$(DEPDIR)/test_mesh_crypto-test-mesh-crypto.Po
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) unit/$(DEPDIR)/test_mesh_crypto-test-mesh-crypto.Tpo unit/$(DEPDIR)/test_mesh_crypto-test-mesh-crypto.Po
|
||||||
|
@ -10917,6 +10939,7 @@ distclean: distclean-am
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-attrib-server.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-attrib-server.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-backtrace.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-backtrace.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-battery.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-battery.Po
|
||||||
|
-rm -f src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-dbus-common.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-dbus-common.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-device.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-device.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-eir.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-eir.Po
|
||||||
|
@ -11514,6 +11537,7 @@ maintainer-clean: maintainer-clean-am
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-attrib-server.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-attrib-server.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-backtrace.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-backtrace.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-battery.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-battery.Po
|
||||||
|
-rm -f src/$(DEPDIR)/bluetoothd-kylin_bluetooth.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-dbus-common.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-dbus-common.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-device.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-device.Po
|
||||||
-rm -f src/$(DEPDIR)/bluetoothd-eir.Po
|
-rm -f src/$(DEPDIR)/bluetoothd-eir.Po
|
||||||
|
|
|
@ -13862,6 +13862,7 @@ fi
|
||||||
GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
|
GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS -lgobject-2.0 -lgio-2.0"
|
||||||
|
|
||||||
pkg_failed=no
|
pkg_failed=no
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus-1 >= 1.6" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus-1 >= 1.6" >&5
|
||||||
|
|
|
@ -94,6 +94,7 @@ gssize g_obex_header_encode(GObexHeader *header, void *buf, gsize buf_len)
|
||||||
utf16_len = utf8_to_utf16(&utf16, header->v.string);
|
utf16_len = utf8_to_utf16(&utf16, header->v.string);
|
||||||
if (utf16_len < 0 || (guint16) utf16_len > buf_len)
|
if (utf16_len < 0 || (guint16) utf16_len > buf_len)
|
||||||
return -1;
|
return -1;
|
||||||
|
header->hlen = utf16_len + 3;
|
||||||
g_assert_cmpuint(utf16_len + 3, ==, header->hlen);
|
g_assert_cmpuint(utf16_len + 3, ==, header->hlen);
|
||||||
u16 = g_htons(utf16_len + 3);
|
u16 = g_htons(utf16_len + 3);
|
||||||
ptr = put_bytes(ptr, &u16, sizeof(u16));
|
ptr = put_bytes(ptr, &u16, sizeof(u16));
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include "lib/bluetooth.h"
|
#include "lib/bluetooth.h"
|
||||||
#include "lib/sdp.h"
|
#include "lib/sdp.h"
|
||||||
|
@ -366,6 +367,49 @@ static void handle_release(struct avctp *session, uint16_t op)
|
||||||
send_key(session->uinput, op, 0);
|
send_key(session->uinput, op, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void avctp_send_bluetooth_key(uint32_t uinput,bool opet)
|
||||||
|
{
|
||||||
|
DBG("Sending signal with value %d\n", uinput);
|
||||||
|
|
||||||
|
GError *gerror = NULL;
|
||||||
|
GDBusProxy * avctp_proxy = NULL ;
|
||||||
|
avctp_proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
|
||||||
|
G_DBUS_PROPERTY_INFO_FLAGS_NONE,
|
||||||
|
NULL,
|
||||||
|
"com.ukui.bluetooth",
|
||||||
|
"/com/ukui/bluetooth",
|
||||||
|
"com.ukui.bluetooth",
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if(!avctp_proxy)
|
||||||
|
{
|
||||||
|
DBG("avctp proxy is null!");
|
||||||
|
g_object_unref(avctp_proxy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GVariant *prms = g_variant_new_uint16(uinput);
|
||||||
|
if (!prms)
|
||||||
|
{
|
||||||
|
DBG("prms is null!");
|
||||||
|
g_variant_unref(prms);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//获取设置列表
|
||||||
|
GVariant * dev_list = NULL;
|
||||||
|
dev_list = g_dbus_proxy_call_sync(avctp_proxy,
|
||||||
|
"bluetoothKeyValue",//"getKeyFilePath",
|
||||||
|
g_variant_new("(us)",uinput,opet?"pressed":"released"),
|
||||||
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_object_unref(avctp_proxy);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static size_t handle_panel_passthrough(struct avctp *session,
|
static size_t handle_panel_passthrough(struct avctp *session,
|
||||||
uint8_t transaction, uint8_t *code,
|
uint8_t transaction, uint8_t *code,
|
||||||
uint8_t *subunit, uint8_t *operands,
|
uint8_t *subunit, uint8_t *operands,
|
||||||
|
@ -403,7 +447,9 @@ static size_t handle_panel_passthrough(struct avctp *session,
|
||||||
if ((operands[0] & 0x7F) != key_map[i].avc)
|
if ((operands[0] & 0x7F) != key_map[i].avc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DBG("AV/C: %s %s", key_map[i].name, status);
|
DBG("AV/C: %s %d %s", key_map[i].name, key_map[i].uinput,status);
|
||||||
|
//test
|
||||||
|
avctp_send_bluetooth_key(key_map[i].uinput,pressed);
|
||||||
|
|
||||||
key_quirks = session->key_quirks[key_map[i].avc];
|
key_quirks = session->key_quirks[key_map[i].avc];
|
||||||
|
|
||||||
|
@ -2015,6 +2061,7 @@ unsigned int avctp_register_pdu_handler(struct avctp *session, uint8_t opcode,
|
||||||
avctp_control_pdu_cb cb,
|
avctp_control_pdu_cb cb,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avctp_channel *control = session->control;
|
struct avctp_channel *control = session->control;
|
||||||
struct avctp_pdu_handler *handler;
|
struct avctp_pdu_handler *handler;
|
||||||
static unsigned int id = 0;
|
static unsigned int id = 0;
|
||||||
|
|
|
@ -428,7 +428,7 @@ static int process_queue(struct avdtp *session);
|
||||||
static void avdtp_sep_set_state(struct avdtp *session,
|
static void avdtp_sep_set_state(struct avdtp *session,
|
||||||
struct avdtp_local_sep *sep,
|
struct avdtp_local_sep *sep,
|
||||||
avdtp_state_t state);
|
avdtp_state_t state);
|
||||||
|
int avdtp_stream_state_change(struct avdtp *session, struct avdtp_stream *stream);
|
||||||
static const char *avdtp_statestr(avdtp_state_t state)
|
static const char *avdtp_statestr(avdtp_state_t state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -998,6 +998,7 @@ static void avdtp_sep_set_state(struct avdtp *session,
|
||||||
break;
|
break;
|
||||||
case AVDTP_STATE_OPEN:
|
case AVDTP_STATE_OPEN:
|
||||||
stream->starting = FALSE;
|
stream->starting = FALSE;
|
||||||
|
avdtp_stream_state_change(session, stream);
|
||||||
break;
|
break;
|
||||||
case AVDTP_STATE_STREAMING:
|
case AVDTP_STATE_STREAMING:
|
||||||
if (stream->start_timer) {
|
if (stream->start_timer) {
|
||||||
|
@ -1834,7 +1835,7 @@ static gboolean avdtp_start_cmd(struct avdtp *session, uint8_t transaction,
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
stream->starting = TRUE;
|
stream->starting = TRUE;
|
||||||
|
avdtp_stream_state_change(session, stream);
|
||||||
if (sep->ind && sep->ind->start) {
|
if (sep->ind && sep->ind->start) {
|
||||||
if (!sep->ind->start(session, sep, stream, &err,
|
if (!sep->ind->start(session, sep, stream, &err,
|
||||||
sep->user_data))
|
sep->user_data))
|
||||||
|
@ -2588,8 +2589,10 @@ static int cancel_request(struct avdtp *session, int err)
|
||||||
if (lsep && lsep->cfm && lsep->cfm->start) {
|
if (lsep && lsep->cfm && lsep->cfm->start) {
|
||||||
lsep->cfm->start(session, lsep, stream, &averr,
|
lsep->cfm->start(session, lsep, stream, &averr,
|
||||||
lsep->user_data);
|
lsep->user_data);
|
||||||
if (stream)
|
if (stream) {
|
||||||
stream->starting = FALSE;
|
stream->starting = FALSE;
|
||||||
|
avdtp_stream_state_change(session, stream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AVDTP_SUSPEND:
|
case AVDTP_SUSPEND:
|
||||||
|
@ -3126,6 +3129,7 @@ static gboolean avdtp_parse_rej(struct avdtp *session,
|
||||||
sep->cfm->start(session, sep, stream, &err,
|
sep->cfm->start(session, sep, stream, &err,
|
||||||
sep->user_data);
|
sep->user_data);
|
||||||
stream->starting = FALSE;
|
stream->starting = FALSE;
|
||||||
|
avdtp_stream_state_change(session, stream);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case AVDTP_SUSPEND:
|
case AVDTP_SUSPEND:
|
||||||
|
@ -3677,8 +3681,10 @@ int avdtp_start(struct avdtp *session, struct avdtp_stream *stream)
|
||||||
|
|
||||||
ret = send_request(session, FALSE, stream, AVDTP_START,
|
ret = send_request(session, FALSE, stream, AVDTP_START,
|
||||||
&req, sizeof(req));
|
&req, sizeof(req));
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
stream->starting = TRUE;
|
stream->starting = TRUE;
|
||||||
|
avdtp_stream_state_change(session, stream);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3963,3 +3969,23 @@ gboolean avdtp_remove_state_cb(unsigned int id)
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int avdtp_stream_state_change(struct avdtp *session, struct avdtp_stream *stream)
|
||||||
|
{
|
||||||
|
if (stream->starting == TRUE) {
|
||||||
|
set_a2dp_state_hisi(TRUE,device_get_adapter(session->device),
|
||||||
|
device_get_address(session->device),
|
||||||
|
btd_device_get_bdaddr_type(session->device));
|
||||||
|
|
||||||
|
info("avdtp_stream_state_change ture ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream->starting == FALSE) {
|
||||||
|
set_a2dp_state_hisi(FALSE,device_get_adapter(session->device),
|
||||||
|
device_get_address(session->device),
|
||||||
|
btd_device_get_bdaddr_type(session->device));
|
||||||
|
info("avdtp_stream_state_change false");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -276,6 +276,8 @@ struct avrcp {
|
||||||
uint8_t transaction;
|
uint8_t transaction;
|
||||||
uint8_t transaction_events[AVRCP_EVENT_LAST + 1];
|
uint8_t transaction_events[AVRCP_EVENT_LAST + 1];
|
||||||
struct pending_pdu *pending_pdu;
|
struct pending_pdu *pending_pdu;
|
||||||
|
|
||||||
|
int volume;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct passthrough_handler {
|
struct passthrough_handler {
|
||||||
|
@ -406,7 +408,7 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
|
||||||
sdp_record_t *record;
|
sdp_record_t *record;
|
||||||
sdp_data_t *psm[2], *version, *features;
|
sdp_data_t *psm[2], *version, *features;
|
||||||
uint16_t lp = AVCTP_CONTROL_PSM;
|
uint16_t lp = AVCTP_CONTROL_PSM;
|
||||||
uint16_t avctp_ver = 0x0103;
|
uint16_t avctp_ver = 0x0104;
|
||||||
uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
|
uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
|
||||||
AVRCP_FEATURE_CATEGORY_2 |
|
AVRCP_FEATURE_CATEGORY_2 |
|
||||||
AVRCP_FEATURE_CATEGORY_3 |
|
AVRCP_FEATURE_CATEGORY_3 |
|
||||||
|
@ -450,6 +452,7 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bluetooth Profile Descriptor List */
|
/* Bluetooth Profile Descriptor List */
|
||||||
|
#if 0
|
||||||
sdp_uuid16_create(&profile[0].uuid, AV_REMOTE_PROFILE_ID);
|
sdp_uuid16_create(&profile[0].uuid, AV_REMOTE_PROFILE_ID);
|
||||||
profile[0].version = AVRCP_CT_VERSION;
|
profile[0].version = AVRCP_CT_VERSION;
|
||||||
pfseq = sdp_list_append(NULL, &profile[0]);
|
pfseq = sdp_list_append(NULL, &profile[0]);
|
||||||
|
@ -459,6 +462,7 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
|
||||||
sdp_attr_add(record, SDP_ATTR_SUPPORTED_FEATURES, features);
|
sdp_attr_add(record, SDP_ATTR_SUPPORTED_FEATURES, features);
|
||||||
|
|
||||||
sdp_set_info_attr(record, "AVRCP CT", NULL, NULL);
|
sdp_set_info_attr(record, "AVRCP CT", NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
free(psm[0]);
|
free(psm[0]);
|
||||||
free(version);
|
free(version);
|
||||||
|
@ -482,7 +486,7 @@ static sdp_record_t *avrcp_tg_record(bool browsing)
|
||||||
sdp_record_t *record;
|
sdp_record_t *record;
|
||||||
sdp_data_t *psm_control, *version, *features;
|
sdp_data_t *psm_control, *version, *features;
|
||||||
uint16_t lp = AVCTP_CONTROL_PSM;
|
uint16_t lp = AVCTP_CONTROL_PSM;
|
||||||
uint16_t avctp_ver = 0x0103;
|
uint16_t avctp_ver = 0x0104;
|
||||||
uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
|
uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
|
||||||
AVRCP_FEATURE_CATEGORY_2 |
|
AVRCP_FEATURE_CATEGORY_2 |
|
||||||
AVRCP_FEATURE_CATEGORY_3 |
|
AVRCP_FEATURE_CATEGORY_3 |
|
||||||
|
@ -1607,6 +1611,7 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
|
||||||
struct avrcp_header *pdu,
|
struct avrcp_header *pdu,
|
||||||
uint8_t transaction)
|
uint8_t transaction)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avrcp_player *player = target_get_player(session);
|
struct avrcp_player *player = target_get_player(session);
|
||||||
struct btd_device *dev = session->dev;
|
struct btd_device *dev = session->dev;
|
||||||
uint16_t len = ntohs(pdu->params_len);
|
uint16_t len = ntohs(pdu->params_len);
|
||||||
|
@ -1750,6 +1755,8 @@ static uint8_t avrcp_handle_set_absolute_volume(struct avrcp *session,
|
||||||
struct avrcp_header *pdu,
|
struct avrcp_header *pdu,
|
||||||
uint8_t transaction)
|
uint8_t transaction)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
DBG("");
|
||||||
uint16_t len = ntohs(pdu->params_len);
|
uint16_t len = ntohs(pdu->params_len);
|
||||||
int8_t volume;
|
int8_t volume;
|
||||||
|
|
||||||
|
@ -1757,7 +1764,7 @@ static uint8_t avrcp_handle_set_absolute_volume(struct avrcp *session,
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
volume = pdu->params[0] & 0x7F;
|
volume = pdu->params[0] & 0x7F;
|
||||||
|
session->volume = volume;
|
||||||
media_transport_update_device_volume(session->dev, volume);
|
media_transport_update_device_volume(session->dev, volume);
|
||||||
|
|
||||||
return AVC_CTYPE_ACCEPTED;
|
return AVC_CTYPE_ACCEPTED;
|
||||||
|
@ -3724,14 +3731,17 @@ static void avrcp_get_media_player_list(struct avrcp *session)
|
||||||
static void avrcp_volume_changed(struct avrcp *session,
|
static void avrcp_volume_changed(struct avrcp *session,
|
||||||
struct avrcp_header *pdu)
|
struct avrcp_header *pdu)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avrcp_player *player = target_get_player(session);
|
struct avrcp_player *player = target_get_player(session);
|
||||||
int8_t volume;
|
int8_t volume;
|
||||||
|
|
||||||
volume = pdu->params[1] & 0x7F;
|
volume = pdu->params[1] & 0x7F;
|
||||||
|
|
||||||
/* Always attempt to update the transport volume */
|
/* Always attempt to update the transport volume */
|
||||||
|
session->volume = volume;
|
||||||
media_transport_update_device_volume(session->dev, volume);
|
media_transport_update_device_volume(session->dev, volume);
|
||||||
|
|
||||||
|
|
||||||
if (player)
|
if (player)
|
||||||
player->cb->set_volume(volume, session->dev, player->user_data);
|
player->cb->set_volume(volume, session->dev, player->user_data);
|
||||||
}
|
}
|
||||||
|
@ -3846,6 +3856,7 @@ static gboolean avrcp_handle_event(struct avctp *conn, uint8_t code,
|
||||||
uint8_t *operands, size_t operand_count,
|
uint8_t *operands, size_t operand_count,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avrcp *session = user_data;
|
struct avrcp *session = user_data;
|
||||||
struct avrcp_header *pdu = (void *) operands;
|
struct avrcp_header *pdu = (void *) operands;
|
||||||
uint8_t event;
|
uint8_t event;
|
||||||
|
@ -4144,6 +4155,7 @@ static void target_init(struct avrcp *session)
|
||||||
player->sessions = g_slist_prepend(player->sessions, session);
|
player->sessions = g_slist_prepend(player->sessions, session);
|
||||||
|
|
||||||
init_volume = media_player_get_device_volume(session->dev);
|
init_volume = media_player_get_device_volume(session->dev);
|
||||||
|
session->volume = init_volume;
|
||||||
media_transport_update_device_volume(session->dev, init_volume);
|
media_transport_update_device_volume(session->dev, init_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4308,6 +4320,7 @@ static struct avrcp *session_create(struct avrcp_server *server,
|
||||||
session->server = server;
|
session->server = server;
|
||||||
session->conn = avctp_connect(device);
|
session->conn = avctp_connect(device);
|
||||||
session->dev = device;
|
session->dev = device;
|
||||||
|
session->volume = -1;
|
||||||
|
|
||||||
server->sessions = g_slist_append(server->sessions, session);
|
server->sessions = g_slist_append(server->sessions, session);
|
||||||
|
|
||||||
|
@ -4318,6 +4331,7 @@ static void state_changed(struct btd_device *device, avctp_state_t old_state,
|
||||||
avctp_state_t new_state, int err,
|
avctp_state_t new_state, int err,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avrcp_server *server;
|
struct avrcp_server *server;
|
||||||
struct avrcp *session;
|
struct avrcp *session;
|
||||||
|
|
||||||
|
@ -4327,6 +4341,8 @@ static void state_changed(struct btd_device *device, avctp_state_t old_state,
|
||||||
|
|
||||||
session = find_session(server->sessions, device);
|
session = find_session(server->sessions, device);
|
||||||
|
|
||||||
|
DBG("new_state:%d",new_state);
|
||||||
|
|
||||||
switch (new_state) {
|
switch (new_state) {
|
||||||
case AVCTP_STATE_DISCONNECTED:
|
case AVCTP_STATE_DISCONNECTED:
|
||||||
if (session == NULL)
|
if (session == NULL)
|
||||||
|
@ -4484,6 +4500,7 @@ static gboolean avrcp_handle_set_volume(struct avctp *conn, uint8_t code,
|
||||||
uint8_t *operands, size_t operand_count,
|
uint8_t *operands, size_t operand_count,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avrcp *session = user_data;
|
struct avrcp *session = user_data;
|
||||||
struct avrcp_player *player = target_get_player(session);
|
struct avrcp_player *player = target_get_player(session);
|
||||||
struct avrcp_header *pdu = (void *) operands;
|
struct avrcp_header *pdu = (void *) operands;
|
||||||
|
@ -4496,6 +4513,7 @@ static gboolean avrcp_handle_set_volume(struct avctp *conn, uint8_t code,
|
||||||
volume = pdu->params[0] & 0x7F;
|
volume = pdu->params[0] & 0x7F;
|
||||||
|
|
||||||
/* Always attempt to update the transport volume */
|
/* Always attempt to update the transport volume */
|
||||||
|
session->volume = volume;
|
||||||
media_transport_update_device_volume(session->dev, volume);
|
media_transport_update_device_volume(session->dev, volume);
|
||||||
|
|
||||||
if (player != NULL)
|
if (player != NULL)
|
||||||
|
@ -4557,6 +4575,7 @@ static bool avrcp_event_registered(struct avrcp *session, uint8_t event)
|
||||||
|
|
||||||
int avrcp_set_volume(struct btd_device *dev, int8_t volume, bool notify)
|
int avrcp_set_volume(struct btd_device *dev, int8_t volume, bool notify)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct avrcp_server *server;
|
struct avrcp_server *server;
|
||||||
struct avrcp *session;
|
struct avrcp *session;
|
||||||
uint8_t buf[AVRCP_HEADER_LENGTH + 1];
|
uint8_t buf[AVRCP_HEADER_LENGTH + 1];
|
||||||
|
@ -4598,6 +4617,22 @@ int avrcp_set_volume(struct btd_device *dev, int8_t volume, bool notify)
|
||||||
avrcp_handle_set_volume, session);
|
avrcp_handle_set_volume, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int avrcp_get_volume(struct btd_device *dev)
|
||||||
|
{
|
||||||
|
struct avrcp_server *server;
|
||||||
|
struct avrcp *session;
|
||||||
|
|
||||||
|
server = find_server(servers, device_get_adapter(dev));
|
||||||
|
if (server == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
session = find_session(server->sessions, dev);
|
||||||
|
if (session == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return session->volume;
|
||||||
|
}
|
||||||
|
|
||||||
struct avrcp_player *avrcp_get_target_player_by_device(struct btd_device *dev)
|
struct avrcp_player *avrcp_get_target_player_by_device(struct btd_device *dev)
|
||||||
{
|
{
|
||||||
struct avrcp_server *server;
|
struct avrcp_server *server;
|
||||||
|
|
|
@ -92,6 +92,8 @@ struct avrcp_player_cb {
|
||||||
|
|
||||||
int avrcp_set_volume(struct btd_device *dev, int8_t volume, bool notify);
|
int avrcp_set_volume(struct btd_device *dev, int8_t volume, bool notify);
|
||||||
|
|
||||||
|
int avrcp_get_volume(struct btd_device *dev);
|
||||||
|
|
||||||
struct avrcp_player *avrcp_register_player(struct btd_adapter *adapter,
|
struct avrcp_player *avrcp_register_player(struct btd_adapter *adapter,
|
||||||
struct avrcp_player_cb *cb,
|
struct avrcp_player_cb *cb,
|
||||||
void *user_data,
|
void *user_data,
|
||||||
|
|
|
@ -440,6 +440,7 @@ static void media_owner_add(struct media_owner *owner,
|
||||||
static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
|
static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct media_transport *transport = data;
|
struct media_transport *transport = data;
|
||||||
struct media_owner *owner;
|
struct media_owner *owner;
|
||||||
struct media_request *req;
|
struct media_request *req;
|
||||||
|
@ -468,6 +469,7 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
|
||||||
static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
|
static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct media_transport *transport = data;
|
struct media_transport *transport = data;
|
||||||
struct media_owner *owner;
|
struct media_owner *owner;
|
||||||
struct media_request *req;
|
struct media_request *req;
|
||||||
|
@ -499,6 +501,7 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
|
||||||
static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
|
static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct media_transport *transport = data;
|
struct media_transport *transport = data;
|
||||||
struct media_owner *owner = transport->owner;
|
struct media_owner *owner = transport->owner;
|
||||||
const char *sender;
|
const char *sender;
|
||||||
|
@ -640,6 +643,7 @@ static void set_volume(const GDBusPropertyTable *property,
|
||||||
DBusMessageIter *iter, GDBusPendingPropertySet id,
|
DBusMessageIter *iter, GDBusPendingPropertySet id,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct media_transport *transport = data;
|
struct media_transport *transport = data;
|
||||||
struct a2dp_transport *a2dp = transport->data;
|
struct a2dp_transport *a2dp = transport->data;
|
||||||
uint16_t arg;
|
uint16_t arg;
|
||||||
|
@ -672,6 +676,7 @@ static void set_volume(const GDBusPropertyTable *property,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
DBG("");
|
||||||
g_dbus_pending_property_error(id, ERROR_INTERFACE ".InvalidArguments",
|
g_dbus_pending_property_error(id, ERROR_INTERFACE ".InvalidArguments",
|
||||||
"Invalid arguments in method call");
|
"Invalid arguments in method call");
|
||||||
}
|
}
|
||||||
|
@ -810,7 +815,8 @@ static int media_transport_init_source(struct media_transport *transport)
|
||||||
transport->data = a2dp;
|
transport->data = a2dp;
|
||||||
transport->destroy = destroy_a2dp;
|
transport->destroy = destroy_a2dp;
|
||||||
|
|
||||||
a2dp->volume = -1;
|
a2dp->volume = avrcp_get_volume(transport->device);
|
||||||
|
DBG("init a2dp volume : %d", a2dp->volume);
|
||||||
transport->sink_watch = sink_add_state_cb(service, sink_state_changed,
|
transport->sink_watch = sink_add_state_cb(service, sink_state_changed,
|
||||||
transport);
|
transport);
|
||||||
|
|
||||||
|
@ -926,6 +932,7 @@ int8_t media_transport_get_volume(struct media_transport *transport)
|
||||||
void media_transport_update_volume(struct media_transport *transport,
|
void media_transport_update_volume(struct media_transport *transport,
|
||||||
int8_t volume)
|
int8_t volume)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct a2dp_transport *a2dp = transport->data;
|
struct a2dp_transport *a2dp = transport->data;
|
||||||
|
|
||||||
if (volume < 0)
|
if (volume < 0)
|
||||||
|
@ -965,6 +972,7 @@ int8_t media_transport_get_device_volume(struct btd_device *dev)
|
||||||
void media_transport_update_device_volume(struct btd_device *dev,
|
void media_transport_update_device_volume(struct btd_device *dev,
|
||||||
int8_t volume)
|
int8_t volume)
|
||||||
{
|
{
|
||||||
|
DBG("update volume :%d",volume);
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (dev == NULL || volume < 0)
|
if (dev == NULL || volume < 0)
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,6 +87,7 @@
|
||||||
#define DISTANCE_VAL_INVALID 0x7FFF
|
#define DISTANCE_VAL_INVALID 0x7FFF
|
||||||
#define PATHLOSS_MAX 137
|
#define PATHLOSS_MAX 137
|
||||||
|
|
||||||
|
extern bool is_huawei;
|
||||||
/*
|
/*
|
||||||
* These are known security keys that have been compromised.
|
* These are known security keys that have been compromised.
|
||||||
* If this grows or there are needs to be platform specific, it is
|
* If this grows or there are needs to be platform specific, it is
|
||||||
|
@ -818,9 +817,37 @@ static void local_name_changed_callback(uint16_t index, uint16_t length,
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG("Current alias: %s", adapter->current_alias);
|
DBG("Current alias: %s", adapter->current_alias);
|
||||||
|
DBG("Stored alias: %s", adapter->stored_alias);
|
||||||
|
|
||||||
if (!adapter->current_alias)
|
if (!adapter->current_alias)
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char * version_name = g_strdup_printf("BlueZ %s", VERSION);
|
||||||
|
if ((0 != g_strcmp0(adapter->current_alias,version_name)) && (0 != g_strcmp0(adapter->current_alias,"oem_PC")))
|
||||||
|
{
|
||||||
|
if (0 != g_strcmp0(adapter->stored_alias,adapter->current_alias))
|
||||||
|
{
|
||||||
|
adapter->stored_alias = g_strdup(adapter->current_alias);
|
||||||
|
store_adapter_info(adapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (NULL != adapter->stored_alias)
|
||||||
|
{
|
||||||
|
adapter->current_alias = g_strdup(adapter->stored_alias);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_free(version_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG("name: %s", adapter->name);
|
||||||
|
DBG("short name: %s", adapter->short_name);
|
||||||
|
DBG("system name: %s", adapter->system_name);
|
||||||
|
DBG("current alias: %s", adapter->current_alias);
|
||||||
|
DBG("stored alias: %s", adapter->stored_alias);
|
||||||
|
|
||||||
|
|
||||||
g_dbus_emit_property_changed(dbus_conn, adapter->path,
|
g_dbus_emit_property_changed(dbus_conn, adapter->path,
|
||||||
ADAPTER_INTERFACE, "Alias");
|
ADAPTER_INTERFACE, "Alias");
|
||||||
|
@ -894,6 +921,11 @@ int adapter_set_name(struct btd_adapter *adapter, const char *name)
|
||||||
ADAPTER_INTERFACE, "Name");
|
ADAPTER_INTERFACE, "Name");
|
||||||
|
|
||||||
/* alias is preferred over system name */
|
/* alias is preferred over system name */
|
||||||
|
DBG("adapter->name: %s", adapter->name);
|
||||||
|
DBG("adapter->system_name: %s", adapter->system_name);
|
||||||
|
DBG("adapter->current_alias: %s", adapter->current_alias);
|
||||||
|
DBG("adapter->stored_alias: %s", adapter->stored_alias);
|
||||||
|
|
||||||
if (adapter->stored_alias)
|
if (adapter->stored_alias)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -902,6 +934,17 @@ int adapter_set_name(struct btd_adapter *adapter, const char *name)
|
||||||
g_dbus_emit_property_changed(dbus_conn, adapter->path,
|
g_dbus_emit_property_changed(dbus_conn, adapter->path,
|
||||||
ADAPTER_INTERFACE, "Alias");
|
ADAPTER_INTERFACE, "Alias");
|
||||||
|
|
||||||
|
char * version_name = g_strdup_printf("BlueZ %s", VERSION);
|
||||||
|
DBG("version_name: %s", version_name);
|
||||||
|
if (NULL == adapter->stored_alias && (0 != g_strcmp0(name,version_name)) && (0 != g_strcmp0(name,"oem_PC")))
|
||||||
|
{
|
||||||
|
adapter->stored_alias = g_strdup(name);
|
||||||
|
adapter->current_alias = g_strdup(name);
|
||||||
|
store_adapter_info(adapter);
|
||||||
|
}
|
||||||
|
g_free(version_name);
|
||||||
|
|
||||||
|
|
||||||
return set_name(adapter, name);
|
return set_name(adapter, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -934,7 +977,20 @@ struct btd_device *btd_adapter_find_device(struct btd_adapter *adapter,
|
||||||
if (bdaddr_type == BDADDR_BREDR)
|
if (bdaddr_type == BDADDR_BREDR)
|
||||||
device_set_bredr_support(device);
|
device_set_bredr_support(device);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
//蓝牙耳机音箱 不支持 le , 防止出现 连接异常情况
|
||||||
|
const char * icon = btd_device_get_icon(device);
|
||||||
|
if(icon && (strcmp(icon, "audio-headset") || strcmp(icon, "audio-headphones")))
|
||||||
|
{
|
||||||
|
DBG("device is audio, not set le, icon : %s", icon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
device_set_le_support(device, bdaddr_type);
|
device_set_le_support(device, bdaddr_type);
|
||||||
|
DBG("device->le set true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
@ -10336,6 +10392,32 @@ int adapter_init(void)
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
int set_a2dp_state_hisi(bool status, struct btd_adapter *adapter, const bdaddr_t *bdaddr,
|
||||||
|
uint8_t addr_type)
|
||||||
|
{
|
||||||
|
info("is_huawei:%d",is_huawei);
|
||||||
|
if (!is_huawei)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
struct mgmt_cp_pair_device cp;
|
||||||
|
|
||||||
|
memset(&cp, 0, sizeof(cp));
|
||||||
|
bacpy(&cp.addr.bdaddr, bdaddr);
|
||||||
|
cp.addr.type = addr_type;
|
||||||
|
info("set_a2dp_state_hisi begin status==%d",status);
|
||||||
|
if(status == true)
|
||||||
|
cp.io_cap = A2DP_STATE_START;
|
||||||
|
if(status == false)
|
||||||
|
cp.io_cap = A2DP_STATE_STOP;
|
||||||
|
|
||||||
|
int ret = mgmt_send(adapter->mgmt, MGMT_OP_PAIR_DEVICE_A2DP_STATE,
|
||||||
|
adapter->dev_id, sizeof(cp), &cp,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
|
info("set_a2dp_state_hisi device end ret =%d", ret);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void adapter_cleanup(void)
|
void adapter_cleanup(void)
|
||||||
{
|
{
|
||||||
|
@ -10417,3 +10499,8 @@ bool btd_has_kernel_features(uint32_t features)
|
||||||
{
|
{
|
||||||
return (kernel_features & features) ? true : false;
|
return (kernel_features & features) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool adapter_get_is_huawei()
|
||||||
|
{
|
||||||
|
return is_huawei;
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
/* Invalid SSP passkey value used to indicate negative replies */
|
/* Invalid SSP passkey value used to indicate negative replies */
|
||||||
#define INVALID_PASSKEY 0xffffffff
|
#define INVALID_PASSKEY 0xffffffff
|
||||||
|
|
||||||
|
#define MGMT_OP_PAIR_DEVICE_A2DP_STATE 0x0019
|
||||||
|
#define A2DP_STATE_START 0x06
|
||||||
|
#define A2DP_STATE_STOP 0x07
|
||||||
|
|
||||||
struct btd_adapter;
|
struct btd_adapter;
|
||||||
struct btd_device;
|
struct btd_device;
|
||||||
struct queue;
|
struct queue;
|
||||||
|
@ -121,6 +125,7 @@ struct btd_adapter_driver {
|
||||||
|
|
||||||
void device_resolved_drivers(struct btd_adapter *adapter,
|
void device_resolved_drivers(struct btd_adapter *adapter,
|
||||||
struct btd_device *device);
|
struct btd_device *device);
|
||||||
|
int set_a2dp_state_hisi(bool status, struct btd_adapter *adapter, const bdaddr_t *bdaddr, uint8_t addr_type);
|
||||||
typedef void (*service_auth_cb) (DBusError *derr, void *user_data);
|
typedef void (*service_auth_cb) (DBusError *derr, void *user_data);
|
||||||
|
|
||||||
void adapter_add_profile(struct btd_adapter *adapter, gpointer p);
|
void adapter_add_profile(struct btd_adapter *adapter, gpointer p);
|
||||||
|
@ -257,3 +262,5 @@ bool btd_adapter_set_allowed_uuids(struct btd_adapter *adapter,
|
||||||
bool btd_adapter_is_uuid_allowed(struct btd_adapter *adapter,
|
bool btd_adapter_is_uuid_allowed(struct btd_adapter *adapter,
|
||||||
const char *uuid_str);
|
const char *uuid_str);
|
||||||
bool one_audio_device_connection(struct btd_device *dev,struct btd_adapter *pter,uint8_t bdaddr_type);
|
bool one_audio_device_connection(struct btd_device *dev,struct btd_adapter *pter,uint8_t bdaddr_type);
|
||||||
|
|
||||||
|
bool adapter_get_is_huawei();
|
||||||
|
|
33
src/device.c
33
src/device.c
|
@ -1741,7 +1741,7 @@ static int connect_next(struct btd_device *dev)
|
||||||
err = btd_service_connect(service);
|
err = btd_service_connect(service);
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
DBG("seivice %s, error %d", btd_service_get_profile(service)->name, err);
|
DBG("service %s, error %d", btd_service_get_profile(service)->name, err);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2007,7 +2007,7 @@ static GSList *create_pending_list(struct btd_device *dev, const char *uuid)
|
||||||
|
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
service = find_connectable_service(dev, uuid);
|
service = find_connectable_service(dev, uuid);
|
||||||
|
info("null service, uuid : %s", uuid);
|
||||||
if (!service)
|
if (!service)
|
||||||
return dev->pending;
|
return dev->pending;
|
||||||
|
|
||||||
|
@ -2022,7 +2022,7 @@ static GSList *create_pending_list(struct btd_device *dev, const char *uuid)
|
||||||
service = l->data;
|
service = l->data;
|
||||||
p = btd_service_get_profile(service);
|
p = btd_service_get_profile(service);
|
||||||
|
|
||||||
DBG("service: %s pripoty: %d", p->name, p->priority);
|
DBG("service: %s pripoty: %d ", p->name, p->priority);
|
||||||
|
|
||||||
if (!p->auto_connect)
|
if (!p->auto_connect)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2033,11 +2033,19 @@ static GSList *create_pending_list(struct btd_device *dev, const char *uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_slist_find(dev->pending, service))
|
if (g_slist_find(dev->pending, service))
|
||||||
|
{
|
||||||
|
DBG("");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (btd_service_get_state(service) !=
|
if (btd_service_get_state(service) !=
|
||||||
BTD_SERVICE_STATE_DISCONNECTED)
|
BTD_SERVICE_STATE_DISCONNECTED)
|
||||||
|
{
|
||||||
|
DBG("");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DBG("insert service: %s", p->name);
|
DBG("insert service: %s", p->name);
|
||||||
dev->pending = g_slist_insert_sorted(dev->pending, service,
|
dev->pending = g_slist_insert_sorted(dev->pending, service,
|
||||||
|
@ -3410,7 +3418,19 @@ static void load_info(struct btd_device *device, const char *local,
|
||||||
if (g_str_equal(*t, "BR/EDR"))
|
if (g_str_equal(*t, "BR/EDR"))
|
||||||
device->bredr = true;
|
device->bredr = true;
|
||||||
else if (g_str_equal(*t, "LE"))
|
else if (g_str_equal(*t, "LE"))
|
||||||
|
{
|
||||||
|
//蓝牙耳机音箱 不支持 le , 防止出现 连接异常情况
|
||||||
|
const char * icon = class_to_icon(device->class);
|
||||||
|
if(icon && (strcmp(icon, "audio-headset") || strcmp(icon, "audio-headphones")))
|
||||||
|
{
|
||||||
|
DBG("device is audio, not set le, icon : %s", icon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
device->le = true;
|
device->le = true;
|
||||||
|
DBG("device->le set true");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
error("Unknown device technology");
|
error("Unknown device technology");
|
||||||
}
|
}
|
||||||
|
@ -4268,7 +4288,11 @@ struct btd_device *device_create(struct btd_adapter *adapter,
|
||||||
if (bdaddr_type == BDADDR_BREDR)
|
if (bdaddr_type == BDADDR_BREDR)
|
||||||
device->bredr = true;
|
device->bredr = true;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
device->le = true;
|
device->le = true;
|
||||||
|
DBG("device->le set true");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
str = load_cached_name(device, btd_adapter_get_storage_dir(adapter),
|
str = load_cached_name(device, btd_adapter_get_storage_dir(adapter),
|
||||||
dst);
|
dst);
|
||||||
|
@ -4373,6 +4397,7 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
|
||||||
* Resolving purposes we can now assume LE is supported.
|
* Resolving purposes we can now assume LE is supported.
|
||||||
*/
|
*/
|
||||||
device->le = true;
|
device->le = true;
|
||||||
|
DBG("device->le set true");
|
||||||
|
|
||||||
bacpy(&device->bdaddr, bdaddr);
|
bacpy(&device->bdaddr, bdaddr);
|
||||||
device->bdaddr_type = bdaddr_type;
|
device->bdaddr_type = bdaddr_type;
|
||||||
|
@ -4398,7 +4423,7 @@ void device_set_le_support(struct btd_device *device, uint8_t bdaddr_type)
|
||||||
{
|
{
|
||||||
if (device->le)
|
if (device->le)
|
||||||
return;
|
return;
|
||||||
|
DBG("device->le set true");
|
||||||
device->le = true;
|
device->le = true;
|
||||||
device->bdaddr_type = bdaddr_type;
|
device->bdaddr_type = bdaddr_type;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* kylin - Bluetooth configure for Linux
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023- Kylin Corporation
|
||||||
|
* Copyright (C) 2023- Dengtuo Kylin <dengtuo@kylinos.cn>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "kylin_bluetooth.h"
|
||||||
|
|
||||||
|
bool is_huawei = false;
|
||||||
|
|
||||||
|
bool systemEnvironmentinfo(void)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
int nread=0;
|
||||||
|
ssize_t len = 0;
|
||||||
|
char *buf=NULL;
|
||||||
|
char *buffer=NULL;
|
||||||
|
char *file = FILE_CPUINFO;
|
||||||
|
|
||||||
|
fp = fopen(file, "rb");
|
||||||
|
if (fp == NULL)
|
||||||
|
{
|
||||||
|
printf("error to open: %s\n", file);
|
||||||
|
fclose(fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while((nread = getline(&buffer, &len, fp)) != -1)
|
||||||
|
{
|
||||||
|
if((buf=strstr(buffer, "Hardware"))!=NULL &&
|
||||||
|
((buf=strstr(buffer, "HUAWEI"))!=NULL ||
|
||||||
|
(buf=strstr(buffer, "Kirin" ))!=NULL )) /* 简单实现grep的功能 */
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* kylin - Bluetooth configure for Linux
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023- Kylin Corporation
|
||||||
|
* Copyright (C) 2023- Dengtuo Kylin <dengtuo@kylinos.cn>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <dbus/dbus.h>
|
||||||
|
|
||||||
|
#include "gdbus/gdbus.h"
|
||||||
|
#include "dbus-common.h"
|
||||||
|
|
||||||
|
#define FILE_CPUINFO "/proc/cpuinfo"
|
||||||
|
#define KYLINCONFIGDIR "/etc/bluetooth"
|
||||||
|
|
||||||
|
//运行环境配置
|
||||||
|
extern bool is_huawei;
|
||||||
|
|
||||||
|
bool systemEnvironmentinfo(void);
|
10
src/main.c
10
src/main.c
|
@ -53,6 +53,8 @@
|
||||||
#include "agent.h"
|
#include "agent.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
|
|
||||||
|
#include "kylin_bluetooth.h"
|
||||||
|
|
||||||
#define BLUEZ_NAME "org.bluez"
|
#define BLUEZ_NAME "org.bluez"
|
||||||
|
|
||||||
#define DEFAULT_PAIRABLE_TIMEOUT 0 /* disabled */
|
#define DEFAULT_PAIRABLE_TIMEOUT 0 /* disabled */
|
||||||
|
@ -61,6 +63,8 @@
|
||||||
|
|
||||||
#define SHUTDOWN_GRACE_SECONDS 10
|
#define SHUTDOWN_GRACE_SECONDS 10
|
||||||
|
|
||||||
|
#define CLASS_PC 0x00010C
|
||||||
|
|
||||||
struct btd_opts btd_opts;
|
struct btd_opts btd_opts;
|
||||||
static GKeyFile *main_conf;
|
static GKeyFile *main_conf;
|
||||||
static char *main_conf_file_path;
|
static char *main_conf_file_path;
|
||||||
|
@ -903,7 +907,8 @@ static void init_defaults(void)
|
||||||
/* Default HCId settings */
|
/* Default HCId settings */
|
||||||
memset(&btd_opts, 0, sizeof(btd_opts));
|
memset(&btd_opts, 0, sizeof(btd_opts));
|
||||||
btd_opts.name = g_strdup_printf("BlueZ %s", VERSION);
|
btd_opts.name = g_strdup_printf("BlueZ %s", VERSION);
|
||||||
btd_opts.class = 0x000000;
|
//btd_opts.class = 0x000000;
|
||||||
|
btd_opts.class = CLASS_PC;
|
||||||
btd_opts.pairto = DEFAULT_PAIRABLE_TIMEOUT;
|
btd_opts.pairto = DEFAULT_PAIRABLE_TIMEOUT;
|
||||||
btd_opts.discovto = DEFAULT_DISCOVERABLE_TIMEOUT;
|
btd_opts.discovto = DEFAULT_DISCOVERABLE_TIMEOUT;
|
||||||
btd_opts.tmpto = DEFAULT_TEMPORARY_TIMEOUT;
|
btd_opts.tmpto = DEFAULT_TEMPORARY_TIMEOUT;
|
||||||
|
@ -1161,6 +1166,9 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_huawei = systemEnvironmentinfo();
|
||||||
|
DBG("[kylin log]is_huawei : %d", is_huawei);
|
||||||
|
|
||||||
if (btd_opts.experimental)
|
if (btd_opts.experimental)
|
||||||
gdbus_flags = G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
|
gdbus_flags = G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
|
||||||
|
|
||||||
|
|
|
@ -1096,7 +1096,9 @@ struct uart_t uart[] = {
|
||||||
/* AMP controller UART */
|
/* AMP controller UART */
|
||||||
{ "amp", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
|
{ "amp", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
|
||||||
AMP_DEV, DISABLE_PM, NULL, NULL, NULL },
|
AMP_DEV, DISABLE_PM, NULL, NULL, NULL },
|
||||||
|
/*Hisi Bluetooth Module */
|
||||||
|
{ "hisi", 0x0000, 0x0000, HCI_UART_H4, 115200, 4000000,
|
||||||
|
FLOW_CTL, DISABLE_PM, NULL, NULL, NULL },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1205,6 +1207,30 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* Initialize UART driver */
|
||||||
|
static int hisi_init(char *dev, struct uart_t *u)
|
||||||
|
{
|
||||||
|
printf("hisi_init\n");
|
||||||
|
int fd;
|
||||||
|
fd = open(dev, O_RDWR);
|
||||||
|
printf("dev open, fd = %d\n",fd);
|
||||||
|
|
||||||
|
if (fd < 0) {
|
||||||
|
perror("Can't open device hisi");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ioctl(fd, BT_IOCTL_HCISETPROTO, u->proto) < 0) {
|
||||||
|
perror("Can't set device hisi");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1345,6 +1371,17 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, "Unknown device type or id\n");
|
fprintf(stderr, "Unknown device type or id\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
/*hisi init*/
|
||||||
|
if(u->type == "hisi"){
|
||||||
|
n = hisi_init(dev,u);
|
||||||
|
|
||||||
|
if (n < 0) {
|
||||||
|
perror("Can't initialize device");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* If user specified a initial speed, use that instead of
|
/* If user specified a initial speed, use that instead of
|
||||||
the hardware's default */
|
the hardware's default */
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#define N_HCI 15
|
#define N_HCI 15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BT_IOCTL_HCISETPROTO 101
|
||||||
|
|
||||||
#define HCIUARTSETPROTO _IOW('U', 200, int)
|
#define HCIUARTSETPROTO _IOW('U', 200, int)
|
||||||
#define HCIUARTGETPROTO _IOR('U', 201, int)
|
#define HCIUARTGETPROTO _IOR('U', 201, int)
|
||||||
#define HCIUARTGETDEVICE _IOR('U', 202, int)
|
#define HCIUARTGETDEVICE _IOR('U', 202, int)
|
||||||
|
|
Loading…
Reference in New Issue