2005-05-26 15:09:11

by Frederic Danis

[permalink] [raw]
Subject: [Bluez-devel] Problem to connect hci as non-root

Hello,

I am trying to write an application that can be used to add or remove
paired devices. But when I try to connect to the remote device (to add
it to the paired devices), I get an error EPERM (when I try it as root,
there is no problem).
I can not suid root my application.
Is there a way to connect to a device as user, and to be able to do
authentication ?

Regards

Fred

--
-----------------------------------------------
It is not by improving the oil lamp that one invents the electric bulb!
-----------------------------------------------
Danis Frederic PalmSource Europe
Software engineer
Mail : mailto:[email protected]
-----------------------------------------------



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2005-05-29 19:12:05

by ligi

[permalink] [raw]
Subject: Re: [Bluez-devel] l2ping and timeout

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marcel Holtmann wrote:

> Hi Ligi,
>
>> I am confused about l2ping. The man says: -c count Send count
>> number of packets then exit.
>>
>> -c timeout Wait timeout for the response.
>
>
> no it does not.


OK - my man says that - I have the newest from the gentoo portage -
but it is from 2k2 ... Is there a newer man for l2ping ?

>
>> I need it to determine if a device is in range or out of range or
>> off. If anyone has even an better Idea than l2ping this would
>> help me too. A fast response when the Device is in range would be
>> cool cuz the early my light switches on the less I stumble ...
>
>
> Use the periodic inquiry feature of Bluetooth through the HCI raw
> socket for this.
>
Is there anything in the standart tool base for this?
Any link / doc that lets me know how to do this?

> Regards
>
> Marcel
>
>
>
thanx
ligi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCmhQF3NorRo/jFWIRAuaUAKDgJqulNjBewc4WR/yT0bOywqGiQACg0lLi
nRFSUpyle8/3IYuATskpEuY=
=8mVc
-----END PGP SIGNATURE-----



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-29 18:09:17

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] l2ping and timeout

Hi Ligi,

> I am confused about l2ping. The man says:
> -c count
> Send count number of packets then exit.
>
> -c timeout
> Wait timeout for the response.

no it does not.

> I need it to determine if a device is in range or out of range or off.
> If anyone has even an better Idea than l2ping this would help me too.
> A fast response when the Device is in range would be cool cuz the
> early my light switches on the less I stumble ...

Use the periodic inquiry feature of Bluetooth through the HCI raw socket
for this.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-29 16:57:59

by ligi

[permalink] [raw]
Subject: [Bluez-devel] l2ping and timeout

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am confused about l2ping. The man says:
-c count
Send count number of packets then exit.

-c timeout
Wait timeout for the response.

- -c 1s - my first issue didnt work!
I need it to determine if a device is in range or out of range or off.
If anyone has even an better Idea than l2ping this would help me too.
A fast response when the Device is in range would be cool cuz the
early my light switches on the less I stumble ...


ligi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCmfSW3NorRo/jFWIRAnSLAKDf6D3eIGA5wQSm5SXa7nO6GZMUYwCguJ03
wNoaSXPYY14oOnzsWkntumM=
=86Ig
-----END PGP SIGNATURE-----



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-26 17:02:00

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Problem to connect hci as non-root

Hi Fred,

> I agree with you that Linux should not need a pairing/bonding
> application. But we got one and want to keep it when porting our
> applications to Linux.

you know that this will only work if the other side implements a simple
trust policy. If you move to service based policies this makes no longer
real sense. The only advantage will be that the link key is exchanged.

> I do not know differences between setsockopt() and ioctl() enough to
> give you an advice, sorry.

If anyone have an opinion on this, please let me know. I am totally
undecided at the moment.

> Is there any way to force the authentication (encryption) for a L2CAP
> socket (at creation time for example) ?

We support if for the incoming connection on L2CAP and RFCOMM level, but
nobody added support for outgoing connection. If you set the LM_AUTH
flag for outgoing connections it will be ignored. Maybe it is worth to
implement it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-26 16:48:37

by Frederic Danis

[permalink] [raw]
Subject: Re: [Bluez-devel] Problem to connect hci as non-root

I agree with you that Linux should not need a pairing/bonding
application. But we got one and want to keep it when porting our
applications to Linux.
I do not know differences between setsockopt() and ioctl() enough to
give you an advice, sorry.
Is there any way to force the authentication (encryption) for a L2CAP
socket (at creation time for example) ?

Regards

Fred

-----------------------------------------------
It is not by improving the oil lamp that one invents the electric bulb!
-----------------------------------------------
Danis Frederic PalmSource Europe
Software engineer
Mail : mailto:[email protected]
-----------------------------------------------



Marcel Holtmann wrote:

>Hi Fred,
>
>
>
>>OK, I thought about this but I don't know how to start the
>>authentication from an L2CAP socket.
>>Is it possible ?
>>Is it possible to acces to hci command from the L2CAP socket ?
>>
>>
>
>you can get the ACL handle through getsockopt() and then open an HCI raw
>socket and send the command. But I think the Authentication_Requested
>command will also fail due to limited permissions.
>
>For some time I thought to add the possibility to do authentication and
>enable encryption through the socket interface or L2CAP and RFCOMM. At
>the moment I haven't decided if I wanna do that with setsockopt() or
>with ioctl(). Feel free to suggest something.
>
>Do you think a pairing/bonding application is needed for Linux? If one
>side requests the authentication we will handle it through PIN helper
>and the rest is handled inside hcid. Deleting the link key is the only
>job we might need an application for.
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Yahoo.
>Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
>Search APIs Find out how you can build Yahoo! directly into your own
>Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-26 15:43:56

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Problem to connect hci as non-root

Hi Fred,

> OK, I thought about this but I don't know how to start the
> authentication from an L2CAP socket.
> Is it possible ?
> Is it possible to acces to hci command from the L2CAP socket ?

you can get the ACL handle through getsockopt() and then open an HCI raw
socket and send the command. But I think the Authentication_Requested
command will also fail due to limited permissions.

For some time I thought to add the possibility to do authentication and
enable encryption through the socket interface or L2CAP and RFCOMM. At
the moment I haven't decided if I wanna do that with setsockopt() or
with ioctl(). Feel free to suggest something.

Do you think a pairing/bonding application is needed for Linux? If one
side requests the authentication we will handle it through PIN helper
and the rest is handled inside hcid. Deleting the link key is the only
job we might need an application for.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-26 15:33:00

by Frederic Danis

[permalink] [raw]
Subject: Re: [Bluez-devel] Problem to connect hci as non-root

OK, I thought about this but I don't know how to start the
authentication from an L2CAP socket.
Is it possible ?
Is it possible to acces to hci command from the L2CAP socket ?

Regards

Fred

-----------------------------------------------
It is not by improving the oil lamp that one invents the electric bulb!
-----------------------------------------------
Danis Frederic PalmSource Europe
Software engineer
Mail : mailto:[email protected]
-----------------------------------------------



Marcel Holtmann wrote:

>Hi Fred,
>
>
>
>>I am trying to write an application that can be used to add or remove
>>paired devices. But when I try to connect to the remote device (to add
>>it to the paired devices), I get an error EPERM (when I try it as root,
>>there is no problem).
>>I can not suid root my application.
>>Is there a way to connect to a device as user, and to be able to do
>>authentication ?
>>
>>
>
>why don't you connect a L2CAP channel (for example SDP)?
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Yahoo.
>Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
>Search APIs Find out how you can build Yahoo! directly into your own
>Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-05-26 15:20:45

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Problem to connect hci as non-root

Hi Fred,

> I am trying to write an application that can be used to add or remove
> paired devices. But when I try to connect to the remote device (to add
> it to the paired devices), I get an error EPERM (when I try it as root,
> there is no problem).
> I can not suid root my application.
> Is there a way to connect to a device as user, and to be able to do
> authentication ?

why don't you connect a L2CAP channel (for example SDP)?

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel