Sponsored Content
Top Forums Programming Serial file transfer protocol / checksums Post 302785741 by nidal on Tuesday 26th of March 2013 09:48:35 AM
Old 03-26-2013
CPU & Memory Serial file transfer protocol / checksums

Hello ppl,
I'm working on a windows program simulating an existing Unix program,
the program is a firmware downloader, it sends a binary firmware file through the serial port (rs232) to a Set-Top Box running under unix system too, as i'm a poor unix user and not a unix programmer i choosed the hardware way to see how the program sends the file, and i found the next :

(i analysed the communication in hexadecimal form - low level and i will write lines that i didn't understood as hexadecimal, and commas are not part of data)

1- the Unix PC sends a sort of password and awaits a specefic answer from the STB:
0x18,0x67,0x00,0x16,$,"the file name",$,00,86,9A,0C

2-the sending process starts :
a-the PC sends this line : 0x18,0x61,0x00,0x04,0x00,0x01,0xFD,0x22
b-this part is recursive and is the essential protocol's way to send the file:

I-The PC send this line of 12 bytes: 0x17,0xC0,0x1D,0xC3,0x18,0x64,0x04,0x04,0x00,0x00,0x00,0x00
where (what i understood): the first 4 bytes are some checksum, the second are a command (because they are repetitively tge same) and the third 4-bytes refer to the actual position of the file you will see by the next how it incriments.

II-The STB answers with line of 12 bytes : 0x18,0x72,0x00,0x04,0x00,0x00,0x00,0x00,0x45,0x30,0x44,0xB2
same thing, the first 4-bytes is a command (maybe) the second 4 are the loaded size (you will see the incrimentation) and the 3rd is a checksum,

III- The PC sends a block of 1024 bytes of the file
So i think that those 3 steps are : I- the pc send current position of file, II- the card responds with currently loaded size or asks for data and III- the PC sends a block of 1 kbyte data from the file

IV- The PC sends again a line of actual position 0x7F,0xEE,0xB7,0x24,0x18,0x64,0x04,0x04,0x00,0x00,0x04,0x00

V- the STB responds with 0x18, 0x72 ,0x00 ,0x04 ,0x00 ,0x00 ,0x04 ,0x00 ,0x21 ,0x5C ,0x81 ,0xB6

VI- The PC sends the second 1 kb of data

and so on till the file transmission is finished,

why i think that its a checksum? : because i tried the process with 2 different firmwares, if i repeat the operation for the same firmware many times, i find the same commands/headers/checksums in the communication,
and if i change to other firmware i find different checksums, only the incremented blocks are the same.

samples of PC commands (step I- or IV-)
Code:
		s0[12]={0x17,0xC0,0x1D,0xC3,0x18,0x64,0x04,0x04,0x00,0x00,0x00,0x00},
		s1[12]={0x7F,0xEE,0xB7,0x24,0x18,0x64,0x04,0x04,0x00,0x00,0x04,0x00},
		s2[12]={0xBB,0xFF,0xED,0xF0,0x18,0x64,0x04,0x04,0x00,0x00,0x08,0x00},
		s3[12]={0xB3,0x10,0x2C,0x9B,0x18,0x64,0x04,0x04,0x00,0x00,0x0C,0x00},
		s4[12]={0x60,0xD1,0xF3,0xE7,0x18,0x64,0x04,0x04,0x00,0x00,0x10,0x00},
		s5[12]={0x01,0x72,0x41,0x18,0x18,0x64,0x04,0x04,0x00,0x00,0x14,0x00},...

samples of STB commands:
Code:
		t0[12]={0x18, 0x72, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x45, 0x30, 0x44, 0xB2},
		t1[12]={0x18, 0x72 ,0x00 ,0x04 ,0x00 ,0x00 ,0x04 ,0x00 ,0x21 ,0x5C ,0x81 ,0xB6},
		t2[12]={0x18 ,0x72 ,0x00 ,0x04 ,0x00 ,0x00 ,0x08 ,0x00 ,0x8D ,0xE9 ,0xCE ,0xBA};...

PROBLEM :
I tried sending the file with a windows application that i'm developing as the original application do, i failed: Login is ok, sending the first kbyte with loaded size response from the STB ok, second kbyte : i dont get the right answer which is "t2" array, i get continuously the "t1" array so sending failed,
I also tried to letterally send the packets sent by the unix application as they are, that i got by spying hardware, and i failed too, i tried also to insert some time breaks between sending a 1 kb bloc and receiving the answer, also not sending the second bloc unless i get the answer of first one received...
I tried many possibilities but i failed,
So what i ask you to, if some one knows this protocole tell me maybe there is such a protocol used to communicate between devices using rs232 in unix so i understand how it works
As you can see, i'm analysing this program in low level, i don't know if there is a way to analyse it in high level or if already those headers/commands seems to be familiar to you please let me know
Any information could do too much for me, thanks.

Last edited by jim mcnamara; 03-30-2013 at 09:51 AM..
 

9 More Discussions You Might Find Interesting

1. Programming

File transfer using Zmodem protocol

can anybody guide me how do i initiate file transfer over modem using zmodem protocol... (0 Replies)
Discussion started by: borntorock
0 Replies

2. SCO

Serial File Transfer

I need to transfer files from a sco/unix system to a windows xp system and they are only connected via a digiboard serial connection. The terminal emulation software connects and runs a program but I need to transfer files. Anyone know a good solution? (2 Replies)
Discussion started by: chansen
2 Replies

3. Programming

how i can transfer and receive file in any format over serial port

helo i m using fedora core 6 o.s. i want to develop application using c,c++ which transfer file in any format(like pdf,txt,doc etc) over the serial port and i want to receive the same file from the serial port please guide me. amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

4. Shell Programming and Scripting

Secure File Transfer Protocol

Hi, Is there any protocol other than SFTP to transfer the file using secured connection SSH. ? Regards, Arthik (2 Replies)
Discussion started by: arthikbabu
2 Replies

5. HP-UX

SFTP Protocol: How to transfer the file in PC Format

Hi, We are facing issue with files transfered using SFTP in Hp-UX. The transfered files are in Unix Format. That is, file format as UNIX (LF) instead of a PC format (CR & LF). How can we achieve file transfers as PC format using SFTP? Your help and input will be highly appreciated. ... (2 Replies)
Discussion started by: brap45
2 Replies

6. UNIX for Dummies Questions & Answers

How do i transfer file using ftp protocol in Linux.

Hi , I want to transfer file using ftp protocol . I m using following linux distribution. LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: OracleVMserver Description: Oracle VM server release 2.2.0 Release: 2.2.0 Codename: ... (5 Replies)
Discussion started by: pinga123
5 Replies

7. SCO

Need some advice concerning file transfer with a serial connection

Hi, I have a SCO Unix ver 5.0.7 from which I need to get some files. The problem is that I'm working remotely (have no physical access) and using Dejawin because this server is only has a serial connection to a Windows machine. Ucopy isn't on the server. What I was thinking is to do a print... (5 Replies)
Discussion started by: spartanboy184
5 Replies

8. Solaris

Transfer files from windows to solaris with winscp (file protocol:SFTP)

Hello, I have a couple of zip files to be copied from my local drive to a folder in solaris10 residing in a VM ware. i am using WINSCP, I tried to get hold of the solaris hostname or ip using ifconfig -a , hostname|nslookup etc. when i create a new session in WINSCP using that IP and port... (6 Replies)
Discussion started by: herbich1985
6 Replies

9. Shell Programming and Scripting

file transfer using AWK over serial port

I have a unix system that only has AWK to program with which hooks up to a windows or linux based system with all progamming and software capabilities. The link between the systems is typically a 9600 baud TTY port on the AWK system and COM1 on the other system. I can cat <filenm> from the unix... (4 Replies)
Discussion started by: bobfrog
4 Replies
All times are GMT -4. The time now is 03:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy