I thought I had sorted my problems out with "/|pagecount", but alas
ifhp is still not dealing with "PAGECOUNT = XXXXX" as apposed to the
normal "PAGECOUNT=XXXXX" or just "XXXXX" return values from my hpij2250.
pagecount is fine for hp4000, but chokes on hpij2250.
The evidence is in the HASH table values. Please see attachments for
more gory debug=4 details (abbreviated) and my first stab at patching
ifhp.c to accept " = " (I really didn't want to mess with Split_STR_OBJ,
ie. add another argument for triming whitespace around "=" to clean up
HASH table entries).
--
later,
Vincent Kujala (http://www.geog.ubc.ca/~kujala)
hp4000n
----------
ifhp 17:42:33.693 [13620] Read_status_timeout: timeout 0, blocking read result 29,
alarm timeout 0^M
ifhp 17:42:33.693 [13620] Read_status_timeout: timeout 0, result count 29^M
ifhp 17:42:33.693 [13620] Read_status_timeout: read count 29, '@PJL INFO PAGECOUNT^M^M
85910^M^M
^L'^M
ifhp 17:42:33.693 [13620] Put_inbuf_len: before buffer '', adding '@PJL INFO
PAGECOUNT^M^M
85910^M^M
^L', len 29^M
ifhp 17:42:33.693 [13620] Put_inbuf_len: buffer '@PJL INFO PAGECOUNT^M^M
85910^M^M
^L'^M
ifhp 17:42:33.693 [13620] Get_inbuf_str: found '@PJL INFO PAGECOUNT'^M
ifhp 17:42:33.693 [13620] Pr_status: start str '@PJL INFO PAGECOUNT', pjlvar '<NULL>',
infovar 0^M
ifhp 17:42:33.693 [13620] Pr_status: doing PJL status on '@PJL INFO PAGECOUNT'^M
ifhp 17:42:33.693 [13620] Pr_status: PJL var 'PAGECOUNT=', infovar 1^M
ifhp 17:42:33.693 [13620] Get_inbuf_str: found '85910'^M
ifhp 17:42:33.693 [13620] Pr_status: start str '85910', pjlvar 'PAGECOUNT=', infovar
1^M
ifhp 17:42:33.693 [13620] Pr_status: pjlvar 'PAGECOUNT=85910'^M
ifhp 17:42:33.693 [13620] Check_device_status: 'PAGECOUNT=85910'^M
ifhp 17:42:33.693 [13620] Check_device_status: key 'pagecount', value '85910'^M
ifhp 17:42:33.693 [13620] Get_inbuf_str: found ''^M
ifhp 17:42:33.693 [13620] Get_inbuf_str: final ''^M
ifhp 17:42:33.693 [13620] Current_pagecounter: write/read result 0^M
ifhp 17:42:33.694 [13620] Current_pagecounter - page wait Devstatus - OBJ_T_HASH len
10^M
ifhp 17:42:33.694 [13620] [0] HASH key 'code' - OBJ_T_STR '10001'^M
ifhp 17:42:33.694 [13620] [1] HASH key 'display' - OBJ_T_STR '":"'^M
ifhp 17:42:33.694 [13620] [2] HASH key 'echo' - OBJ_T_STR
'[EMAIL PROTECTED]'^M
ifhp 17:42:33.694 [13620] [3] HASH key 'id' - OBJ_T_STR '"LASERJET 4000"'^M
ifhp 17:42:33.694 [13620] [4] HASH key 'job' - OBJ_T_STR 'END'^M
ifhp 17:42:33.694 [13620] [5] HASH key 'name' - OBJ_T_STR '"17-42-14.102 PID
13620"'^M
ifhp 17:42:33.694 [13620] [6] HASH key 'online' - OBJ_T_STR 'TRUE'^M
ifhp 17:42:33.694 [13620] [7] HASH key 'page' - OBJ_T_STR '1'^M
ifhp 17:42:33.694 [13620] [8] HASH key 'pagecount' - OBJ_T_STR '85910'^M
ifhp 17:42:33.694 [13620] [9] HASH key 'pages' - OBJ_T_STR '0'^M
ifhp 17:42:33.694 [13620] Current_pagecounter: page 1, pagecounter 85910^M
ifhp 17:42:33.694 [13620] Do_pagecount: pagecounter 85910 after 1 attempts^M
hpij2250
-----------
ifhp 16:51:21.777 [13404] Read_status_timeout: timeout 0, blocking read result 40,
alarm timeout 0^M
ifhp 16:51:21.777 [13404] Read_status_timeout: timeout 0, result count 40^M
ifhp 16:51:21.777 [13404] Read_status_timeout: read count 40, '@PJL INFO PAGECOUNT^M^M
PAGECOUNT = 6522^M^M
^L'^M
ifhp 16:51:21.778 [13404] Put_inbuf_len: before buffer '', adding '@PJL INFO
PAGECOUNT^M^M
PAGECOUNT = 6522^M^M
^L', len 40^M
ifhp 16:51:21.778 [13404] Put_inbuf_len: buffer '@PJL INFO PAGECOUNT^M^M
PAGECOUNT = 6522^M^M
^L'^M
ifhp 16:51:21.778 [13404] Get_inbuf_str: found '@PJL INFO PAGECOUNT'^M
ifhp 16:51:21.778 [13404] Pr_status: start str '@PJL INFO PAGECOUNT', pjlvar '<NULL>',
infovar 0^M
ifhp 16:51:21.778 [13404] Pr_status: doing PJL status on '@PJL INFO PAGECOUNT'^M
ifhp 16:51:21.778 [13404] Pr_status: PJL var 'PAGECOUNT=', infovar 1^M
ifhp 16:51:21.778 [13404] Get_inbuf_str: found 'PAGECOUNT = 6522'^M
ifhp 16:51:21.778 [13404] Pr_status: start str 'PAGECOUNT = 6522', pjlvar
'PAGECOUNT=', infovar 1^M
ifhp 16:51:21.779 [13404] Check_device_status: 'PAGECOUNT = 6522'^M
ifhp 16:51:21.779 [13404] Check_device_status: key 'pagecount ', value ' 6522'^M
ifhp 16:51:21.779 [13404] Get_inbuf_str: found ''^M
ifhp 16:51:21.779 [13404] Get_inbuf_str: final ''^M
ifhp 16:51:21.779 [13404] Current_pagecounter: write/read result 0^M
ifhp 16:51:21.779 [13404] Current_pagecounter - page wait Devstatus - OBJ_T_HASH len
3^M
ifhp 16:51:21.779 [13404] [0] HASH key 'echo' - OBJ_T_STR
'[EMAIL PROTECTED]'^M
ifhp 16:51:21.779 [13404] [1] HASH key 'id ' - OBJ_T_STR ' HP BUSINESS INKJET 2250'^M
ifhp 16:51:21.779 [13404] [2] HASH key 'pagecount ' - OBJ_T_STR ' 6522'^M
ifhp 16:51:36.791 [13404] Read_status_timeout: timeout 0, blocking read result -1,
alarm timeout 0^M
ifhp 16:51:36.791 [13404] Read_status_timeout: timeout 0, result count -1^M
ifhp 16:51:36.791 [13404] Current_pagecounter: write/read result -1^M
ifhp 16:51:36.791 [13404] Current_pagecount: EOF reading status^M
ifhp 16:51:36.791 [13404] Current_pagecounter: page 0, pagecounter -1^M
ifhp 16:51:36.791 [13404] Do_pagecount: IO error getting pagecount^M
*** ifhp.c.orig Mon Jul 8 08:58:41 2002
--- ifhp.c Wed Sep 18 20:09:11 2002
***************
*** 3539,3547 ****
int pagecount_same = 1;
char *s;
! if( (s = GET_HASH_STR_OBJ( Devstatus, "pagecount", MEMINFO )) ){
! pagecounter = atoi( s );
! }
DEBUG1("Do_pagecount: pagecount at start %d", pagecounter );
if( use_prog ){
if( !pagecounter ){
--- 3539,3555 ----
int pagecount_same = 1;
char *s;
! if( (s = GET_HASH_STR_OBJ( Devstatus, "pagecount", MEMINFO )) ||
! (s = GET_HASH_STR_OBJ( Devstatus, "pagecount ", MEMINFO )) ){ /* try
this too */
!
! int i=0;
! while ((s+i) && !isdigit(cval(s+i))) { ++i; } /* locate first digit
*/
!
! if( (s+i) && isdigit(cval(s+i)) ){ /* skip leading white-space and
junk */
! pagecounter = atoi( s+i );
! }
! }
!
DEBUG1("Do_pagecount: pagecount at start %d", pagecounter );
if( use_prog ){
if( !pagecounter ){
***************
*** 3661,3669 ****
len = 0;
while(!page){
if(DEBUGL4)SHORT_DUMP_OBJ("Current_pagecounter - page wait
Devstatus",Devstatus);
! if( (s = GET_HASH_STR_OBJ( Devstatus, "pagecount", MEMINFO )) ){
! if( s && isdigit(cval(s)) ){
! pagecounter = atoi( s );
page = 1;
break;
}
--- 3669,3682 ----
len = 0;
while(!page){
if(DEBUGL4)SHORT_DUMP_OBJ("Current_pagecounter - page wait
Devstatus",Devstatus);
! if( (s = GET_HASH_STR_OBJ( Devstatus, "pagecount", MEMINFO )) ||
! (s = GET_HASH_STR_OBJ( Devstatus, "pagecount ", MEMINFO )) ){ /*
try this too */
!
! int i=0;
! while ((s+i) && !isdigit(cval(s+i))) { ++i; } /* locate
first digit */
!
! if( (s+i) && isdigit(cval(s+i)) ){ /* skip leading white-space
and junk */
! pagecounter = atoi( s+i );
page = 1;
break;
}