Diff between fdfa5bdb21ba00ec96a738be39e90a26d19709e4 and 8e318cecb3a2438cdef8278b9c0083cec5688dfe

Changed Files

File Additions Deletions Status
src/profile.c +71 -0 modified

Full Patch

diff --git a/src/profile.c b/src/profile.c
index 6bf1782..e41eace 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -228,6 +228,60 @@
 		</attribute>						\
 	</record>"
 
+#define OPP_RECORD							\
+	"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>			\
+	<record>							\
+		<attribute id=\"0x0001\">				\
+			<sequence>					\
+				<uuid value=\"0x1105\" />		\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0004\">				\
+			<sequence>					\
+				<sequence>				\
+					<uuid value=\"0x0100\" />	\
+				</sequence>				\
+				<sequence>				\
+					<uuid value=\"0x0003\" />	\
+					<uint8 value=\"0x%02x\" />	\
+				</sequence>				\
+				<sequence>				\
+					<uuid value=\"0x0008\"/>	\
+				</sequence>				\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0005\">				\
+			<sequence>					\
+				<uuid value=\"0x1002\" />		\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0009\">				\
+			<sequence>					\
+				<sequence>				\
+					<uuid value=\"0x1105\" />	\
+					<uint16 value=\"0x%04x\" />	\
+				</sequence>				\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0303\">				\
+			<sequence>					\
+				<uint8 value=\"0x01\"/>			\
+				<uint8 value=\"0x02\"/>			\
+				<uint8 value=\"0x03\"/>			\
+				<uint8 value=\"0x04\"/>			\
+				<uint8 value=\"0x05\"/>			\
+				<uint8 value=\"0x06\"/>			\
+				<uint8 value=\"0xff\"/>			\
+			</sequence>					\
+		</attribute>						\
+		<attribute id=\"0x0200\">				\
+			<uint16 value=\"%u\" name=\"psm\"/>		\
+		</attribute>						\
+		<attribute id=\"0x0100\">				\
+			<text value=\"%s\" />				\
+		</attribute>						\
+	</record>"
+
 struct ext_io;
 
 struct ext_profile {
@@ -1232,6 +1286,20 @@ static char *get_dun_record(struct ext_profile *ext, struct ext_io *l2cap,
 								ext->name);
 }
 
+static char *get_opp_record(struct ext_profile *ext, struct ext_io *l2cap,
+							struct ext_io *rfcomm)
+{
+	uint16_t psm = 0;
+	uint8_t chan = 0;
+
+	if (l2cap)
+		psm = l2cap->psm;
+	if (rfcomm)
+		chan = rfcomm->chan;
+
+	return g_strdup_printf(OPP_RECORD, chan, ext->version, psm, ext->name);
+}
+
 static struct default_settings {
 	const char	*uuid;
 	const char	*name;
@@ -1285,8 +1353,11 @@ static struct default_settings {
 		.uuid		= OBEX_OPP_UUID,
 		.name		= "Object Push",
 		.channel	= OPP_DEFAULT_CHANNEL,
+		.psm		= BTD_PROFILE_PSM_AUTO,
 		.sec_level	= BT_IO_SEC_LOW,
 		.authorize	= false,
+		.get_record	= get_opp_record,
+		.version	= 0x0102,
 	}, {
 		.uuid		= OBEX_FTP_UUID,
 		.name		= "File Transfer",