Toshiba PDR-M4 Protocol Description Notes by Chris Douglass (cjd03246@pegasus.cc.ucf.edu) History: Created 1/8/2000 by Chris Douglass (cjd03246@pegasus.cc.ucf.edu) Modified 1/20/2000 by Chris Douglass ----- Notes ----- I used ComLite32 to sniff the com port on win98. It is available at http://www.rtcomm.com. The camera Camera generally uses 4-byte words to communicate. Least significant byte is transferred first. The camera usually echoes back the first 2 bytes of the command it is responding to. Many commands take a 4-byte argument. A question mark in the command name notes that I am not too sure about it's purpose. The camera's beacon is 0x88 0x8f. It sends this until it recieves the reset code. The first two bytes are the actual command, the second two bytes is the length of the command's argument; same with respone codes Actaul commands are in stars ------------------------------------- Commands (All commands listed in hex) ------------------------------------- Set Baud Rate: *31 05* 04 00, XX 00 00 00 where 04 00 is the argument length and XX 00 00 00 is the baud rate code: XX Baud Rate 01 9600 02 19200 03 38400 04 57600 05 115200 Expected response: 31 05 00 00 Comments: This is the first command sent to detect and initialize the camera. It is also used as a cancel command to stop a file transfer and to close communications at the end of a session. Get Directory info sync status: *10 00* 00 00 Expected responses: No change since last reset: 10 00 00 00 Directory info changed: 10 89 00 00 possibly more Get Folder List: *14 00* 00 00 Expected response: 14 00 AA AA, [XX XX 10 00, YY YY 10 00, ....] Where AA AA is the number of folders * 4 (actually the number of bytes in the reply) and XX XX and YY YY are the folder numbers. (AA AA)/4 folder numbers are sent. Presumably if AA AA is zero then there are no folder numbers to send. Get folder/file information: *15 00* 04 00, XX XX YY YY where XX XX is the folder number and YY YY is the file number. If YY YY is zero then a list of files in this filder is returned. Expected Response for file list (YY YY == 00 00): 15 00 AA AA, [XX XX 00 00, YY YY 00, ....] Where AA AA is the number of files * 4 (actually the number of bytes in the reply) and XX XX and YY YY are the file numbers. (AA AA)/4 file numbers are sent. If AA AA is zero then no folder numbers are sent. Expected Response for file information (YY YY is set to the file number): 15 00 14 00, "PDRM", "????", "JPG ", XX XX XX XX, YY YY YY YY 15 00 -- seems to mean "file exist, sending data" 14 00 -- length of reply (20 bytes) "PRDM" -- the camera's signature ont he filename? "????" -- This is the picture number in ASCII "JPG " -- Note the trailing space to fill 4 bytes -- Just a Format String, PNG someday? XX XX XX XX -- Timestamp YY YY YY YY -- File size Set output block size: *30 05* 04 00, 00 08 00 00 where 04 00 is the argument length and 00 08 is the buffer size Expected Response: 30 05 00 00 Comments: This is sent after the directory information has been retrieved. Then the directory info is retrieved again. Get file sync status?: *20 00* 00 00 Expected Responst: 20 CA 00 00 Comments: This is sent just after "Reset for File Transfer Mode?" I don't know what it does. Send data: *17 00* AA AA, XX XX YY YY, ZZ ZZ ZZ ZZ where AA AA is the number of bytes to send XX XX is the directory number. YY YY is the file number. ZZ ZZ ZZ ZZ is the offset into the file from which to start sending. Expected Response: 17 00 AA AA, (AA AA) bytes of data where AA AA is the number of bytes of data to follow Delete file: *43 05* 04 00, XX XX YY YY where 04 00 is the length of the argument XX XX is the directory number YY YY is the file number Expected Response: 43 05 00 00 ----------------- Transfer Sequence ----------------- Set Baud Rate Get Status if changed { get folder list for i=1 to (number of folders) { get file/folder info for folder i, file 00 00 for j=1 to (number of files in folder i) { get file/folder info for folder x, file j } end for j } end for i } end if changed Set output buffer size? Set baud rate Get file sync status? Get Status if changed { get folder list for i=1 to (number of folders) { get file/folder info for folder i, file 00 00 for j=1 to (number of files in folder i) { get file/folder info for folder x, file j } end for j } end for i } end if changed delete files Set baud rate drop DTR