Skip site navigation (1)Skip section navigation (2)
Date:      13 Mar 2003 22:16:22 +0000
From:      Pav Lucistnik <pav@oook.cz>
To:        Maksim Yevmenkin <Maksim.Yevmenkin@cw.com>
Cc:        mobile@freebsd.org
Subject:   RE: Anycom bluetooth progress
Message-ID:  <1047593770.613.68.camel@gprs2107.eurotel.cz>
In-Reply-To: <790A8B1F40ACA848939EBD247AE490302794E7@scl8ex04.int.exodus.net>
References:  <790A8B1F40ACA848939EBD247AE490302794E7@scl8ex04.int.exodus.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On čt, 2003-03-13 at 03:58, Maksim Yevmenkin wrote:

Hello Maksim,

> > How do I make dialup over my phone? I tried
> > 
> > # rfcomm_pppd -a 00:80:37:29:19:a4 -c -C 1 -d -l rfcomm-dialup
> > rfcomm_pppd[1787]: Could not connect socket. Connection refused (61)
> 
> this is correct if your phone BDADDR is 00:80:37:29:19:a4 and it
> provides DUN service of RFCOMM channel 1. you can find out which
> RFCOMM channel has DUN service via
> 
> # sdptool browse 00:80:37:29:19:a4 (your phone BDADDR)

Yes, there is Dial-Up Networking service on RFCOMM channel 1. As I found
the output of this command interesting, I'm pasting it here:

Browsing 00:80:37:29:19:A4 ...
Service Name: Dial-up Networking
Service RecHandle: 0x10000
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Service Name: Fax
Service RecHandle: 0x10001
Service Class ID List:
  "Fax" (0x1111)
  "Generic Telephony" (0x1204)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2
Profile Descriptor List:
  "Fax" (0x1111)
    Version: 0x0100

Service Name: Voice gateway
Service RecHandle: 0x10002
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100

Service Name: Serial Port 1
Service RecHandle: 0x10003
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4

Service Name: Serial Port 2
Service RecHandle: 0x10004
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 5

Service Name: OBEX Object Push
Service RecHandle: 0x10005
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 10
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

Service Name: IrMC Synchronization
Service RecHandle: 0x10006
Service Class ID List:
  "IrMCSync" (0x1104)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 11
  "OBEX" (0x0008)
Profile Descriptor List:
  "IrMCSync" (0x1104)
    Version: 0x0100

My questions here: do we support headset emulation on PC, or
sending/reading SMS messages? What is IrMC Sync service good for?

> here we try to configure (PN) DLCI 2 (RFCOMM channel 1 on non-initiated
> connection device). we try to turn off credit based flow control and set
> RFCOMM MTU to 127 bytes. your phone rejects our credit flow control
> proposal (not a big problem - probably your phone has older Bluetooth 1.0b
> RFCOMM implementation), but agrees to set RFCOMM MTU to 127 bytes. nothing
> unusual here, except reject for the credit based flow contol.

This phone is Ericsson T39, one of first bluetooth phones on market.
Manual says that it is conforming to 1.0b specs.

> > < ACL data: handle 0x0029 flags 0x02 dlen 8
> >     L2CAP(d): cid 0x41 len 4 [psm 3]
> >       RFCOMM(s): SABM: cr 1 dlci 2 pf 1 ilen 0 fcs 0x59 
> > > HCI Event: Number of Completed Packets(0x13) plen 5
> >   01 29 00 01 00 
> > > ACL data: handle 0x0029 flags 0x02 dlen 8
> >     L2CAP(d): cid 0x43 len 4 [psm 3]
> >       RFCOMM(s): DM: cr 1 dlci 2 pf 1 ilen 0 fcs 0x73 
> 
> we proceed and try to actually open (SABM) DLCI 2 (RFCOMM channel 1 on
> non-initiated connection device). and your phone sends us back a DM
> (Disconnecting Mode) and rejects it! weird - up until this point
> everything was fine.
> 
> what are security settings on the phone? i did not notice any PIN/KEY
> request messages? does manual says anything about it?

Manual says that you have to "pair" your phone with your computer if you
want to connect to it from your PC. This requirement seems quite logical
to me - I don't want strangers connecting to internet over my phone for
my money.

> > I suppose phone refused connection because it's not paired with my
> > computer. I had to pair my Palm handheld with phone when I used it.
> 
> it could be, but i would expect to see it at connection setup time.
> 
> > I found hcsecd, read it's manpage, added this to
> > /usr/local/etc/hcsecd.conf:
> >
> > device {
> >        bdaddr  00:80:37:29:19:a4;
> >        name    "Pavi T39";
> >        key     nokey;
> >        pin     "1234";
> > }
> 
> this looks good. it says:
> 
> 1) when i receive key request for the device 00:80:37:29:19:a4
>    i shell send no key back. 
> 2) when i receive pin request for the device 00:80:37:29:19:a4
>    i shell send "1234" as pin
> 
> > and started hcsecd. Tried pairing on phone, using code "1234". Pairing
> > failed, hcsecd's output was silent, here is hcidump:
> >
> > > HCI Event: Connect Request(0x04) plen 10
> >   A4 19 29 37 80 00 04 02 52 01 
> > < HCI Command: Accept Connection Request(0x01|0x0009) plen 7
> >   A4 19 29 37 80 00 00 
> > > HCI Event: Command Status(0x0f) plen 4
> >   00 01 09 04 
> > > HCI Event: Connect Complete(0x03) plen 11
> >   1A 29 00 A4 19 29 37 80 00 01 00 
> 
> aha. in this case you have your *phone* acting as a client right?
> i.e. you actually told your phone to connect to your PC. 

yes

> you see
> by default Bluetooth devices do not require authentication. so when
> your phone tries to connect to your PC we just respond - go ahead
> its open :) now, in order to request authentication for the incomming
> connections you have to 
> 
> # hccontrol -n ubt0hci Read_Authentication_Enable
> # hccontrol -n ubt0hci Write_Authentication_Enable 1

let's try it

> > What now?
> 
> 1) make sure there are no open beseband connection,
> 
>  # hccontrol -n ubt0hci read_connection_list

there aren't any

> 3) enable authentication for the incoming connection
>  
>  # hccontrol -n ubt0hci write_authentication_enable 1

it's enabled

> 4) start hcsed

started

> 5) use your phone and try to connect to your PC
> you should be able to pair with your phone now. 

Unsuccessfull, exactly same as yesterday.

> HCI Event: Connect Request(0x04) plen 10
  A4 19 29 37 80 00 04 02 52 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  A4 19 29 37 80 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Connect Complete(0x03) plen 11
  1A 29 00 A4 19 29 37 80 00 01 00 

How can I check that hcsecd is getting and responding to incoming
traffic? I checked with strace, it reads correct config file. Here are
some interesting parts:

socket(0x24 /* PF_??? */, SOCK_RAW, 134) = 3
setsockopt(3, 0x802 /* IPPROTO_??? */, 1, [671429626], 12) = 0
[..]
recvfrom(3, 

here it stop blocked reading from that socket. And nothing ever happens
anymore. When I do pairing request on phone, this process does not do
anything. Also there is no change in `ngctl list` output.

So I tried it the other way around, connecting from computer to the
phone. Here hcsecd got invoked, and voila, I have them paired. UFF!
Here is output from hcsecd:

hcsecd[16484]: Got Link_Key_Request event from 'ubt0hci', remote bdaddr
0:80:37:29:19:a4
hcsecd[16484]: Found matching entry, remote bdaddr 0:80:37:29:19:a4,
name 'Pavi T39', link key doesn't exist
hcsecd[16484]: Sending Link_Key_Negative_Reply to 'ubt0hci' for remote
bdaddr 0:80:37:29:19:a4
hcsecd[16484]: Got PIN_Code_Request event from 'ubt0hci', remote bdaddr
0:80:37:29:19:a4
hcsecd[16484]: Found matching entry, remote bdaddr 0:80:37:29:19:a4,
name 'Pavi T39', PIN code exists
hcsecd[16484]: Sending PIN_Code_Reply to 'ubt0hci' for remote bdaddr
0:80:37:29:19:a4

I still think it should work in other direction (phone initiate,
computer accept) too. Rfcomm also works nice. Only (major) drawback is
that I have to pair devices every time I want to connect. But the phone
seems to ask for link key, which I don't have. Can I get one somewhere?
I'm leaving this to further investigation later.

MANY THANKS for drivers and excellent support.
I'm sending this email over bluetooth now :)

-- 
Pav Lucistnik <pav@oook.cz>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1047593770.613.68.camel>