From owner-freebsd-bugs@FreeBSD.ORG Sun Jun 13 15:20:13 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA59616A4D1 for ; Sun, 13 Jun 2004 15:20:13 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A080443D49 for ; Sun, 13 Jun 2004 15:20:13 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i5DFKBWx037307 for ; Sun, 13 Jun 2004 15:20:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i5DFKBTY037306; Sun, 13 Jun 2004 15:20:11 GMT (envelope-from gnats) Resent-Date: Sun, 13 Jun 2004 15:20:11 GMT Resent-Message-Id: <200406131520.i5DFKBTY037306@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Christian Gusenbauer Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D478A16A4CE for ; Sun, 13 Jun 2004 15:18:27 +0000 (GMT) Received: from email09.aon.at (WARSL402PIP6.highway.telekom.at [195.3.96.93]) by mx1.FreeBSD.org (Postfix) with SMTP id 8F40B43D41 for ; Sun, 13 Jun 2004 15:18:26 +0000 (GMT) (envelope-from c47g@gmx.at) Received: (qmail 484944 invoked from network); 13 Jun 2004 15:18:13 -0000 Received: from n882p003.adsl.highway.telekom.at (HELO bones) ([62.47.54.35]) (envelope-sender ) by 172.18.5.238 (qmail-ldap-1.03) with SMTP for ; 13 Jun 2004 15:18:13 -0000 Message-Id: <200406131717.31565.c47g@gmx.at> Date: Sun, 13 Jun 2004 17:17:31 +0200 From: Christian Gusenbauer To: FreeBSD-gnats-submit@FreeBSD.org Subject: misc/67906: PATCH: rfcomm_pppd can now register as 'serial port profile' X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2004 15:20:13 -0000 >Number: 67906 >Category: misc >Synopsis: PATCH: rfcomm_pppd can now register as 'serial port profile' >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jun 13 15:20:11 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Christian Gusenbauer >Release: FreeBSD 5.2-CURRENT i386 >Organization: >Environment: System: FreeBSD bones.gusis.at 5.2-CURRENT FreeBSD 5.2-CURRENT #7: Sat Jun 5 16:51:47 CEST 2004 root@:/jail/obj/jail/src/sys/BONES i386 >Description: These patches add support to rfcomm_pppd to let the server register a LAN or a serial port profile. I added a 'profile' argument to the -s option to allow the user to select which profile he wants to be registered. Some mobile phones like the Sony/Ericsson P900 use a callback mechanism and are searching for a serial port profile to connect to. >How-To-Repeat: >Fix: --- /usr/src/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c Fri Feb 27 16:53:59 2004 +++ /home/cg/tmp/p900/rfcomm_pppd/rfcomm_pppd.c Sun Jun 13 16:35:13 2004 @@ -63,6 +63,7 @@ char *label = NULL, *unit = NULL, *ep = NULL; bdaddr_t addr; int s, channel, detach, server, service; + int lansrv, sppsrv; pid_t pid; memcpy(&addr, NG_HCI_BDADDR_ANY, sizeof(addr)); @@ -70,9 +71,11 @@ detach = 1; server = 0; service = 0; + lansrv = 0; + sppsrv = 0; /* Parse command line arguments */ - while ((s = getopt(argc, argv, "a:cC:dhl:su:")) != -1) { + while ((s = getopt(argc, argv, "a:cC:dhl:s:u:")) != -1) { switch (s) { case 'a': /* BDADDR */ if (!bt_aton(optarg, &addr)) { @@ -115,6 +118,14 @@ case 's': /* server */ server = 1; + if (strcasecmp(optarg, "lan") == 0) { + lansrv = 1; + } else if (strcasecmp(optarg, "sp") == 0) { + sppsrv = 1; + } else { + usage(); + /* NOT REACHED */ + } break; case 'u': /* PPP -unit option */ @@ -182,6 +193,7 @@ struct sigaction sa; void *ss = NULL; sdp_lan_profile_t lan; + sdp_sp_profile_t sp; /* Install signal handler */ memset(&sa, 0, sizeof(sa)); @@ -247,16 +259,32 @@ exit(1); } - memset(&lan, 0, sizeof(lan)); - lan.server_channel = channel; - - if (sdp_register_service(ss, - SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP, - &addr, (void *) &lan, sizeof(lan), NULL) != 0) { - syslog(LOG_ERR, "Unable to register LAN service with " \ - "local SDP daemon. %s (%d)", - strerror(sdp_error(ss)), sdp_error(ss)); - exit(1); + if (sppsrv) { + memset(&sp, 0, sizeof(sp)); + sp.server_channel = channel; + + if (sdp_register_service(ss, SDP_SERVICE_CLASS_SERIAL_PORT, + &addr, (void *) &sp, sizeof(sp), NULL) != 0) { + syslog(LOG_ERR, "Unable to register SP service with " \ + "local SDP daemon. %s (%d)", + strerror(sdp_error(ss)), sdp_error(ss)); + exit(1); + } + } else if (lansrv) { + memset(&lan, 0, sizeof(lan)); + lan.server_channel = channel; + + if (sdp_register_service(ss, + SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP, + &addr, (void *) &lan, sizeof(lan), NULL) != 0) { + syslog(LOG_ERR, "Unable to register LAN service with " \ + "local SDP daemon. %s (%d)", + strerror(sdp_error(ss)), sdp_error(ss)); + exit(1); + } + } else { + usage(); + /* NOT REACHED */ } for (done = 0; !done; ) { @@ -398,7 +426,8 @@ "\t-C channel RFCOMM channel to listen on or connect to (required)\n" \ "\t-d Run in foreground\n" \ "\t-l label Use PPP label (required)\n" \ -"\t-s Act as a server\n" \ +"\t-s (lan|sp) Act as a server and register either as LAN or as\n" \ +"\t Serial Port profile\n" \ "\t-u N Tell PPP to operate on /dev/tunN (client mode only)\n" \ "\t-h Display this message\n", RFCOMM_PPPD); --- /usr/src/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sat Jun 5 12:25:30 2004 +++ /home/cg/tmp/p900/rfcomm_pppd/rfcomm_pppd.8 Sun Jun 13 16:58:16 2004 @@ -40,7 +40,7 @@ .Fl l Ar label .Fl u Ar N .Nm -.Fl s +.Fl s Ar service .Op Fl dh .Op Fl a Ar BD_ADDR .Fl C Ar channel @@ -126,8 +126,14 @@ In both client and server modes, this required option specifies which .Xr ppp 8 label will be used. -.It Fl s -Act as an RFCOMM server. +.It Fl s Ar profile +Act as an RFCOMM server and register a service. Supported service names are +.Cm LAN +(for LAN Access using PPP service) and +.Cm SP +(for Serial Profile using PPP service). Some mobile phones like the Sony/Ericsson +P900 use a callback mechanism and are searching for a serial port profile to +connect to. .It Fl u Ar N This option maps directly onto .Fl unit >Release-Note: >Audit-Trail: >Unformatted: