From owner-freebsd-bluetooth@FreeBSD.ORG Tue Nov 4 11:46:17 2008 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8448C1065674 for ; Tue, 4 Nov 2008 11:46:17 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from smtp01.one2one.net (smtp01.one2one.net [149.254.200.196]) by mx1.freebsd.org (Postfix) with ESMTP id 221418FC2A for ; Tue, 4 Nov 2008 11:46:16 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from [127.0.0.1] (helo=localhost) by smtpbarns01 with esmtp (Exim 4.50) id 1KxKMO-00009o-8J; Tue, 04 Nov 2008 11:46:12 +0000 Received: from smtpbarns01 ([127.0.0.1]) by localhost (smtpbarns01 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00579-02; Tue, 4 Nov 2008 11:46:11 +0000 (GMT) Received: from [10.34.38.6] (helo=rya-online.net) by smtpbarns01 with smtp (Exim 4.50) id 1KxKML-00009k-4C; Tue, 04 Nov 2008 11:46:11 +0000 Received: (nullmailer pid 1128 invoked by uid 1000); Tue, 04 Nov 2008 11:45:05 -0000 Date: Tue, 4 Nov 2008 11:45:05 +0000 (GMT) To: Guido Falsi In-Reply-To: <20081104111947.GB62907@megatron.madpilot.net> References: <20081104111947.GB62907@megatron.madpilot.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Message-Id: <1225799105.807983.1164.nullmailer@galant.ukfsn.org> From: Iain Hibbert X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: plunky@rya-online.net X-SA-Exim-Scanned: No (on smtpbarns01); SAEximRunCond expanded to false Cc: freebsd-bluetooth@freebsd.org Subject: Re: RFComm behaviour with nokia mobiles X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 11:46:17 -0000 On Tue, 4 Nov 2008, Guido Falsi wrote: > I completed the gnokii adaption to talk to freebsd sdp and it tries > to connwect to rf channel 15 on both phnes, the same rfcomm_sppd > tries. It loooks like the correct one in fact, but even after > associating the phone with hcsecd I can't really connect. can you show what the output of sdpcontrol is when examining this service? (try search for protocol 0x0003 should give all RFCOMM channels) IIRC if you are connecting to a serial port service then it is not always the case that there will be an AT command interpreter at the other end.. also, the patch below adds support to print out the primary language ServiceName to the port of sdpcontrol I made for NetBSD. It might not apply cleanly to original sdpcontrol but should not be too difficult to adapt and it seems quite useful.. I haven't committed it here because its not really complete as the string that is produced is not guaranteed to be ASCII (the spec recommends using UTF-8) but I would have to examine the languagebase settings and do some iconv magic to get it 100% correct. iain --- /usr/src/usr.bin/sdpquery/search.c 2007-11-09 20:10:29.000000000 +0000 +++ search.c 2008-11-01 17:26:52.000000000 +0000 @@ -83,7 +83,9 @@ static uint32_t attrs[] = SDP_ATTR_RANGE( SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST, SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST), SDP_ATTR_RANGE( SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST, - SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST) + SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST), + SDP_ATTR_RANGE( SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID + SDP_ATTR_SERVICE_NAME_OFFSET, + SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID + SDP_ATTR_SERVICE_NAME_OFFSET), }; #define attrs_len (sizeof(attrs)/sizeof(attrs[0])) @@ -524,6 +526,47 @@ print_bluetooth_profile_descriptor_list( } } /* print_bluetooth_profile_descriptor_list */ +static void +print_service_name(uint8_t const *start, uint8_t const *end) +{ + uint32_t type, len; + + if (end - start < 2) { + fprintf(stderr, "Invalid Service Name. " \ + "Too short, len=%zd\n", end - start); + return; + } + + SDP_GET8(type, start); + switch (type) { + case SDP_DATA_STR8: + SDP_GET8(len, start); + break; + + case SDP_DATA_STR16: + SDP_GET16(len, start); + break; + + case SDP_DATA_STR32: + SDP_GET32(len, start); + break; + + default: + fprintf(stderr, "Invalid Service Name. " \ + "Not a string, type=%#x\n", type); + return; + /* NOT REACHED */ + } + + if (start + len > end) { + fprintf(stderr, "Invalid Service Name. " \ + "Too short, len=%d (%zd)\n", len, end - start); + return; + } + + fprintf(stdout, "\t\"%*.*s\"\n", len, len, start); +} /* print_service_name */ + struct service { const char *name; uint16_t class; @@ -651,6 +694,12 @@ do_sdp_search(bdaddr_t *laddr, bdaddr_t values[n].value + values[n].vlen); break; + case SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID + SDP_ATTR_SERVICE_NAME_OFFSET: + fprintf(stdout, "Service Name:\n"); + print_service_name(values[n].value, + values[n].value + values[n].vlen); + break; + default: fprintf(stderr, "Unexpected attribute ID=%#4.4x\n", values[n].attr);