Skip to contentSkip to conversation

Mysterious problem with l2test on Coldfire 5282

Bluez-users Jeff Sutherland 2 participants 5 messages Feb 17, 2004 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Using the l2test program on Motorola 5282 (uClinux) I have a strange behaviour when using l2test -s from the Moto board. Using the -d (dump) mode to receive packets from a PC running l2test I see what appears to be the packet sequence number in the first 4 bytes of data (little endian), followed by a 2 byte packet length, then data payload. When dumping data from the PC the packet sequence number increments by 1 each time, which, I believe, is the expected behaviour. However, when sending from the Moto board to the PC, the packet sequence number increments by 4 each time. ????? L2test send looks ok, the sequence number is just seq++; so something must be going on in hcid, right? Or maybe it's dropping 3 out of 4 send packets for some reason. Maybe something cocked up with the socket ops in l2test? ????? Debugging pointers, please...

-Jeff

Signature · 15 lines
Secure your email with Gnu Privacy Guard and Mozilla, the open source
cross platform solution for Windows, Linux, and Mac OS X.
See http://enigmail.mozdev.org/



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users
maintainer
#1 lore raw

Hi Jeff,

Quoted 4 lines

Using the l2test program on Motorola 5282 (uClinux) I have a strange behaviour when using l2test -s from the Moto board. Using the -d (dump) mode to receive packets from a PC running l2test I see what appears to be the packet sequence number in the first 4 bytes of data (little endian), followed by a 2

Quoted 8 lines

byte packet length, then data payload. When dumping data from the PC the packet sequence number increments by 1 each time, which, I believe, is the expected behaviour. However, when sending from the Moto board to the PC, the packet sequence number increments by 4 each time. ????? L2test send looks ok, the sequence number is just seq++; so something must be going on in hcid, right? Or maybe it's dropping 3 out of 4 send packets for some reason. Maybe something cocked up with the socket ops in l2test? ????? Debugging pointers, please...

maybe this code in send_mode() is the problem

	*(uint32_t *) buf = htobl(seq++);
	*(uint16_t *)(buf+4) = htobs(data_size);

Replace it with

	*(uint32_t *) buf = htobl(seq);
	*(uint16_t *)(buf+4) = htobs(data_size);
	seq++;

I am not a uClinux or compiler expert, so this is only guess.

Regards

Marcel

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-users mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#2 lore raw
Quoted 20 lines · Marcel Holtmann

Hi Jeff,

Quoted 4 lines

Using the l2test program on Motorola 5282 (uClinux) I have a strange behaviour when using l2test -s from the Moto board. Using the -d (dump) mode to receive packets from a PC running l2test I see what appears to be the packet sequence number in the first 4 bytes of data (little endian),

Quoted 8 lines

followed by a 2 byte packet length, then data payload. When dumping data from the PC the packet sequence number increments by 1 each time, which, I believe, is the expected behaviour. However, when sending from the Moto board to the PC, the packet sequence number increments by 4 each time. ????? L2test send looks ok, the sequence number is just seq++; so something must be going on in hcid, right? Or maybe it's dropping 3 out of 4 send packets for some reason. Maybe something cocked up with the socket ops in l2test? ????? Debugging pointers, please...

maybe this code in send_mode() is the problem

	*(uint32_t *) buf = htobl(seq++);
	*(uint16_t *)(buf+4) = htobs(data_size);
Quoted 7 lines

Replace it with

	*(uint32_t *) buf = htobl(seq);
	*(uint16_t *)(buf+4) = htobs(data_size);
	seq++;

I am not a uClinux or compiler expert, so this is only guess.

Oh, Doh! I'm sure this is it (haven't tried it yet, though) because of the way the byteswap_32() macro expands! No fair doing increment/decrement ops on variables inside macros :-)

-Jeff

Signature · 3 lines
Secure your email with Gnu Privacy Guard and Mozilla, the open source
cross platform solution for Windows, Linux, and Mac OS X.
See http://enigmail.mozdev.org/
maintainer
#3 lore raw

Hi Jeff,

Quoted 11 lines
Quoted 11 lines

maybe this code in send_mode() is the problem

	*(uint32_t *) buf = htobl(seq++);
	*(uint16_t *)(buf+4) = htobs(data_size);

Replace it with

	*(uint32_t *) buf = htobl(seq);
	*(uint16_t *)(buf+4) = htobs(data_size);
	seq++;
Quoted 5 lines
Quoted 1 line

I am not a uClinux or compiler expert, so this is only guess.

Oh, Doh! I'm sure this is it (haven't tried it yet, though) because of the way the byteswap_32() macro expands! No fair doing increment/decrement ops on variables inside macros :-)

I applied the fix for l2test, rctest and scotest. Should be in CVS now.

Regards

Marcel

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-users mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

#4 lore raw
Quoted 13 lines · Marcel Holtmann

Hi Jeff,

Quoted 11 lines
Quoted 11 lines

maybe this code in send_mode() is the problem

	*(uint32_t *) buf = htobl(seq++);
	*(uint16_t *)(buf+4) = htobs(data_size);

Replace it with

	*(uint32_t *) buf = htobl(seq);
	*(uint16_t *)(buf+4) = htobs(data_size);
	seq++;
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I am not a uClinux or compiler expert, so this is only guess.

Oh, Doh! I'm sure this is it (haven't tried it yet, though) because of the way the byteswap_32() macro expands! No fair doing increment/decrement ops on variables inside macros :-)

I applied the fix for l2test, rctest and scotest. Should be in CVS now.

I confirmed that this fixed the problem. I think that this was maybe the last of my major issues, thanks for all the help. rfcomm seems to work, now I just need to make use of the connection. Due to limited resources on my Coldfire board I'll probably just use ppp to establish a tcp/ip connection.

Regards,
-Jeff

Signature · 3 lines
Secure your email with Gnu Privacy Guard and Mozilla, the open source
cross platform solution for Windows, Linux, and Mac OS X.
See http://enigmail.mozdev.org/