[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [bluetooth-dev] 0A=0D ..may be ttyBT problem..!



You should probably use ~ICRNL rather than ~ICANON to
get the effect you want. However, this will probably
not be enough (e.g., you will need to use ~IXON to
not get problems with 0x11 and 0x13).

It is probably better to use cfmakeraw() to make sure 
the terminal is in raw mode. You would get something 
like the following:

	if (tcgetattr(fid, &term) < 0)
	{
		fprintf(stderr, "tcgetattr failed.\n");
		exit(1);
	}

	if (cfmakeraw(&term) < 0)
	{
		fprintf(stderr, "cfmakeraw failed.\n");
		exit(1);
	}

	if (tcsetattr(fid, TCSADRAIN, &term) < 0)
	{
		fprintf(stderr, "tcsetattr failed.\n");
		exit(1);
	}

//Peter

> -----Original Message-----
> From: owner-bluetooth-dev On Behalf Of axis
> Sent: 02 February 2004 10:51
> To: Bluetooth-dev
> Subject: [bluetooth-dev] 0A=0D ..may be ttyBT problem..!
> 
> 
> Sir,
>      We have a very strange problem with the axis
> point where the byte 0D which is recieved from a
> bluetooth connection is transformed into 0A in axis
> point.Could this be because of the termios settings ?
> What should be the tty mode inorder to recieve the
> byte as it is ??
> Iam sure the data is correctly sent by the device.If
> the length of data is 13 bytes(0D) it is printed as 10
> bytes(0A) and only 10 bytes are read..
>      I tried something as follows setting ttyBT to raw
> mode,but the problem exists..Could you please tell me
> the solution for this problem...
> Thank you.
>         if (ioctl(fid, TCGETA, &old_term) == -1)
>         {
>                 printf("ioctl get failed.\n");
>                 exit(1);
>         }
> 
>         new_term = old_term;
>         new_term.c_lflag &= ~ICANON;
> 
> 
>         if (ioctl(fid, TCSETA, &new_term) == -1)
>         {
>                 printf("ioctl set failed.\n");
>                 exit(1);
>         }

-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com