Import fix in USB protocol.
commit95d62add1b648806dd705ef816d9fc04224fd6b3
authorNicolas VIVIEN <nicolas@vivien.fr>
Sun, 29 Mar 2009 11:47:36 +0000 (29 13:47 +0200)
committerChris Frey <cdfrey@foursquare.net>
Fri, 3 Apr 2009 18:21:21 +0000 (3 14:21 -0400)
treefc831afb6aa091d302ed21e580f3edc25b9f7897
parentd26393ef1f6203f753428b621ebe04687f24c79f
Import fix in USB protocol.

When you wish ADD or SET a record in a BlackBerry database, you need to
send packet :
  void Socket::Packet(Data &send, Data &receive, int timeout)

The MAX size of packet is 0x400 (seems is 0x404 on the BlackBerry Storm,
but 0x400 works also).

So if, the packet size is higher than the MAX size, you have to fragment
your packet :
  if( send.GetSize() <= MAX_PACKET_SIZE )

While the last packet isn't sent, you haven't to sequence received packet.

Indeed, from the RIM's USB logs :
  >>> URB [size = 0x404 ; fragmented = 0x60]
    00000000: 07 00 04 04 60 03 41 57 00 00 9f ff ff ff ....
  <<< URB (read SetSequencePacket(false))
    00000000: 00 00 0c 00 13 07 01 00 13 00 00 00
  >>> URB [size = 0x404 ; fragmented = 0x60]
    00000000: 07 00 04 04 60 03 d1 6b 3c 51 73 3b 12 48 ....
  <<< URB (read SetSequencePacket(false))
    00000000: 00 00 0c 00 13 07 01 00 14 00 00 00
 [...]
  >>> URB [size = 0x2b ; not fragmented == data = 0x40]
    00000000: 07 00 2b 00 40 03 00 00 00 00 00 00 00 00 00 00
  <<< URB (read SetSequencePacket(true))
    00000000: 00 00 0c 00 13 07 01 00 16 00 00 00
  <<< URB
    00000000: 07 00 07 00 41 00 00
src/socket.cc