[sane-devel] add support for ricoh aficio sp100su

viruxx dj_virus142 at hotmail.com
Fri Mar 10 22:48:21 UTC 2017

ok, lets resume all of this
i converted the python program in java, its more habitual to manipulate this
language for me
i combined every modes, color, grayscale and bw, all in 75ppp resolution
with 2 different size
*full plate a4+a little margin
*semi sized a5 manually resized in paintbrush scan
for the moment i really dont know how to interpret the 3 to 10 billions
bytes i receive

actual results of the program:
motor do the travel, light goes on yellow for bw and grayscale, and more
lightening blue light in color scan
it give datas, stop at the end in a4, stop at the middle in a5, and then,
return at idle position
results sent and received were compared succesfully with windows xp original

heres the work

public class maine {static boolean continuer=true;
 	private static DeviceHandle handle;   
 	static boolean grayscalePreview=true, colorPreview=false,
blackPreview=false, sizeA4 = false; //75 ppp quality

	public static void main(String[] args) {  
		send(new byte[]{3,9,1});   read(handle,1  );//start signal return 0x00
		send(new byte[]{3,13,11}); read(handle,11  );//start signal return 0x7E
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
			if(blackPreview || grayscalePreview)send(new
			if(colorPreview)    send(new
			send(new byte[]{3,11,8});  read(handle,8  );//confirmation return 0x00
0x0A 0xB4 0x0D 0xF4 0x09 0xB4 0x0D 
			if(blackPreview || grayscalePreview)send(new
byte[]{3,8,4,0,0,0,0,8,-119,0,1  }); 
			if(colorPreview)    send(new byte[]{3,8,4,0,0,0,0,24,-101,1,1  });
		if(!sizeA4){ //A5 semi height
			if(blackPreview )send(new
			if(grayscalePreview )send(new
			if(colorPreview)    send(new
			send(new byte[]{3,11,8});  read(handle,8  );//confirmation return 0x00
0x0A 0xCC 0x06 0xF4 0x09 0xCC 0x06 
			if(blackPreview)send(new byte[]{3,8,4,0,0,0,0,-24,68,0,1  });
			if(grayscalePreview)send(new byte[]{3,8,4,0,0,0,0,104,71,0,1  }); 
			if(colorPreview)    send(new byte[]{3,8,4,0,0,0,0,-24,(byte) 203,0,1  });
 		 int operation = 1;
			 ByteBuffer readed =null;
			 if(operation %32 !=0 ){ System.out.println(operation+" normal operation
number "+operation);
				 if(blackPreview || grayscalePreview)send(new byte[]{3,14,4,0,0,0,0,-6 
				 if(colorPreview ) send(new byte[]{3,14,4,0,0,0,0,-16  });
				 if(blackPreview || grayscalePreview)readed = read(handle,64000);
				 if(colorPreview  ) readed = read(handle,61440);
			 else{System.out.println("strange signal every 32 operation");
			 	if(blackPreview)send(new byte[]{3,14,4,0,0,0,0,-36 });
			 	if(grayscalePreview && sizeA4)send(new byte[]{3,14,4,0,0,0,0,-66  });
			 	if(grayscalePreview && !sizeA4)send(new byte[]{3,14,4,0,0,0,0,(byte)
190  });
			 	if(colorPreview) send(new byte[]{3,14,4,0,0,0,0,60  });
			 	if(blackPreview)readed = read(handle,56320);
			 	if(grayscalePreview)readed = read(handle,48640); 
			 	if(colorPreview) readed = read(handle,15360); 
			 //windows driver send a strange end signal when he know (i dunno how) 
			 //that the next buffer will not be full and be the last.  
			 //i didnt find in any usblib documentation how to get the _urb_header
with the 
			 //size of the next packet, i manually put the operation number
			 if( sizeA4 && grayscalePreview && operation==141){
				 if(sizeA4)send(new byte[]{3,14,4,0,0,0,0,70}); 
				 if(sizeA4)read(handle,17920  );
				 if(!sizeA4)send(new byte[]{3,14,4,0,0,0,0,(byte) 150}); 
				 if(!sizeA4)read(handle,38400  );
			 }//if the end signal is not sent in bw and grayscale mode, it will
continue to receive 
			 //full 0x00 64000 sized buffers during a 60s printer busy. In color
reading it goes on timeout, and motor return at idle position
			 if(sizeA4 && blackPreview && operation==140 || !sizeA4 && blackPreview
&& operation==70){
				 if(sizeA4)send(new byte[]{3,14,4,0,0,0,0,-56});
				 if(!sizeA4)send(new byte[]{3,14,4,0,0,0,0,(byte) 200});
				 read(handle,51200  ); //last packet not changed with the A5 size Oo
			 if(sizeA4 &&colorPreview && operation==448){//strange thing here, if i
stop at >449, motor go back at idle position, 
				 send(new byte[]{3,14,4,0,0,0,0,120});//printer is ready but script goes
on timeout at line "readed = read(handle,61440);"
				 read(handle,30720  ); //if i stop it at <449 i achieve the end signal
reception, motor goes at idle position, but the
				 continuer=false; //printer stay busy 60s in "pc scanning"
			 if(!sizeA4 &&colorPreview && operation==219)
				 continuer=false;//i had no end signal in this semi sized A5 color scan,
last buffer = 61440 too
			 //b.put( readed);
		send(new byte[]{3,9,1}); read(handle,1  ); //end signal, return 0x00
		LibUsb.releaseInterface(handle, 0);

View this message in context: http://sane.10972.n7.nabble.com/add-support-for-ricoh-aficio-sp100su-tp20705p20715.html
Sent from the SANE - Dev mailing list archive at Nabble.com.

More information about the sane-devel mailing list