2005-07-16 16:32:06

by Dirk Vanden Boer

[permalink] [raw]
Subject: [Bluez-devel] At commands not available

Hi,
I'm trying to send AT commands to my mobile phone using an rfcomm
connection. The connection seems to work because I can exectute some
commands (like manufacturer name). But a whole bunch of commands are
not available (eg. battery charge: "AT+CBC\r" returns ERROR). I can
run the AT* command which lists the available commands but a lot of
common commands are not in the list. Could it be that there is
something wrong with my connection?

Minimilistic testing code:
//necessary includes
#include ...

#define BTADDR "00:0E:07:2D:85:C7"
#define CHANNEL 4
#define BUFSIZE 1024

using namespace std;
string ATCommand(int sock, string atcmd);

int main()
{
=09int sock;
=09struct sockaddr_rc laddr, raddr;
=09struct hci_dev_info di;
=09=09
=09if(hci_devinfo(0, &di) < 0) {
=09=09perror("HCI device info failed"); exit(1);
=09}
=09
=09laddr.rc_family =3D AF_BLUETOOTH;
=09laddr.rc_bdaddr =3D di.bdaddr;
=09laddr.rc_channel =3D 0;
=09
=09raddr.rc_family =3D AF_BLUETOOTH;
=09str2ba(BTADDR,&raddr.rc_bdaddr);
=09raddr.rc_channel =3D htobs(CHANNEL);
=09
=09if((sock =3D socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0) {
=09=09perror("socket"); exit(1);
=09}
=09if(bind(sock, (struct sockaddr *)&laddr, sizeof(laddr)) < 0) {
=09=09perror("bind"); exit(1);
=09}
=09if(connect(sock, (struct sockaddr *)&raddr, sizeof(raddr)) < 0) {
=09=09perror("connect"); exit(1);
=09}
=09
=09cout << "Response:\n" << ATCommand(sock, "AT+CBC\r");
=09
=09close (sock);
=09return 0;
}

string ATCommand(int sock, string atcmd)
{
=09char buf[BUFSIZE];
=09int nbytes;
=09string response =3D "";
=09
=09if(send(sock, atcmd.c_str(), atcmd.length(), 0) =3D=3D -1){
=09=09perror("send"); exit(1);
=09}
=09
=09for(;;)
=09{
=09=09if((nbytes =3D recv(sock, buf, sizeof (buf), 0)) > 0)
=09=09{
=09=09=09response.append(buf);
=09=09=09if (strstr(buf, "\r\nOK") !=3D NULL)
=09=09=09=09break;
=09=09=09if (strstr(buf, "\r\nERROR") !=3D NULL)
=09=09=09=09break;
=09=09}
=09}
=09return response;
}

results in:
AT+CBC
ERROR

Did I forget something that activates the extra commands?

Thanks in advance,
Dirk


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2005-07-19 15:06:56

by Luca Pizzamiglio

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available

Hi Dirk. I've tried your code on my system (bt dongle with i-mate SP3
phone), but my phone close the connection during receive.
I'm subsantially sure that the channel is right. When I try DUN channel
I obtain ERROR response, but when I use HF profile, the phone close the
connection. I obtain the same behaviour with HS channel.

Someone could help me to solve this problem?

thx in advance.

Cheers,
Pizza

Dirk Vanden Boer wrote:
> I believe DUN is channel 1, to be sure I tried every channel, nothing
> seems to work
>
> Dirk
>
> On 7/16/05, Peter Wippich <[email protected]> wrote:
>
>>Try DUN. But maybe the CBC command is only available on the physical port.
>>
>>Ciao,
>>
>>Peter
>>
>>
>>On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:
>>
>>
>>>Thanks for pointing me to that. I was connecting to channel 4 (heaset
>>>service) which was wrong, I think I should be connecting to the serial
>>>port service (channel 1). But the CBC command is still not available.
>>>In fact the available commands listed with AT* are the same for
>>>channel 1 and 4.
>>>
>>>Dirk
>>>
>>>
>>>On 7/16/05, Peter Wippich <[email protected]> wrote:
>>>
>>>>Hi Dirk,
>>>>
>>>>which service you are connecting to ??? If you connect to the wrong
>>>>service (channel) the phone may (shall !) only make available the AT
>>>>commands belonging to this service.
>>>>
>>>>Ciao,
>>>>
>>>>Peter
>>>>
>>>>
>>>>On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:
>>>>
>>>>
>>>>>On 7/16/05, Fred Schaettgen <[email protected]> wrote:
>>>>>
>>>>>>On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
>>>>>>
>>>>>>>Hi,
>>>>>>>I'm trying to send AT commands to my mobile phone using an rfcomm
>>>>>>>connection. The connection seems to work because I can exectute some
>>>>>>>commands (like manufacturer name). But a whole bunch of commands are
>>>>>>>not available (eg. battery charge: "AT+CBC\r" returns ERROR). I can
>>>>>>>run the AT* command which lists the available commands but a lot of
>>>>>>>common commands are not in the list. Could it be that there is
>>>>>>>something wrong with my connection?
>>>>>>
>>>>>>Are you sure that this command should be supported at all? If you are
>>>>>>connecting to the handsfree service, then the phone probably does not have to
>>>>>>support it. At least I can't find +CBC in the handsfree spec. Phones are free
>>>>>>to support additional commands though, or at least they do support more in
>>>>>>practice. It works with a Nokia 6230 for instance, without any special
>>>>>>initialization.
>>>>>>
>>>>>>Fred
>>>>>
>>>>>The CBC command is listed in the developers guidelines document of the
>>>>>ericsson t68 phone, so I guess it should be available.
>>>>>
>>>>>Dirk

-------------------------------------------
Luca Pizzamiglio
CEFRIEL - Embedded Systems Design Unit
Via Fucini, 2 - 20133 MILANO (ITALY)
Phone: +39 02 23954 343
e-mail: [email protected]
ICQ: 5046978
-------------------------------------------


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-07-16 19:13:04

by Dirk Vanden Boer

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available

I believe DUN is channel 1, to be sure I tried every channel, nothing
seems to work

Dirk

On 7/16/05, Peter Wippich <[email protected]> wrote:
>=20
> Try DUN. But maybe the CBC command is only available on the physical port=
.
>=20
> Ciao,
>=20
> Peter
>=20
>=20
> On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:
>=20
> > Thanks for pointing me to that. I was connecting to channel 4 (heaset
> > service) which was wrong, I think I should be connecting to the serial
> > port service (channel 1). But the CBC command is still not available.
> > In fact the available commands listed with AT* are the same for
> > channel 1 and 4.
> >
> > Dirk
> >
> >
> > On 7/16/05, Peter Wippich <[email protected]> wrote:
> > >
> > > Hi Dirk,
> > >
> > > which service you are connecting to ??? If you connect to the wrong
> > > service (channel) the phone may (shall !) only make available the AT
> > > commands belonging to this service.
> > >
> > > Ciao,
> > >
> > > Peter
> > >
> > >
> > > On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:
> > >
> > > > On 7/16/05, Fred Schaettgen <[email protected]> wrote:
> > > > > On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
> > > > > > Hi,
> > > > > > I'm trying to send AT commands to my mobile phone using an rfco=
mm
> > > > > > connection. The connection seems to work because I can exectute=
some
> > > > > > commands (like manufacturer name). But a whole bunch of command=
s are
> > > > > > not available (eg. battery charge: "AT+CBC\r" returns ERROR). I=
can
> > > > > > run the AT* command which lists the available commands but a lo=
t of
> > > > > > common commands are not in the list. Could it be that there is
> > > > > > something wrong with my connection?
> > > > >
> > > > > Are you sure that this command should be supported at all? If you=
are
> > > > > connecting to the handsfree service, then the phone probably does=
not have to
> > > > > support it. At least I can't find +CBC in the handsfree spec. Pho=
nes are free
> > > > > to support additional commands though, or at least they do suppor=
t more in
> > > > > practice. It works with a Nokia 6230 for instance, without any sp=
ecial
> > > > > initialization.
> > > > >
> > > > > Fred
> > > >
> > > > The CBC command is listed in the developers guidelines document of =
the
> > > > ericsson t68 phone, so I guess it should be available.
> > > >
> > > > Dirk
> > > >
> > > >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> > from IBM. Find simple to follow Roadmaps, straightforward articles,
> > informative Webcasts and more! Get everything you need to get up to
> > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=CCk
> > _______________________________________________
> > Bluez-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-devel
> >
>=20
> | Peter Wippich Voice: +49 30 46776411 |
> | G&W Instruments GmbH fax: +49 30 46776419 |
> | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> | D-13355 Berlin / Germany |
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&opclick
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-07-16 18:24:45

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available


Try DUN. But maybe the CBC command is only available on the physical port.

Ciao,

Peter


On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:

> Thanks for pointing me to that. I was connecting to channel 4 (heaset
> service) which was wrong, I think I should be connecting to the serial
> port service (channel 1). But the CBC command is still not available.
> In fact the available commands listed with AT* are the same for
> channel 1 and 4.
>
> Dirk
>
>
> On 7/16/05, Peter Wippich <[email protected]> wrote:
> >
> > Hi Dirk,
> >
> > which service you are connecting to ??? If you connect to the wrong
> > service (channel) the phone may (shall !) only make available the AT
> > commands belonging to this service.
> >
> > Ciao,
> >
> > Peter
> >
> >
> > On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:
> >
> > > On 7/16/05, Fred Schaettgen <[email protected]> wrote:
> > > > On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
> > > > > Hi,
> > > > > I'm trying to send AT commands to my mobile phone using an rfco=
mm
> > > > > connection. The connection seems to work because I can exectute=
some
> > > > > commands (like manufacturer name). But a whole bunch of command=
s are
> > > > > not available (eg. battery charge: "AT+CBC\r" returns ERROR). I=
can
> > > > > run the AT* command which lists the available commands but a lo=
t of
> > > > > common commands are not in the list. Could it be that there is
> > > > > something wrong with my connection?
> > > >
> > > > Are you sure that this command should be supported at all? If you=
are
> > > > connecting to the handsfree service, then the phone probably does=
not have to
> > > > support it. At least I can't find +CBC in the handsfree spec. Pho=
nes are free
> > > > to support additional commands though, or at least they do suppor=
t more in
> > > > practice. It works with a Nokia 6230 for instance, without any sp=
ecial
> > > > initialization.
> > > >
> > > > Fred
> > >
> > > The CBC command is listed in the developers guidelines document of =
the
> > > ericsson t68 phone, so I guess it should be available.
> > >
> > > Dirk
> > >
> > >
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=CCk
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>

| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-07-16 18:06:47

by Dirk Vanden Boer

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available

Thanks for pointing me to that. I was connecting to channel 4 (heaset
service) which was wrong, I think I should be connecting to the serial
port service (channel 1). But the CBC command is still not available.
In fact the available commands listed with AT* are the same for
channel 1 and 4.

Dirk


On 7/16/05, Peter Wippich <[email protected]> wrote:
>=20
> Hi Dirk,
>=20
> which service you are connecting to ??? If you connect to the wrong
> service (channel) the phone may (shall !) only make available the AT
> commands belonging to this service.
>=20
> Ciao,
>=20
> Peter
>=20
>=20
> On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:
>=20
> > On 7/16/05, Fred Schaettgen <[email protected]> wrote:
> > > On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
> > > > Hi,
> > > > I'm trying to send AT commands to my mobile phone using an rfcomm
> > > > connection. The connection seems to work because I can exectute som=
e
> > > > commands (like manufacturer name). But a whole bunch of commands ar=
e
> > > > not available (eg. battery charge: "AT+CBC\r" returns ERROR). I can
> > > > run the AT* command which lists the available commands but a lot of
> > > > common commands are not in the list. Could it be that there is
> > > > something wrong with my connection?
> > >
> > > Are you sure that this command should be supported at all? If you are
> > > connecting to the handsfree service, then the phone probably does not=
have to
> > > support it. At least I can't find +CBC in the handsfree spec. Phones =
are free
> > > to support additional commands though, or at least they do support mo=
re in
> > > practice. It works with a Nokia 6230 for instance, without any specia=
l
> > > initialization.
> > >
> > > Fred
> >
> > The CBC command is listed in the developers guidelines document of the
> > ericsson t68 phone, so I guess it should be available.
> >
> > Dirk
> >
> >


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-07-16 17:35:59

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available


Hi Dirk,

which service you are connecting to ??? If you connect to the wrong
service (channel) the phone may (shall !) only make available the AT
commands belonging to this service.

Ciao,

Peter


On Sat, 16 Jul 2005, Dirk Vanden Boer wrote:

> On 7/16/05, Fred Schaettgen <[email protected]> wrote:
> > On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
> > > Hi,
> > > I'm trying to send AT commands to my mobile phone using an rfcomm
> > > connection. The connection seems to work because I can exectute som=
e
> > > commands (like manufacturer name). But a whole bunch of commands ar=
e
> > > not available (eg. battery charge: "AT+CBC\r" returns ERROR). I can
> > > run the AT* command which lists the available commands but a lot of
> > > common commands are not in the list. Could it be that there is
> > > something wrong with my connection?
> >
> > Are you sure that this command should be supported at all? If you are
> > connecting to the handsfree service, then the phone probably does not=
have to
> > support it. At least I can't find +CBC in the handsfree spec. Phones =
are free
> > to support additional commands though, or at least they do support mo=
re in
> > practice. It works with a Nokia 6230 for instance, without any specia=
l
> > initialization.
> >
> > Fred
>
> The CBC command is listed in the developers guidelines document of the
> ericsson t68 phone, so I guess it should be available.
>
> Dirk
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=CCk
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>

| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-07-16 17:26:06

by Dirk Vanden Boer

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available

On 7/16/05, Fred Schaettgen <[email protected]> wrote:
> On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
> > Hi,
> > I'm trying to send AT commands to my mobile phone using an rfcomm
> > connection. The connection seems to work because I can exectute some
> > commands (like manufacturer name). But a whole bunch of commands are
> > not available (eg. battery charge: "AT+CBC\r" returns ERROR). I can
> > run the AT* command which lists the available commands but a lot of
> > common commands are not in the list. Could it be that there is
> > something wrong with my connection?
>=20
> Are you sure that this command should be supported at all? If you are
> connecting to the handsfree service, then the phone probably does not hav=
e to
> support it. At least I can't find +CBC in the handsfree spec. Phones are =
free
> to support additional commands though, or at least they do support more i=
n
> practice. It works with a Nokia 6230 for instance, without any special
> initialization.
>=20
> Fred

The CBC command is listed in the developers guidelines document of the
ericsson t68 phone, so I guess it should be available.

Dirk


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-07-16 17:17:43

by Fred Schaettgen

[permalink] [raw]
Subject: Re: [Bluez-devel] At commands not available

On Saturday, 16. July 2005 18:32, Dirk Vanden Boer wrote:
> Hi,
> I'm trying to send AT commands to my mobile phone using an rfcomm
> connection. The connection seems to work because I can exectute some
> commands (like manufacturer name). But a whole bunch of commands are
> not available (eg. battery charge: "AT+CBC\r" returns ERROR). I can
> run the AT* command which lists the available commands but a lot of
> common commands are not in the list. Could it be that there is
> something wrong with my connection?

Are you sure that this command should be supported at all? If you are
connecting to the handsfree service, then the phone probably does not have to
support it. At least I can't find +CBC in the handsfree spec. Phones are free
to support additional commands though, or at least they do support more in
practice. It works with a Nokia 6230 for instance, without any special
initialization.

Fred

--
Fred Schaettgen
[email protected]


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel