Raw Serial socket disconnect with certain packets

Questions, FAQ, Feature Requests and Troubleshooting for Airconsole

Moderator: sergey

msabatini
Posts: 11
Joined: Sat Jun 21, 2014 2:13 am

Raw Serial socket disconnect with certain packets

Postby msabatini » Sat Jun 27, 2015 3:28 am

Hi,
I'm experiencing strange disconnections each time I use send 2 packets to my device through AirConsole in Raw Serial mode (no problems with all others). My fw is 2.65 (2015-06-02 build 650), hw version is A-01.

Can you see something strange in these bytes (such as something that is seen as special low level protocol disconnection bytes):

(0x ahead everything)
1)
7E 00 83 00 07 FF 00 7C 00 F1 10 00 E9 00 01 10
00 EA 00 01 10 00 EB 00 01 10 00 EC 00 01 10 00
ED 00 01 10 00 EE 00 01 10 00 EF 00 01 10 00 F0
00 01 10 00 F1 00 01 10 00 F2 00 01 10 00 F3 00
01 10 00 F4 00 01 10 00 F5 00 01 10 00 F6 00 01
10 00 F7 00 01 10 00 F8 00 01 10 00 F9 00 01 10
00 FA 00 01 10 00 FB 00 01 10 00 FC 00 01 10 00
FE 00 01 10 00 FF 00 01 10 01 00 00 01 10 01 01
00 01 CF 44 1A 93 7F

2)
7E 00 B1 00 07 FF 00 AA 00 F1 12 01 15 00 0F 02
10 01 16 00 01 10 01 17 00 01 10 01 18 00 01 10
01 19 00 01 10 01 1A 00 01 10 01 1B 00 01 10 01
1C 00 01 10 01 1D 00 01 10 01 1E 00 01 10 01 1F
00 01 10 01 20 00 01 10 01 21 00 01 10 01 22 00
01 10 01 23 00 01 10 01 24 00 01 10 01 25 00 01
10 01 26 00 01 10 01 27 00 01 10 01 28 00 01 10
01 29 00 01 10 01 2A 00 01 10 01 2B 00 01 10 01
2C 00 01 10 01 2D 00 01 10 01 2E 00 01 10 01 2F
00 01 10 01 31 00 01 10 01 3D 00 01 10 01 3E 00
01 10 01 3F 00 01 10 01 40 00 01 10 01 41 00 01
61 6C 0B 85 7F

As example, here is a packet that is working fine:
0x7E,0x00,0x10,0x00,0x07,0xFF,0x00,0x09,0x00,0xF1,0x10,0x00,0xAA,0x00,0x01,0xA0,0x41,0x03,0xAC,0x7F

Best Regards

daniel
Posts: 127
Joined: Wed Jul 27, 2011 9:33 am

Re: Raw Serial socket disconnect with certain packets

Postby daniel » Sat Jun 27, 2015 5:11 am

Hello - what is your test setup so we can try and replicate this? e.g. What client are you using (Get-Console on iOS, Bluetooth EDR on Windows, Websockets from Safari, etc)

msabatini
Posts: 11
Joined: Sat Jun 21, 2014 2:13 am

Re: Raw Serial socket disconnect with certain packets

Postby msabatini » Mon Jun 29, 2015 8:11 pm

Hi, thank you for your reply.
Actually we are using a test client built by ourselves with Qt framework. But before sending you a code section, I thought that I hadn't tried your demo clients in websocket-sdk yet, so I tried rawserial.html and saw that "Send" the issue packets actually makes the problem (disconnect), while "Send Binary" works fine. So I'm thinking that the data structures we are using in Qt are treating the bytes as chars or something similar. We are going to investigate by ourselves before keeping asking in this thread. As for now, thank you for your "enlightening" question :)

EDIT: Sorry, I checked "rawserial.html" code and I saw I modified it some months ago. It is identical to the original, except for a button I added, a "Send binary" button, and it triggers this function:

function doSendBin() {
//7E 00 0E 00 07 FF 00 07 00 00 01 00 21 CB 34 02 3C 7F
var s = new Uint8Array([0x7E,0x00,0x0E,0x00,0x07,0xFF,0x00,0x07,0x00,0x00,0x01,0x00,0x21,0xCB,0x34,0x02,0x3C,0x7F]);
websocket.send(s);
}

It was always sending the same demo packet, so despite what I was writing in the text box, it always worked fine, but has nothing to do with my "issue packet".

So I tried to change it to my problem data:
var s = new Uint8Array([0x7E,0x00,0x83,0x00,0x07,0xFF,0x00,0x7C,0x00,0xF1,0x10,0x00,0xE9,0x00,0x01,0x10,0x00,0xEA,0x00,0x01,0x10,0x00,0xEB,0x00,0x01,0x10,0x00,0xEC,0x00,0x01,0x10,0x00,0xED,0x00,0x01,0x10,0x00,0xEE,0x00,0x01,0x10,0x00,0xEF,0x00,0x01,0x10,0x00,0xF0,0x00,0x01,0x10,0x00,0xF1,0x00,0x01,0x10,0x00,0xF2,0x00,0x01,0x10,0x00,0xF3,0x00,0x01,0x10,0x00,0xF4,0x00,0x01,0x10,0x00,0xF5,0x00,0x01,0x10,0x00,0xF6,0x00,0x01,0x10,0x00,0xF7,0x00,0x01,0x10,0x00,0xF8,0x00,0x01,0x10,0x00,0xF9,0x00,0x01,0x10,0x00,0xFA,0x00,0x01,0x10,0x00,0xFB,0x00,0x01,0x10,0x00,0xFC,0x00,0x01,0x10,0x00,0xFE,0x00,0x01,0x10,0x00,0xFF,0x00,0x01,0x10,0x01,0x00,0x00,0x01,0x10,0x01,0x01,0x00,0x01,0xCF,0x44,0x1A,0x93,0x7F]);
and actually the airconsole disconnects. So it reproduces our issue, is it ok to have a common base to investigate?
Thank you very much for your help.

msabatini
Posts: 11
Joined: Sat Jun 21, 2014 2:13 am

Re: Raw Serial socket disconnect with certain packets

Postby msabatini » Wed Jul 01, 2015 3:41 am

Hi, just an update:
we kept investigating and probably we are "narrowing the circle". Trying to send our packets via your provided normal Airconsole USB-serial adapter to our PC-link interface, it doesn't fail. All is ok.
The problem occurs if we connect _directly_ our device via USB CDC connection (on device side) with an USB male-to-male cable inserted on Airconsole usb socket. This works ok for nearly all packets, except1) and 2) (we tried several hundreds of different packets).
We suppose that Airconsole fw has a USB to serial driver that is able to recognize our USB CDC device and send packets.
We made this test: our device is recognized by Windows (7, 64bit) with its driver (usb serial driver) and we send the issue packets through Docklight software: all is ok. So we came to this hypothesis: the Airconsole fw USB to serial driver may have a problem with the 1) and 2) packets for some byte sequence.
What do you think about?
Thank you for your help.

msabatini
Posts: 11
Joined: Sat Jun 21, 2014 2:13 am

Re: Raw Serial socket disconnect with certain packets

Postby msabatini » Thu Jul 02, 2015 1:48 am

Hi, another update:
we found that the reason why those 2 packets are giving disconnection problems and the other are going ok is their length > 128 bytes.
The problem is there only when the client is _sending_ packets to Airconsole, while there is no problem when the device sends more than 128 bytes to Airconsole through usb-serial (our tests had some answer packets of 246 bytes) and the client _receives_ them.
NB: when the javascript test client receives packets, sometimes it receives them split in 128bytes packets + remaining bytes, but Airconsole doesn't close the connection, sometimes it receives them _not_ split (246 bytes altogether, with no disconnection).

Is there, in your knowkledge, any 128 bytes tx buffer used by the usb-serial driver in the linux fw of Airconsole that could be related to the problem?
Please consider that this is important to us: our new software can use a workaround by splitting data, but old software that cannot be updated could have problems, and we are planning to use many Airconsoles: solving this problem could save us many headaches :)
Thank you very much,
Best regards
Marco

daniel
Posts: 127
Joined: Wed Jul 27, 2011 9:33 am

Re: Raw Serial socket disconnect with certain packets

Postby daniel » Fri Jul 03, 2015 1:21 am

Thanks for your update and detailed troubleshooting steps - we will see if we can replicate this in our lab, and if so, see if there is a possible fix.

daniel
Posts: 127
Joined: Wed Jul 27, 2011 9:33 am

Re: Raw Serial socket disconnect with certain packets

Postby daniel » Tue Jul 14, 2015 6:04 am

Hi - as an update to this, we have managed to replicate the issue in our lab. The issue does seem to be with large writes to ACM devices overflowing the buffer and causing disconnects.

We have implemented a fix in the development version of the Airconsole firmware.

Thanks for your help in tracking down this bug.


Return to “Airconsole”

Who is online

Users browsing this forum: No registered users and 30 guests