Closed lewebsimple closed 7 years ago
Well, it tried 5 times then gave up, at which point the "data" variable was undefined. It's strange that it won't even respond to the query when full. I haven't used my CS1502 in a long time and I don't even know where it is, so I will need your help debugging this.
Can you add a line just above line 220 ( "assert data[2:10] == self.serial, data[2:10].encode('hex')" ):
print >> sys.stderr, "count = %d, data = %r" % (count, data)
then run it again?
I've added the line above the assert data...
line and tried it with a working scanner. I got the following:
count = 0, data = '\x06\x02\x00\x02\x00\x00\x00\n\x97p\r\x03B-001382~\xe4T\xd1\r\x03B-001382\x82\xe4T\xd1\r\x03B-001382S\xb4T\xd1\r\x03P-1111-8e\x16\xd8\xd1\r\x03B-001152\x91\x16\xd8\xd1\x0e\x03P-1111-17\xa5\x16\xd8\xd1\x0e\x03P-1111-14\xad\x16\xd8\xd1\x0e\x03P-1111-11\xad\x16\xd8\xd1\x0b\x03F-ca1m\xc9\x16\xd8\xd1\x0b\x03F-ca2w\xcd\x16\xd8\xd1\r\x03B-001152\xd9\x16\xd8\xd1\r\x03B-001628\x92\x87X\xd1\x00*\xf1'
But when I tried on a 'broken / full' scanner, It simply doesn't print anything... I think this is because the exception occurs on the line above data = self.recv()
Okay, I'm making progress on this issue...
From the developer documentation of the CS1504 SDK:
The maximum length of any command message shall be 70 bytes while the maximum length of any response message shall be 6144 bytes (6 KB).
So I'm guessing the data on the reader is bigger than 6kb and the recv
function should read all available chunks before asserting the crc16.
Thanks for the fix and pull request!
I get the following error when trying to read from a cs1504 scanner that is full:
Do you have any idea what could be causing this?
Thanks for a great little module!