Fixed kernel module build for recent kernels

Defined internal "ULong" types to be in fact 32 bit wide,
this should fix issues on 64 bit machines.
merge-requests/1/head
Gerhard Jaeger 2013-02-13 14:29:52 +01:00
rodzic 59d9a2d912
commit ac564e89f6
15 zmienionych plików z 202 dodań i 113 usunięć

Wyświetl plik

@ -6,13 +6,14 @@
*
* original code taken from sane-0.71<br>
* Copyright (C) 1997 Hypercore Software Design, Ltd.<br>
* Copyright (C) 2001-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.01 - initial version
* - 0.43 - bumped up version to reflect the former module code version
* - removed Version from ScannerCaps
* - added _E_FAULT
* - 0.44 - fix UL issues, as Long types default to int32_t now
* .
* <hr>
* This file is part of the SANE package.
@ -190,8 +191,8 @@ typedef const struct mode_param
#define _TPAModeSupportDef COLOR_TRUE24
#define _TPAMinDpi 150
#define _NegativePageWidth 460UL /* 38.9 mm */
#define _NegativePageHeight 350UL /* 29.6 mm */
#define _NegativePageWidth 460U /* 38.9 mm */
#define _NegativePageHeight 350U /* 29.6 mm */
#define _DEF_DPI 50

Wyświetl plik

@ -3,7 +3,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -24,6 +24,8 @@
* - 0.41 - no changes
* - 0.42 - changed include names
* - 0.43 - cleanup
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -223,7 +225,7 @@ static int detectSetupBuffers( pScanData ps )
/*
* allocate and clear
*/
DBG(DBG_LOW,"Driverbuf(%lu bytes) needed !\n", ps->TotalBufferRequire);
DBG(DBG_LOW,"Driverbuf(%u bytes) needed !\n", ps->TotalBufferRequire);
ps->driverbuf = (pUChar)_VMALLOC(ps->TotalBufferRequire);
if ( NULL == ps->driverbuf ) {
@ -233,7 +235,7 @@ static int detectSetupBuffers( pScanData ps )
#else
DBG( DBG_HIGH,
#endif
"pt_drv: Not enough kernel memory %ld\n",
"pt_drv: Not enough kernel memory %d\n",
ps->TotalBufferRequire);
return _E_ALLOC; /* Out of memory */
}
@ -252,8 +254,8 @@ static int detectSetupBuffers( pScanData ps )
ps->pColorRunTable = ps->pScanBuffer1 + ps->BufferForDataRead1;
DBG( DBG_LOW, "pColorRunTab = 0x%0lx - 0x%0lx\n",
(ULong)ps->pColorRunTable,
(ULong)((pUChar)ps->driverbuf + ps->TotalBufferRequire));
(unsigned long)ps->pColorRunTable,
(unsigned long)((pUChar)ps->driverbuf + ps->TotalBufferRequire));
if ( _ASIC_IS_98001 == ps->sCaps.AsicID ) {
@ -264,10 +266,11 @@ static int detectSetupBuffers( pScanData ps )
ps->pColorRunTable = ps->pScanBuffer1 + _LINE_BUFSIZE * 2UL;
ps->pProcessingBuf = ps->pColorRunTable + ps->BufferForColorRunTable;
DBG( DBG_LOW, "sb2 = 0x%lx, sb1 = 0x%lx, Color = 0x%lx\n",
(ULong)ps->pScanBuffer2, (ULong)ps->pScanBuffer1,
(ULong)ps->pColorRunTable );
DBG( DBG_LOW, "Pro = 0x%lx, size = %ld\n",
(ULong)ps->pProcessingBuf, ps->TotalBufferRequire );
(unsigned long)ps->pScanBuffer2,
(unsigned long)ps->pScanBuffer1,
(unsigned long)ps->pColorRunTable );
DBG( DBG_LOW, "Pro = 0x%lx, size = %d\n",
(unsigned long)ps->pProcessingBuf, ps->TotalBufferRequire );
ps->dwShadow = (_DEF_BRIGHTEST_SKIP + _DEF_DARKEST_SKIP) * 5400UL * 2UL * 3UL;

Wyświetl plik

@ -3,7 +3,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -34,6 +34,8 @@
* - changed include names
* - 0.43 - removed floating point stuff
* - cleanup
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -418,12 +420,9 @@ static void fnP98Color48( pScanData ps, pVoid pb, pVoid pImg, ULong bL )
static int imageP98SetupScanSettings( pScanData ps, pScanInfo pInf )
{
UShort brightness;
ULong xAdjust;
DBG( DBG_LOW, "imageP98SetupScanSettings()\n" );
xAdjust = pInf->ImgDef.crArea.x + pInf->ImgDef.crArea.cx;
ps->DataInf.dwScanFlag = pInf->ImgDef.dwFlag;
ps->DataInf.dwVxdFlag = 0;
ps->DataInf.crImage = pInf->ImgDef.crArea;
@ -734,7 +733,7 @@ static void imageP98GetInfo( pScanData ps, pImgDef pImgInf )
pImgInf->crArea.cx, pImgInf->crArea.cy );
ps->DataInf.XYRatio = 1000 * ps->DataInf.xyPhyDpi.y/ps->DataInf.xyPhyDpi.x;
DBG( DBG_LOW, "xyDpi.x = %u, xyDpi.y = %u, XYRatio = %lu\n",
DBG( DBG_LOW, "xyDpi.x = %u, xyDpi.y = %u, XYRatio = %u\n",
pImgInf->xyDpi.x, pImgInf->xyDpi.y, ps->DataInf.XYRatio );
ps->DataInf.dwAppLinesPerArea = (ULong)pImgInf->crArea.cy *
@ -823,14 +822,14 @@ static void imageP98GetInfo( pScanData ps, pImgDef pImgInf )
}
}
DBG( DBG_LOW, "AppLinesPerArea = %lu\n", ps->DataInf.dwAppLinesPerArea );
DBG( DBG_LOW, "AppPixelsPerLine = %lu\n", ps->DataInf.dwAppPixelsPerLine );
DBG( DBG_LOW, "AppPhyBytesPerLine = %lu\n", ps->DataInf.dwAppPhyBytesPerLine );
DBG( DBG_LOW, "AppBytesPerLine = %lu\n", ps->DataInf.dwAppBytesPerLine );
DBG( DBG_LOW, "AsicPixelsPerPlane = %lu\n", ps->DataInf.dwAsicPixelsPerPlane );
DBG( DBG_LOW, "AsicBytesPerPlane = %lu\n", ps->DataInf.dwAsicBytesPerPlane );
DBG( DBG_LOW, "AsicBytesPerLine = %lu\n", ps->DataInf.dwAsicBytesPerLine );
DBG( DBG_LOW, "Physical Bytes = %lu\n", ps->DataInf.dwPhysBytesPerLine );
DBG( DBG_LOW, "AppLinesPerArea = %u\n", ps->DataInf.dwAppLinesPerArea );
DBG( DBG_LOW, "AppPixelsPerLine = %u\n", ps->DataInf.dwAppPixelsPerLine );
DBG( DBG_LOW, "AppPhyBytesPerLine = %u\n", ps->DataInf.dwAppPhyBytesPerLine );
DBG( DBG_LOW, "AppBytesPerLine = %u\n", ps->DataInf.dwAppBytesPerLine );
DBG( DBG_LOW, "AsicPixelsPerPlane = %u\n", ps->DataInf.dwAsicPixelsPerPlane );
DBG( DBG_LOW, "AsicBytesPerPlane = %u\n", ps->DataInf.dwAsicBytesPerPlane );
DBG( DBG_LOW, "AsicBytesPerLine = %u\n", ps->DataInf.dwAsicBytesPerLine );
DBG( DBG_LOW, "Physical Bytes = %u\n", ps->DataInf.dwPhysBytesPerLine );
}
/**
@ -852,7 +851,7 @@ static void imageP96GetInfo( pScanData ps, pImgDef pImgInf )
pImgInf->crArea.cx, pImgInf->crArea.cy );
ps->DataInf.XYRatio = 1000 * ps->DataInf.xyPhyDpi.y/ps->DataInf.xyPhyDpi.x;
DBG( DBG_LOW, "xyDpi.x = %u, xyDpi.y = %u, XYRatio = %lu\n",
DBG( DBG_LOW, "xyDpi.x = %u, xyDpi.y = %u, XYRatio = %u\n",
pImgInf->xyDpi.x, pImgInf->xyDpi.y, ps->DataInf.XYRatio );
ps->DataInf.dwAppLinesPerArea = (ULong)pImgInf->crArea.cy *
@ -925,14 +924,14 @@ static void imageP96GetInfo( pScanData ps, pImgDef pImgInf )
/* WORK: AsicBytesPerLine only used for ASIC_98001 based scanners - try to remove
** that, also try to remove redundant info
*/
DBG( DBG_LOW, "AppLinesPerArea = %lu\n", ps->DataInf.dwAppLinesPerArea );
DBG( DBG_LOW, "AppPixelsPerLine = %lu\n", ps->DataInf.dwAppPixelsPerLine );
DBG( DBG_LOW, "AppPhyBytesPerLine = %lu\n", ps->DataInf.dwAppPhyBytesPerLine );
DBG( DBG_LOW, "AppBytesPerLine = %lu\n", ps->DataInf.dwAppBytesPerLine );
DBG( DBG_LOW, "AsicPixelsPerPlane = %lu\n", ps->DataInf.dwAsicPixelsPerPlane );
DBG( DBG_LOW, "AsicBytesPerPlane = %lu\n", ps->DataInf.dwAsicBytesPerPlane );
DBG( DBG_LOW, "AsicBytesPerLine = %lu\n", ps->DataInf.dwAsicBytesPerLine );
DBG( DBG_LOW, "Physical Bytes = %lu\n", ps->DataInf.dwPhysBytesPerLine );
DBG( DBG_LOW, "AppLinesPerArea = %u\n", ps->DataInf.dwAppLinesPerArea );
DBG( DBG_LOW, "AppPixelsPerLine = %u\n", ps->DataInf.dwAppPixelsPerLine );
DBG( DBG_LOW, "AppPhyBytesPerLine = %u\n", ps->DataInf.dwAppPhyBytesPerLine );
DBG( DBG_LOW, "AppBytesPerLine = %u\n", ps->DataInf.dwAppBytesPerLine );
DBG( DBG_LOW, "AsicPixelsPerPlane = %u\n", ps->DataInf.dwAsicPixelsPerPlane );
DBG( DBG_LOW, "AsicBytesPerPlane = %u\n", ps->DataInf.dwAsicBytesPerPlane );
DBG( DBG_LOW, "AsicBytesPerLine = %u\n", ps->DataInf.dwAsicBytesPerLine );
DBG( DBG_LOW, "Physical Bytes = %u\n", ps->DataInf.dwPhysBytesPerLine );
}
/** here we wait for one data-line
@ -1528,7 +1527,7 @@ static int imageP98003SetupScanSettings( pScanData ps, pScanInfo pInf )
ps->Scan.gd_gk.wGreenKeep + 2U) *
ps->DataInf.dwAsicBytesPerPlane;
DBG( DBG_LOW, "48Bit buffer request: len=%lu bytes, available=%lu\n",
DBG( DBG_LOW, "48Bit buffer request: len=%u bytes, available=%u\n",
b, ps->TotalBufferRequire );
if( b > ps->TotalBufferRequire )

Wyświetl plik

@ -4,7 +4,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.37 - initial version
@ -20,6 +20,8 @@
* - 0.41 - no changes
* - 0.42 - changed include names
* - 0.43 - no changes
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -575,7 +577,7 @@ static int ioP98ReadWriteTest( pScanData ps )
for( ul = 0; ul < _MEMTEST_SIZE; ul++ ) {
if( buffer[ul] != buffer[ul+_MEMTEST_SIZE] ) {
DBG( DBG_HIGH, "Error in memory test at pos %lu (%u != %u)\n",
DBG( DBG_HIGH, "Error in memory test at pos %u (%u != %u)\n",
ul, buffer[ul], buffer[ul+_MEMTEST_SIZE] );
retval = _E_NO_DEV;
break;
@ -590,7 +592,7 @@ static int ioP98ReadWriteTest( pScanData ps )
*/
static void ioSPPWrite( pScanData ps, pUChar pBuffer, ULong size )
{
DBG( DBG_IO , "Moving %lu bytes to scanner, IODELAY = %u...\n",
DBG( DBG_IO , "Moving %u bytes to scanner, IODELAY = %u...\n",
size, ps->IO.delay );
switch( ps->IO.delay ) {

Wyświetl plik

@ -3,7 +3,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -32,6 +32,8 @@
* - 0.43 - added LINUX_26 stuff
* - minor fixes
* - removed floating point stuff
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -436,7 +438,7 @@ static Long miscNextLongRand( Long seed )
/** initialize the random number generator
*/
static void miscSeedLongRand( ULong seed )
static void miscSeedLongRand( long seed )
{
randomnum = seed ? (seed & _PP_M) : 1; /* nonzero seed */
}
@ -455,7 +457,7 @@ _LOC pScanData MiscAllocAndInitStruct( void )
MiscReinitStruct( ps );
}
DBG( DBG_HIGH, "ScanData = 0x%08lx\n", (ULong)ps );
DBG( DBG_HIGH, "ScanData = 0x%08lx\n", (unsigned long)ps );
return ps;
}
@ -477,7 +479,7 @@ _LOC int MiscReinitStruct( pScanData ps )
ps->sCaps.wIOBase = _NO_BASE;
/* use memory address to seed the generator */
miscSeedLongRand((Long)ps);
miscSeedLongRand((long)ps);
DBG( DBG_HIGH, "Init settings done\n" );
return _OK;
@ -651,14 +653,14 @@ _LOC int MiscCheckTimer( TimerDef *timer )
#ifdef DEBUG
_LOC Bool MiscAllPointersSet( pScanData ps )
{
ULong i;
pULong ptr;
int i;
unsigned long *ptr;
for( ptr = (pULong)&ps->OpenScanPath, i = 1;
ptr <= (pULong)&ps->ReadOneImageLine; ptr++, i++ ) {
for( ptr = (unsigned long *)&ps->OpenScanPath, i = 1;
ptr <= (unsigned long *)&ps->ReadOneImageLine; ptr++, i++ ) {
if( NULL == (pVoid)*ptr ) {
DBG( DBG_HIGH, "Function pointer not set (pos = %lu) !\n", i );
DBG( DBG_HIGH, "Function pointer not set (pos = %d) !\n", i );
return _FALSE;
}
}
@ -730,7 +732,7 @@ _LOC int MiscRegisterPort( pScanData ps, int portAddr )
return _E_REGISTER;
}
DBG( DBG_LOW, "Port for device %lu registered\n", ps->devno );
DBG( DBG_LOW, "Port for device %u registered\n", ps->devno );
#endif
portIsClaimed[ps->devno] = 0;

Wyświetl plik

@ -3,7 +3,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -36,6 +36,8 @@
* - 0.41 - no changes
* - 0.42 - changed include names
* - 0.43 - no changes
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -424,7 +426,7 @@ static void motorP98FillDataToColorTable( pScanData ps,
if (*pw) { /* valid state */
if( *pw >= ps->BufferForColorRunTable ) {
DBG( DBG_LOW, "*pw = %u > %lu !!\n",
DBG( DBG_LOW, "*pw = %u > %u !!\n",
*pw, ps->BufferForColorRunTable );
} else {
bColor = ps->pColorRunTable[*pw]; /* get the colors */
@ -1629,7 +1631,7 @@ static void motorP96FillDataToColorTable( pScanData ps,
if (*pw) { /* valid state */
if( *pw >= ps->BufferForColorRunTable ) {
DBG( DBG_LOW, "*pw = %u > %lu !!\n",
DBG( DBG_LOW, "*pw = %u > %u !!\n",
*pw, ps->BufferForColorRunTable );
} else {

Wyświetl plik

@ -3,7 +3,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 2000 Plustek Inc.
* Copyright (C) 2001-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.38 - initial version
@ -12,6 +12,8 @@
* - 0.41 - no changes
* - 0.42 - removed setting of ps->sCaps.dwFlag in p12InitiateComponentModel()
* - 0.43 - no changes
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -230,7 +232,7 @@ static void p12SetupScanningCondition( pScanData ps )
ps->Scan.dwMaxReadFifo += (ps->DataInf.dwAsicBytesPerPlane / 2);
DBG( DBG_LOW, "MinReadFifo=%lu, MaxReadFifo=%lu\n",
DBG( DBG_LOW, "MinReadFifo=%u, MaxReadFifo=%u\n",
ps->Scan.dwMinReadFifo, ps->Scan.dwMaxReadFifo );
/* ------- Set the max. read fifo to asic ------- */
@ -426,8 +428,8 @@ static void p12ProgramCCD( pScanData ps)
pRegDef rp;
DBG( DBG_IO, "p12ProgramCCD: 0x%08lx[%lu]\n",
(ULong)ps->Device.pCCDRegisters,
((ULong)ps->Device.wNumCCDRegs * ps->Shade.bIntermediate));
(unsigned long)ps->Device.pCCDRegisters,
((unsigned long)ps->Device.wNumCCDRegs * ps->Shade.bIntermediate));
DBG( DBG_IO, " %u regs * %u (intermediate)\n",
ps->Device.wNumCCDRegs, ps->Shade.bIntermediate );

Wyświetl plik

@ -4,7 +4,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -35,6 +35,8 @@
* - 0.41 - no changes
* - 0.42 - changed include names
* - 0.43 - no changes
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -185,7 +187,7 @@ static int p48xxDoTest( pScanData ps )
/* check if fail */
if (ul != _TEST_SZ / sizeof(ULong)) {
DBG( DBG_LOW, "Bank not present, error at pos %lu (%lu)\n", ul,
DBG( DBG_LOW, "Bank not present, error at pos %u (%u)\n", ul,
(ULong)(_TEST_SZ / sizeof(ULong)));
break;
}
@ -195,7 +197,7 @@ static int p48xxDoTest( pScanData ps )
_KFREE( buffer );
DBG( DBG_LOW, "found %ld bytes of memory\n",
DBG( DBG_LOW, "found %d bytes of memory\n",
_TEST_SZ * (cntr - _BankAndSizeForTest));
if( cntr == _BankAndSizeForTest ) {
@ -209,7 +211,7 @@ static int p48xxDoTest( pScanData ps )
#endif
tmpByte = IODataRegisterFromScanner( ps, 0x0e );
DBG( DBG_LOW, "tmpByte = 0x%02x, cntr = %lu, AsicId = 0x%02x\n",
DBG( DBG_LOW, "tmpByte = 0x%02x, cntr = %u, AsicId = 0x%02x\n",
tmpByte, cntr, ps->sCaps.AsicID );
/* 128k */
@ -323,7 +325,7 @@ static int p48xxCheck4800Memory( pScanData ps )
for( ul = 0; ul < 1280; ul++ ) {
if( buffer[ul] != buffer[ul+1280] ) {
DBG( DBG_HIGH, "Error in memory test at pos %lu (%u != %u)\n",
DBG( DBG_HIGH, "Error in memory test at pos %u (%u != %u)\n",
ul, buffer[ul], buffer[ul+1280] );
retval = _E_NO_DEV;
break;

Wyświetl plik

@ -1,7 +1,7 @@
/* @file plustek-pp_procfs.c
* @brief this is the interface to the proc filesystem
*
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.37 - initial version
@ -12,6 +12,9 @@
* - 0.42 - changed include names
* - 0.43 - replace _PTDRV_VERx by _PTDRV_VERSTR
* - cleanup
* - 0.44 - PROC_FS changes for newer kernel
* - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -65,7 +68,9 @@
/** for the proc filesystem
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
extern struct proc_dir_entry proc_root;
#endif
static struct proc_dir_entry *base = NULL;
static struct proc_dir_entry *binfo = NULL;
static ULong devcount;
@ -173,8 +178,6 @@ static int procfsBInfoReadProc( char *buf, char **start, off_t offset,
int len = 0;
len += sprintf( buf, "Plustek Flatbed Scanner Driver version "_PTDRV_VERSTR"\n" );
len += sprintf( buf + len, "Devices : %lu\n", *((pULong)data) );
len += sprintf( buf + len, "IOCTL-Version: 0x%08x\n",_PTDRV_IOCTL_VERSION);
return len;
}
@ -348,7 +351,11 @@ int ProcFsInitialize( void )
{
DBG( DBG_HIGH, "ProcFsInitialize()\n" );
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
base = new_entry( _DRV_NAME, S_IFDIR, &proc_root );
#else
base = new_entry( _DRV_NAME, S_IFDIR, NULL );
#endif
if( NULL != base ) {
@ -375,7 +382,11 @@ void ProcFsShutdown( void )
if( NULL != binfo )
destroy_proc_entry( base, &binfo );
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
destroy_proc_entry( &proc_root, &base );
#else
destroy_proc_entry( NULL, &base );
#endif
}
devcount = 0;
@ -395,7 +406,7 @@ void ProcFsRegisterDevice( pScanData ps )
memset( &ps->procDir, 0, sizeof(ProcDirDef));
sprintf( str, "device%lu", ps->devno );
sprintf( str, "device%u", ps->devno );
ps->procDir.entry = new_entry( str, S_IFDIR, base );
if( NULL == ps->procDir.entry )

Wyświetl plik

@ -3,7 +3,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -52,6 +52,9 @@
* - 0.43 - added LINUX_26 stuff
* - changed include names
* - changed version string stuff
* - 0.44 - added support for more recent kernels
* - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -162,7 +165,7 @@ static Bool deviceScanning = _FALSE;
static struct timer_list tl[_MAX_PTDEVS];
/* for calculation of the timer expiration */
extern volatile ULong jiffies;
extern volatile unsigned long jiffies;
/* the parameter interface
*/
@ -192,9 +195,9 @@ module_param_array(port, int, &array_len, 0);
module_param_array(lampoff, int, &array_len, 0);
module_param_array(warmup, int, &array_len, 0);
module_param_array(lOffonEnd, int, &array_len, 0);
module_param_array(mov, int, &array_len, 0);
module_param_array(mov, ushort, &array_len, 0);
module_param_array(slowIO, int, &array_len, 0);
module_param_array(forceMode, int, &array_len, 0);
module_param_array(forceMode, ushort, &array_len, 0);
#endif
@ -224,7 +227,6 @@ MODULE_PARM_DESC(forceMode, "0 = use auto detection, "
*/
static int pt_drv_open ( struct inode *, struct file *);
static CLOSETYPE pt_drv_close( struct inode *, struct file *);
static int pt_drv_ioctl( struct inode *, struct file *, UInt, ULong );
#ifdef LINUX_20
static int pt_drv_read( struct inode*, struct file*, char*, int );
@ -236,6 +238,13 @@ static int pt_drv_ioctl( struct inode *, struct file *, UInt, ULong );
const char *buffer, size_t tmp,loff_t *count);
#endif
#ifdef NOLOCK_IOCTL
static long pt_drv_ioctl( struct file *, UInt, unsigned long );
#else
static int pt_drv_ioctl( struct inode *, struct file *, UInt, unsigned long );
#endif
/*
* the driver interface
*/
@ -266,7 +275,7 @@ static struct file_operations pt_drv_fops = {
#endif
read: pt_drv_read,
write: pt_drv_write,
ioctl: pt_drv_ioctl,
IOCTL: pt_drv_ioctl,
open: pt_drv_open,
release: pt_drv_close,
};
@ -500,7 +509,7 @@ static void ptdrvLampWarmup( pScanData ps )
/**
*/
#ifdef __KERNEL__
static void ptdrvLampTimerIrq( ULong ptr )
static void ptdrvLampTimerIrq( unsigned long ptr )
#else
static void ptdrvLampTimerIrq( int sig_num )
#endif
@ -571,7 +580,7 @@ static void ptdrvStartLampTimer( pScanData ps )
s.sa_handler = ptdrvLampTimerIrq;
if( sigaction( SIGALRM, &s, NULL ) < 0 ) {
DBG(DBG_HIGH,"pt_drv%lu: Can't setup timer-irq handler\n",ps->devno);
DBG(DBG_HIGH,"pt_drv%u: Can't setup timer-irq handler\n",ps->devno);
}
sigprocmask( SIG_UNBLOCK, &block, &pause_mask );
@ -595,7 +604,7 @@ static void ptdrvStartLampTimer( pScanData ps )
/* timeout val in seconds */
tl[ps->devno].expires = jiffies + ps->lampoff * HZ;
tl[ps->devno].data = (ULong)ps;
tl[ps->devno].data = (unsigned long)ps;
tl[ps->devno].function = ptdrvLampTimerIrq;
if( 0 != ps->lampoff )
@ -637,7 +646,7 @@ static int ptdrvOpen( pScanData ps, int portBase )
{
int retval;
DBG( DBG_HIGH, "ptdrvOpen(port=0x%lx)\n", (ULong)portBase );
DBG( DBG_HIGH, "ptdrvOpen(port=0x%x)\n", (int32_t)portBase );
if( NULL == ps )
return _E_NULLPTR;
@ -954,7 +963,6 @@ static int ptdrvShutdown( pScanData ps )
*/
static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
{
UChar val;
UShort dir;
UShort version;
UInt size;
@ -1081,7 +1089,7 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
if (copy_from_user(&adj, (pPPAdjDef)arg, sizeof(PPAdjDef)))
return _E_FAULT;
DBG( DBG_LOW, "Adjusting device %lu\n", ps->devno );
DBG( DBG_LOW, "Adjusting device %u\n", ps->devno );
DBG( DBG_LOW, "warmup: %i\n", adj.warmup );
DBG( DBG_LOW, "lampOff: %i\n", adj.lampOff );
DBG( DBG_LOW, "lampOffOnEnd: %i\n", adj.lampOffOnEnd );
@ -1259,7 +1267,7 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
*/
case _PTDRV_ACTION_BUTTON:
DBG( DBG_LOW, "ioctl(_PTDRV_ACTION_BUTTON)\n" );
val = IODataRegisterFromScanner( ps, ps->RegStatus );
IODataRegisterFromScanner( ps, ps->RegStatus );
retval = putUserVal( argVal, arg, size );
break;
@ -1306,7 +1314,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
#else
DBG( DBG_HIGH,
#endif
"pt_drv%lu: reading 0 bytes makes no sense!\n", ps->devno );
"pt_drv%u: reading 0 bytes makes no sense!\n", ps->devno );
return _E_INVALID;
}
@ -1324,7 +1332,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
#else
DBG( DBG_HIGH,
#endif
"pt_drv%lu: Cannot read, driver not initialized!\n",ps->devno);
"pt_drv%u: Cannot read, driver not initialized!\n",ps->devno);
return _E_SEQUENCE;
}
@ -1339,7 +1347,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
#else
DBG( DBG_HIGH,
#endif
"pt_drv%lu: Not enough memory available!\n", ps->devno );
"pt_drv%u: Not enough memory available!\n", ps->devno );
return _E_ALLOC;
}
@ -1354,7 +1362,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
#else
DBG( DBG_HIGH,
#endif
"pt_drv%lu: Not enough memory available!\n", ps->devno );
"pt_drv%u: Not enough memory available!\n", ps->devno );
return _E_ALLOC;
}
} else {
@ -1362,9 +1370,9 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
}
DBG( DBG_LOW, "PtDrvRead(%u bytes)*****************\n", count );
DBG( DBG_LOW, "MonoBuf = 0x%08lx[%lu], scaleBuf = 0x%lx\n",
(ULong)ps->Scan.bp.pMonoBuf,
ps->DataInf.dwAppPhyBytesPerLine, (ULong)scaleBuf );
DBG( DBG_LOW, "MonoBuf = 0x%08lx[%u], scaleBuf = 0x%lx\n",
(unsigned long)ps->Scan.bp.pMonoBuf,
ps->DataInf.dwAppPhyBytesPerLine, (unsigned long)scaleBuf );
/*
* in case of a previous problem, move the sensor back home
@ -1405,7 +1413,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
#else
DBG( DBG_HIGH,
#endif
"pt_drv%lu: calibration failed, result = %i\n",
"pt_drv%u: calibration failed, result = %i\n",
ps->devno, retval );
goto ReadFinished;
}
@ -1441,8 +1449,8 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
/*
* now get the picture data
*/
DBG( DBG_HIGH, "dwAppLinesPerArea = %ld\n", ps->DataInf.dwAppLinesPerArea);
DBG( DBG_HIGH, "dwAppBytesPerLine = %ld\n", ps->DataInf.dwAppBytesPerLine);
DBG( DBG_HIGH, "dwAppLinesPerArea = %d\n", ps->DataInf.dwAppLinesPerArea);
DBG( DBG_HIGH, "dwAppBytesPerLine = %d\n", ps->DataInf.dwAppBytesPerLine);
/* HEINER: A3I
ps->bMoveDataOutFlag = _DataFromStopState;
@ -1453,7 +1461,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
if( ps->Scan.dwLinesToRead ) {
DBG( DBG_HIGH, "dwLinesToRead = %ld\n", ps->Scan.dwLinesToRead );
DBG( DBG_HIGH, "dwLinesToRead = %d\n", ps->Scan.dwLinesToRead );
if( ps->Scan.dwLinesToRead > ps->DataInf.dwAppLinesPerArea )
ps->Scan.dwLinesToRead = ps->DataInf.dwAppLinesPerArea;
@ -1472,7 +1480,7 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
_ASSERT(ps->ReadOneImageLine);
if (!ps->ReadOneImageLine(ps)) {
ps->fScanningStatus = _FALSE;
DBG( DBG_HIGH, "ReadOneImageLine() failed at line %lu!\n",
DBG( DBG_HIGH, "ReadOneImageLine() failed at line %u!\n",
dwLinesRead );
break;
}
@ -1582,6 +1590,9 @@ int init_module( void )
#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE))
char controlname[24];
#endif
# ifdef LINUX_26
char devname[20];
#endif
DBG( DBG_HIGH, "*********************************************\n" );
DBG( DBG_HIGH, "pt_drv: init_module()\n" );
@ -1633,9 +1644,10 @@ int init_module( void )
# endif
#else
# ifdef LINUX_26
CLASS_DEVICE_CREATE(ptdrv_class,
sprintf(devname, "pt_drv%d", devCount);
CLASS_DEV_CREATE(ptdrv_class,
MKDEV(_PTDRV_MAJOR, devCount), NULL,
"pt_drv%d", devCount);
devname);
# endif /* LINUX_26 */
#endif /* CONFIG_DEVFS_FS */
@ -1714,7 +1726,7 @@ void cleanup_module( void )
# endif
#else
# ifdef LINUX_26
class_device_destroy(ptdrv_class, MKDEV(_PTDRV_MAJOR, i));
CLASS_DEV_DESTROY(ptdrv_class, MKDEV(_PTDRV_MAJOR, i));
# endif /* LINUX_26 */
#endif /* CONFIG_DEVFS_FS */
ptdrvShutdown( ps );
@ -1838,7 +1850,7 @@ static ssize_t pt_drv_read( struct file *file,
* possible to scan simultaenously with two or more devices
*/
if( _TRUE == deviceScanning ) {
printk( KERN_INFO "pt_drv: device %lu busy!!!\n", ps->devno );
printk( KERN_INFO "pt_drv: device %u busy!!!\n", ps->devno );
return(-EBUSY);
}
@ -1870,8 +1882,19 @@ static int pt_drv_write(struct inode * inode, struct file * file,
/*.............................................................................
* the ioctl interface
*/
#ifdef NOLOCK_IOCTL
static long pt_drv_ioctl( struct file *file, UInt cmd, unsigned long arg )
{
pScanData ps;
if ( !(ps = get_pt_from_inode(file->f_dentry->d_inode)) )
return(-ENXIO);
return ptdrvIoctl( ps, cmd, (pVoid)arg);
}
#else
static int pt_drv_ioctl( struct inode *inode, struct file *file,
UInt cmd, ULong arg )
UInt cmd, unsigned long arg )
{
pScanData ps;
@ -1880,6 +1903,7 @@ static int pt_drv_ioctl( struct inode *inode, struct file *file,
return ptdrvIoctl( ps, cmd, (pVoid)arg);
}
#endif
#else /* the user-mode interface */

Wyświetl plik

@ -1,7 +1,7 @@
/* @file plustek-pp_scan.h
* @brief the global header for the plustek driver
*
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* 0.30 - initial version
@ -20,6 +20,7 @@
* 0.41 - no changes
* 0.42 - changed include names
* 0.43 - no changes
* 0.44 - no changes
* .
* <hr>
* This file is part of the SANE package.

Wyświetl plik

@ -4,7 +4,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson <rick@efn.org>
*.............................................................................
* History:
@ -46,6 +46,7 @@
* 0.42 - no changes
* 0.43 - changed type of XYRatio from double to long
* - cleanup
* 0.44 - changes as Long defaults now to int32_t
* .
* <hr>
* This file is part of the SANE package.
@ -128,7 +129,7 @@ typedef struct {
/* CHANGE added these vars for scaling
*/
long XYRatio;
Long XYRatio;
ULong dwPhysBytesPerLine;
/*

Wyświetl plik

@ -2,7 +2,7 @@
* @brief a trial to centralize changes between the different
* kernel-versions some stuff is maybe not relevant, but anyway...
*
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* 0.30 - initial version
@ -14,6 +14,7 @@
* - added LINUX_26 for new kernel
* - added _MINOR
* 0.43 - added class functions
* 0.44 - added support for kernel >= 2.6.35 and 3.x
* .
* <hr>
* This file is part of the SANE package.
@ -80,6 +81,15 @@
# define LINUX_24
# define LINUX_26
# include <linux/device.h>
# if LINUX_VERSION_CODE > VERSION_CODE(2,6,35)
# define NOLOCK_IOCTL
# define IOCTL unlocked_ioctl
# else
# define IOCTL ioctl
# endif
# if LINUX_VERSION_CODE > VERSION_CODE(3,0,0)
# include <linux/sched.h>
# endif
#endif
#include <linux/types.h> /* used later in this header */
@ -308,18 +318,37 @@
#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,15)
typedef struct class class_t;
#define CLASS_DEVICE_CREATE(cls, devt, device, fmt, arg...) class_device_create(cls, NULL, devt, device, fmt, ## arg)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
#define CLASS_DEV_CREATE(class, devt, device, name) \
device_create(class, device, devt, NULL, "%s", name)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#define CLASS_DEV_CREATE(class, devt, device, name) \
device_create(class, device, devt, name)
#else
#define CLASS_DEV_CREATE(class, devt, device, name) \
class_device_create(class, NULL, devt, device, name)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#define CLASS_DEV_DESTROY device_destroy
#else
#define CLASS_DEV_DESTROY class_device_destroy
#endif
#else /* LINUX 2.6.0 - 2.6.14 */
#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,13) /* LINUX 2.6.13 - 2.6.14 */
typedef struct class class_t;
#define CLASS_DEVICE_CREATE class_device_create
#define CLASS_DEV_DESTROY(class, devt) class_device_destroy(class, devt)
#else /* LINUX 2.6.0 - 2.6.12, class_simple */
typedef struct class_simple class_t;
#define CLASS_DEVICE_CREATE class_simple_device_add
#define CLASS_DEV_DESTROY(class, devt) class_simple_device_remove(class, devt)
#define class_create class_simple_create
#define class_destroy class_simple_destroy
#define class_device_destroy(a, b) class_simple_device_remove(b)

Wyświetl plik

@ -4,7 +4,7 @@
*
* based on sources acquired from Plustek Inc.
* Copyright (C) 1998 Plustek Inc.
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
* also based on the work done by Rick Bronson
*
* History:
@ -23,6 +23,8 @@
* - 0.41 - no changes
* - 0.42 - changed include names
* - 0.43 - no changes
* - 0.44 - fix format string issues, as Long types default to int32_t
* now
* .
* <hr>
* This file is part of the SANE package.
@ -165,7 +167,7 @@ static void tpaP98GetNegativeTempRamData( pScanData ps )
ULong dw, dw1;
DataPointer p;
pULong pdwNegativeSumTemp;
pUShort pNegativeTempRam, pNegativeTempRam2, pNegativeTempRam3;
pUShort pNegativeTempRam, pNegativeTempRam2;
ps->bFastMoveFlag = _FastMove_Low_C75_G150;
@ -174,7 +176,6 @@ static void tpaP98GetNegativeTempRamData( pScanData ps )
pNegativeTempRam = (pUShort)(ps->pScanBuffer1 + 5400 * 6);
pdwNegativeSumTemp = (pULong)(pNegativeTempRam + 960 * 3 * 2);
pNegativeTempRam2 = (pUShort)(pdwNegativeSumTemp + 960 * 3 * 4);
pNegativeTempRam3 = (pUShort)pNegativeTempRam2 + 240 * 3 * 2;
/* ClearNegativeSumBuffer() */
memset( pdwNegativeSumTemp, 0, (960 * 3 * 4));
@ -704,8 +705,8 @@ _LOC void TPAP98001AverageShadingData( pScanData ps )
if (pw[dwRight] >= 600)
break;
DBG( DBG_LOW, "_TPAPageWidth = %u, _NegativePageWidth = %lu\n"
"right = %ld, left = %ld --> right = %ld\n",
DBG( DBG_LOW, "_TPAPageWidth = %u, _NegativePageWidth = %u\n"
"right = %d, left = %d --> right = %d\n",
_TPAPageWidth, _NegativePageWidth,
dwRight, dwLeft, (((Long)dwRight-(Long)dwLeft)/2));

Wyświetl plik

@ -1,7 +1,7 @@
/* @file plustek-pp_types.h
* @brief some typedefs and error codes
*
* Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2000-2013 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* 0.30 - initial version
@ -24,6 +24,8 @@
* 0.41 - no changes
* 0.42 - moved errorcodes to plustek-share.h
* 0.43 - no changes
* 0.44 - define Long and ULong types to use int32_t, so
* the code should still work on 64 bit machines
* .
* <hr>
* This file is part of the SANE package.
@ -84,9 +86,16 @@ typedef UShort *pUShort;
typedef unsigned int UInt;
typedef UInt *pUInt;
/* these definitions will fail for 64 bit machines! */
#if 0
typedef long Long;
typedef long *pLong;
typedef unsigned long ULong;
#endif
typedef int32_t Long;
typedef int32_t *pLong;
typedef uint32_t ULong;
typedef ULong *pULong;
typedef void *pVoid;