[Hp5400backend-cvs-update] hp5400/hp5400 hp5400.c,1.15,1.16
Status: Alpha
Brought to you by:
soumarmt
|
From: <kl...@us...> - 2003-03-06 10:46:05
|
Update of /cvsroot/hp5400backend/hp5400/hp5400
In directory sc8-pr-cvs1:/tmp/cvs-serv10083
Modified Files:
hp5400.c
Log Message:
Fix the structure to reflect the fact that the xsize value in ScanResponse
is a 32 bit int rather than 16 bit. Why isn't the ysize 32 bit also? We
don't know.
All the htons's converted to htonl's where appropriate.
Index: hp5400.c
===================================================================
RCS file: /cvsroot/hp5400backend/hp5400/hp5400/hp5400.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** hp5400.c 6 Mar 2003 10:27:35 -0000 1.15
--- hp5400.c 6 Mar 2003 10:46:02 -0000 1.16
***************
*** 105,111 ****
uint16_t x1; /* Usually 0x0000 or 0x4000 */
uint32_t transfersize; /* Number of bytes to be transferred */
! uint16_t zero; /* Seems to be zero */
! uint16_t xsize, ysize; /* Shape of returned bitmap */
! uint16_t pad[2]; /* Zero padding to 16 bytes??? */
} __attribute__((packed));
--- 105,111 ----
uint16_t x1; /* Usually 0x0000 or 0x4000 */
uint32_t transfersize; /* Number of bytes to be transferred */
! uint32_t xsize; /* Shape of returned bitmap */
! uint16_t ysize; /* Why does the X get more bytes? */
! uint16_t pad[2]; /* Zero padding to 16 bytes??? */
} __attribute__((packed));
***************
*** 506,510 ****
DBG(DBG_MSG, "Scan response:\n");
DBG(DBG_MSG, " transfersize=%d htonl-> %d\n", resp->transfersize, htonl(resp->transfersize));
! DBG(DBG_MSG, " xsize=%d htons-> %d\n", resp->xsize, htons(resp->xsize));
DBG(DBG_MSG, " ysize=%d htons-> %d\n", resp->ysize, htons(resp->ysize));
return 1;
--- 506,510 ----
DBG(DBG_MSG, "Scan response:\n");
DBG(DBG_MSG, " transfersize=%d htonl-> %d\n", resp->transfersize, htonl(resp->transfersize));
! DBG(DBG_MSG, " xsize=%d htonl-> %d\n", resp->xsize, htonl(resp->xsize));
DBG(DBG_MSG, " ysize=%d htons-> %d\n", resp->ysize, htons(resp->ysize));
return 1;
***************
*** 531,535 ****
InitScan2( SCAN_TYPE_CALIBRATION, req, &HWParams, &res, 0, code ); /* No colour offseting, we want raw */
! length = htons(res.xsize) / 6;
DBG(DBG_MSG, "Calibration scan: %d pixels wide\n", length );
--- 531,535 ----
InitScan2( SCAN_TYPE_CALIBRATION, req, &HWParams, &res, 0, code ); /* No colour offseting, we want raw */
! length = htonl(res.xsize) / 6;
DBG(DBG_MSG, "Calibration scan: %d pixels wide\n", length );
***************
*** 541,545 ****
}
! buffer = malloc( htons(res.xsize) + 1 );
/* First we just sum them all */
--- 541,545 ----
}
! buffer = malloc( htonl(res.xsize) + 1 );
/* First we just sum them all */
***************
*** 589,601 ****
InitScan2( SCAN_TYPE_NORMAL, req, &HWParams, res, 1, 0x40 );
! fprintf( file, "P%d\n%d %d\n", 6, htons(res->xsize)/3, htons(res->ysize) );
fprintf( file, "%d\n", 255 );
! buffer = malloc( htons(res->xsize) + 1 );
for( i=0; i < htons(res->ysize); i++ )
{
CircBufferGetLine( iHandle, &HWParams.pipe, buffer );
! fwrite( buffer, htons(res->xsize), 1, file );
}
free( buffer );
--- 589,601 ----
InitScan2( SCAN_TYPE_NORMAL, req, &HWParams, res, 1, 0x40 );
! fprintf( file, "P%d\n%d %d\n", 6, htonl(res->xsize)/3, htons(res->ysize) );
fprintf( file, "%d\n", 255 );
! buffer = malloc( htonl(res->xsize) + 1 );
for( i=0; i < htons(res->ysize); i++ )
{
CircBufferGetLine( iHandle, &HWParams.pipe, buffer );
! fwrite( buffer, htonl(res->xsize), 1, file );
}
free( buffer );
***************
*** 780,784 ****
/* Pass the results back to the parent */
! params->iBytesPerLine = htons( res.xsize );
params->iLines = htons( res.ysize );
--- 780,784 ----
/* Pass the results back to the parent */
! params->iBytesPerLine = htonl( res.xsize );
params->iLines = htons( res.ysize );
***************
*** 886,890 ****
/* Pass the results back to the parent */
/* Hide the extra lines we're scanning */
! pParams->iBytesPerLine = htons( res.xsize );
pParams->iLines = htons( res.ysize ) - pParams->iColourOffset*2;
--- 886,890 ----
/* Pass the results back to the parent */
/* Hide the extra lines we're scanning */
! pParams->iBytesPerLine = htonl( res.xsize );
pParams->iLines = htons( res.ysize ) - pParams->iColourOffset*2;
***************
*** 1003,1007 ****
}
! DBG(DBG_MSG,"Bytes to transfer: %d\nBitmap resolution: %d x %d\n", htonl(res.transfersize), htons(res.xsize), htons(res.ysize) );
DBG(DBG_MSG,"Proceeding to scan\n");
--- 1003,1007 ----
}
! DBG(DBG_MSG,"Bytes to transfer: %d\nBitmap resolution: %d x %d\n", htonl(res.transfersize), htonl(res.xsize), htons(res.ysize) );
DBG(DBG_MSG,"Proceeding to scan\n");
***************
*** 1035,1039 ****
bpp = 2;
! CircBufferInit( pHWParams->iXferHandle, &pHWParams->pipe, htons(res.xsize), bpp, iColourOffset, 0xF000 );
}
--- 1035,1039 ----
bpp = 2;
! CircBufferInit( pHWParams->iXferHandle, &pHWParams->pipe, htonl(res.xsize), bpp, iColourOffset, 0xF000 );
}
|