Skip to contentSkip to conversation

l2cap xfer fails

Bluez-devel Mauro Tortonesi 2 participants 5 messages Jan 28, 2004 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

i've been testing bluetooth support for nc6. unfortunately, i couldn't=20 transfer data. both kernels are 2.4.25-pre7.

1st test - client side:

[mauro@daneel nc6]$ ./src/nc6 -b 00:0D:88:8E:CA:07 10 erneuwenoun
ervimn=F2orinw=F2trin=F2ri rtbon=F2reonb=F2obre=F2eorinrt weinbrt=F2oint=F2io1re trbon=F2beone=F2otrn=F2rtietr rin=F2eroinrt=F2inr=F2int
rbn=F2on=F2rtibit rinr=F2tboinrt=F2inrirbtmrkimfr rebmrtmre=F2ireireo=F2

1st test - server side:

[mauro@giskard nc6]$ ./src/nc6 -vvv -b -l -p 10 > dump.bin
nc6: listening on (null) psm 10 ...
nc6: connect to (null) psm 10 from 00:0D:88:8E:CA:07 psm 10
nc6: using seqpacket socket
nc6: using buffer size of 8192
nc6: read eof from remote
nc6: closed local for write
nc6: remote hold timed out
nc6: closed local for read
nc6: closed remote for write
nc6: connection closed (sent 0, rcvd 182)

2nd test - client side:

[mauro@daneel nc6]$ cat src/main.c | ./src/nc6 -vvv -b 00:0D:88:8E:CA:07 10
nc6: using buffer size of 8192
nc6: error writing to remote: Invalid argument
nc6: connessione terminata (inviati 0, ricevuti 0)
nc6: closed local
nc6: closed remote

2nd test - server side:

[mauro@giskard nc6]$ ./src/nc6 -vvv -b -l -p 10 > dump.bin
nc6: listening on (null) psm 10 ...
nc6: connect to (null) psm 10 from 00:0D:88:8E:CA:07 psm 10
nc6: using seqpacket socket
nc6: using buffer size of 8192
nc6: read eof from remote
nc6: closed local for write
nc6: remote hold timed out
nc6: closed local for read
nc6: closed remote for write
nc6: connection closed (sent 0, rcvd 0)

=2D-=20
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi [email protected]
[email protected] [email protected]
Deep Space 6 - IPv6 with Linux http://www.deepspace6.net
=46errara Linux User Group http://www.ferrara.linux.it

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw
Quoted 2 lines · Mauro Tortonesi

i've been testing bluetooth support for nc6. unfortunately, i couldn't transfer data. both kernels are 2.4.25-pre7.

sorry, my kmail client sucks. it keeps crashing and sending unfinished emai= ls=20
instead of postponining them. good old pine was not so bad :-(

what i wanted to say is that i can transfer (over L2CAP) data from console,= =20
but transfer of files redirected to stdin always fails. perhaps i am doing= =20
something wrong? such as calling write(2) over L2CAP sockets with buffers=20 larger that 762 bytes?

Quoted 28 lines

1st test - client side:

[mauro@daneel nc6]$ ./src/nc6 -b 00:0D:88:8E:CA:07 10 erneuwenoun
ervimn=F2orinw=F2trin=F2ri rtbon=F2reonb=F2obre=F2eorinrt weinbrt=F2oint=F2io1re trbon=F2beone=F2otrn=F2rtietr rin=F2eroinrt=F2inr=F2int
rbn=F2on=F2rtibit rinr=F2tboinrt=F2inrirbtmrkimfr rebmrtmre=F2ireireo=F2

1st test - server side:

[mauro@giskard nc6]$ ./src/nc6 -vvv -b -l -p 10 > dump.bin
nc6: listening on (null) psm 10 ...
nc6: connect to (null) psm 10 from 00:0D:88:8E:CA:07 psm 10
nc6: using seqpacket socket
nc6: using buffer size of 8192
nc6: read eof from remote
nc6: closed local for write
nc6: remote hold timed out
nc6: closed local for read
nc6: closed remote for write
nc6: connection closed (sent 0, rcvd 182)

Quoted 3 lines

2nd test - client side:

[mauro@daneel nc6]$ cat src/main.c | ./src/nc6 -vvv -b 00:0D:88:8E:CA:07 =

10

Quoted 8 lines

nc6: using buffer size of 8192
nc6: error writing to remote: Invalid argument
nc6: connessione terminata (inviati 0, ricevuti 0)
nc6: closed local
nc6: closed remote

2nd test - server side:

Quoted 11 lines

[mauro@giskard nc6]$ ./src/nc6 -vvv -b -l -p 10 > dump.bin
nc6: listening on (null) psm 10 ...
nc6: connect to (null) psm 10 from 00:0D:88:8E:CA:07 psm 10
nc6: using seqpacket socket
nc6: using buffer size of 8192
nc6: read eof from remote
nc6: closed local for write
nc6: remote hold timed out
nc6: closed local for read
nc6: closed remote for write
nc6: connection closed (sent 0, rcvd 0)

=2D-=20
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi [email protected]
[email protected] [email protected]
Deep Space 6 - IPv6 with Linux http://www.deepspace6.net
=46errara Linux User Group http://www.ferrara.linux.it

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw
Quoted 11 lines · Mauro Tortonesi
Quoted 2 lines · Mauro Tortonesi

i've been testing bluetooth support for nc6. unfortunately, i couldn't transfer data. both kernels are 2.4.25-pre7.

sorry, my kmail client sucks. it keeps crashing and sending unfinished emails instead of postponining them. good old pine was not so bad :-(

what i wanted to say is that i can transfer (over L2CAP) data from console, but transfer of files redirected to stdin always fails. perhaps i am doing something wrong? such as calling write(2) over L2CAP sockets with buffers larger that 762 bytes?

s/762/672/

ok, it seems that the problem was really that the size of the buffers i was passing to write(2) is too big. with this code:

#define IMTU 672

static ssize_t btwrite(int fd, const char *buf, size_t count)

{
        ssize_t res, pos = 0;

        while (count > pos) {
                res = send(fd, buf + pos, MIN(IMTU, count - pos), 0);
                switch (res) {
                case -1:
                        if (errno == EINTR || errno == EAGAIN)
                        continue;
                case 0:
                        return (res);
                default:
                        pos += res;
                }
        }
        return (pos);
}

i can finally use a write(2)-compatible api for writing on L2CAP sockets.

Signature · 21 lines
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi                 [email protected]
                                [email protected]
                                [email protected]
Deep Space 6 - IPv6 with Linux  http://www.deepspace6.net
Ferrara Linux User Group        http://www.ferrara.linux.it





-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
maintainer
#3 lore raw
In reply to Mauro Tortonesi

Hi Mauro,

Quoted 4 lines

what i wanted to say is that i can transfer (over L2CAP) data from console, but transfer of files redirected to stdin always fails. perhaps i am doing something wrong? such as calling write(2) over L2CAP sockets with buffers larger that 762 bytes?

I haven't checked the nc6 Bluetooth support so far, but the L2CAP is a SOCK_SEQPACKET and it has an in and an out MTU. The default MTU is 672 and this means if you send data with a larger buffer, the write() will fail.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw
Quoted 11 lines · Marcel Holtmann

Hi Mauro,

Quoted 4 lines

what i wanted to say is that i can transfer (over L2CAP) data from console, but transfer of files redirected to stdin always fails. perhaps i am doing something wrong? such as calling write(2) over L2CAP sockets with buffers larger that 762 bytes?

I haven't checked the nc6 Bluetooth support so far, but the L2CAP is a SOCK_SEQPACKET and it has an in and an out MTU. The default MTU is 672 and this means if you send data with a larger buffer, the write() will fail.

you're right. in fact:

nc6 --mtu=672 -b address -p psm

works perfectly.

Signature · 7 lines
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi                 [email protected]
                                [email protected]
                                [email protected]
Deep Space 6 - IPv6 with Linux  http://www.deepspace6.net
Ferrara Linux User Group        http://www.ferrara.linux.it