[sane-devel] about maxPacketSize

peter peter at mail.mustek-hz.com.cn
Thu Jun 14 06:29:05 UTC 2007

Hello Everyone, 

I was developing a new scanner with chip  SQ113C.  Many of that  was  complete, but it have an strange bug.
I was runing this driver on Mac OS 10.2 it write data ,read data are all ok. But when i move it to Mac OS10.4, it have very strange bug. when i plug the scanner to the usb port(which is usb keyboard plug beside),it was working good. but when i plug to the other 3 usb port(my apple all have 5 usb ports),it can not read data! so strange!

My Apple is Power PC G4 400Mhz. it's an old Power Pc. At last, I was likely to  found the answer. I use GetPipeProperties (the member of IOUSBInterfaceInterface),to get info of the BULK IN(maybe it was INTERRUPT) pipe,i found out that the different is maxPacketSize!! 
The working usb port is 64 ,and the bad usb port is 512 . In my code i  use ReadPipe() and WritePipe() with 64 bytes as an Packet.
like this: 

        kernResult = (*m_Interface)->WritePipe(m_Interface, BULK_OUT_ENDPOINT, lpbuf,length);

when i change the length with 512X is was working again.  but it doesn't what i need. change to 512X will change so many code!

so , my questing is why the usb port in OS10.2  maxPacketSize is 64,but  in OS 10.4 it change to 512 ?  and what does the maxPacketSize  mean??

The sane backend(like gt68xx)  was great, it working with all usb port,but the code is different with me(i don't want to change so many code.).  the develop resource of Mac  was so poor(some like  endpoint and pipes ,what is the relationshi of them? ), i can't find the what the problem was. 

any suggestiong will be appreciate . thanks.


More information about the sane-devel mailing list