Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2003 14:39:38 -0800
From:      "Maksim Yevmenkin" <Maksim.Yevmenkin@cw.com>
To:        "Pav Lucistnik" <pav@oook.cz>
Cc:        <mobile@freebsd.org>
Subject:   RE: Anycom bluetooth progress
Message-ID:  <790A8B1F40ACA848939EBD247AE490302794EA@scl8ex04.int.exodus.net>

next in thread | raw e-mail | index | archive | help

Hello Pav

[... more info skipped ...]

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

the headset profile is not currently supported. i need to add
support for SCO (voice) links first. BTW you can send SMS messages
with serial port. all you need to do is to open RFCOMM connection
to one of the channels that has serial port service. then you need
to get AT command set for your phone and then just send AT command
and you should be set. in fact you can control your entire phone
over serial port.

IrMC Sync service is for synchronization with PC. you can use 
"obexapp" client from snapshot ports/ to download/upload address
book and calendar entries. its just file based protocol that uses
OBEX as transport. please read man page for obexapp for more info.

> > 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.

i see. anyway its not a big deal. its just flow control is different
in original GSM spec.

> > > < 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.

oh the joy of link layer authentication :) it seems Bluetooth did not
learn 802.11 WEP lesson quite well :) but i must say Bluetooth has made
some steps in the right direction. this pairing thing is bogus IMO. 

[...]

> > 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

did you do hccontrol -n ubt0hci read_authentication_enable
to verify its really on?

> > 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 

what?! this is really strange. here is sniplet from Bluetooth 1.1 spec

HCI_Write_Authentication_Enable 0x0020 Authentication_Enable Status

This command will write the value for the Authentication_Enable parameter.
The Authentication_Enable parameter controls if the local device requires to
authenticate the remote device at connection setup (between the
Create_Connection command or acceptance of an incoming ACL connection
and the corresponding Connection Complete event). At connection setup, only
the device(s) with the Authentication_Enable parameter enabled will try to
authenticate the other device.
Note: Changing this parameter does not affect existing connections.

you PC MUST authenticate incomming connection from the phone. otherwise
its not conforming to Bluetooth 1.1 spec. are you sure there are no active
baseband connections? another reason could be differences between Bluetooth
1.0 and 1.1. i will download 1.0b spec and check on that.

> 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.

looks fine to me. hcsecd listens on raw HCI sockets for Link_Key_Request 
or PIN_Code_Request. it will block until required event is received.

> 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

phone says: give me the link key, damn it

> 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

PC says: sorry, no link key for you buddy

> hcsecd[16484]: Got PIN_Code_Request event from 'ubt0hci', remote bdaddr
> 0:80:37:29:19:a4

phone says: damn it, how about pin code then?

> 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

PC says: sure, we have pin code for you.

so this looks fine to me :)

> I still think it should work in other direction (phone initiate,
> computer accept) too. Rfcomm also works nice. Only (major) drawback is

it should. and i have to figure out why it does not. i think i have 1.0b
device. i will try to figure this one later.

> 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.

you sure can :) just create one :) its pre-shared link key that works
between pair of BDADDRs. you can program this key info device itself
or put it into hcsecd config. check out {Read,Write,Delete}_Stored_Link_Key
commands in hccontrol(8). the problem is the phone. can you program link
key in the phone? my wife's sony ericsson t68i does not have this feature.

one thing you could try is

1) run hcidump -x while paring devices
2) watch for Link_Key_Notification event and record link key.
   Note: you will need to extract key from the dump. check ng_hci.h
   file for Link_Key_Notification event structure.
3) program the key into your PC device with Write_Stored_Link_Key
   use your phone BDADDR and link key you just extracted. Note: there
   might be some byte ordering issues.
4) on your phone save PC device to the list of paired devices. Hopefuly
   phone will store the link key.
5) disconnect from the phone
6) try to re-connect PC to the phone

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

no problem. thanks for you time :) how is GPRS speed? is it usable
for internet browsing? 

thanks
max


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?790A8B1F40ACA848939EBD247AE490302794EA>