Re: PCTel Driver fails to compile, found a fix for 2.6.38.8

Robert Thornburrow <[email protected]> Thu, 16 Jun 2011 08:57:44 +0100
Newsgroups gmane.linux.linmodem
Message-ID <[email protected]>
Thanks Antonio.  I will take a look at this when I get chance and 
incorporate some kind of fix based on this in a new build.  The errors 
look like the format to a printf not matching the argument sizes, so 
maybe the size of the things being printed have changed in the kernel.

Best regards,

      Robert

On 15/06/2011 00:04, Antonio Olivares wrote:
> @all
>
> the driver compiles after the fixes, but some things don't look correct:
>
> checking for running kernel version...2.6.38
> checking for ptserial...ptserial-2.6.c
> checking for gcc...4.5.2 (4.5)
> checking for kernel gcc version...4.5.2 (4.5)
> searching for kernel includes...found at
> /lib/modules/2.6.38.8-porteus/build/include
> checking for autoconf.h.../lib/modules/2.6.38.8-porteus/build/include/linux/autoconf.h
> checking for asm/mach-default...yes
> checking for kernel version in linux/utsrelease.h...UTS_RELEASE is
> 2.6.38.8-porteus
> checking type of tty_struct.count...int
> checking for presence of udev...present (kernel version 2.6.13 or later)
> detecting your modem...found. Your modem is a pct789 type modem.
>    CC    vuart.o
>    LD    binary.a
> make -C /lib/modules/2.6.38.8-porteus/build
> M=/root/Downloads/pctel-0.9.7-9-rht-11/src
> make[1]: Entering directory `/usr/src/linux-2.6.38.8'
>    LD      /root/Downloads/pctel-0.9.7-9-rht-11/src/built-in.o
>    CC [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.o
>    CC [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial-2.6.o
>    CC [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.o
> /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.c: In
> function 'pci_pctel_setup':
> /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.c:231:2:
> warning: format '%x' expects type 'unsigned int', but argument 9 has
> type 'long unsigned int'
> /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.c: In
> function 'amr_pctel_setup':
> /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.c:291:2:
> warning: format '%04x' expects type 'unsigned int', but argument 7 has
> type 'long unsigned int'
> /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.c: In
> function 'pciserial_init_one':
> /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_pci-2.6.c:606:3:
> warning: format '%x' expects type 'unsigned int', but argument 4 has
> type 'long unsigned int'
>    CC [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/ptserial_hw-2.6.o
>    LD [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem.o
>    LD [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/pctel.o
>    LD [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/pctel_hw.o
>    Building modules, stage 2.
>    MODPOST 3 modules
>    CC      /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem.mod.o
>    LD [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem.ko
>    CC      /root/Downloads/pctel-0.9.7-9-rht-11/src/pctel.mod.o
>    LD [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/pctel.ko
>    CC      /root/Downloads/pctel-0.9.7-9-rht-11/src/pctel_hw.mod.o
>    LD [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/pctel_hw.ko
> make[1]: Leaving directory `/usr/src/linux-2.6.38.8'
> rm -f /dev/ttyS_PCTEL0
> echo "KERNEL==\"ttyS_PCTEL0\", SYMLINK=\"modem\"">
> /etc/udev/rules.d/70-pctel.rules
> install -D -m 644 linmodem.ko
> /tmp/pctel-/lib/modules/2.6.38.8-porteus/misc/linmodem.ko
> install -D -m 644 pctel.ko
> /tmp/pctel-/lib/modules/2.6.38.8-porteus/misc/pctel.ko
> install -D -m 644 pctel_hw.ko
> /tmp/pctel-/lib/modules/2.6.38.8-porteus/misc/pctel_hw.ko
> /sbin/depmod -a
>
>
> Will wait for a better fix than the one I came up with :(
>
> Regards,
>
> Antonio
>
> On Tue, Jun 14, 2011 at 10:29 PM, Antonio Olivares
> <[email protected]>  wrote:
>> Dear folks, Robert&  Marv,
>>
>> I don't have a dialup connection anymore, but I try to maintain some
>> scripts that will generate a working driver formerly for slax and now
>> for porteus live cd.  I had a build script that generated the module
>> (a working package that is inserted on the fly and modem would be
>> accessible and working).  In the newer kernels, the driver was not
>> compiling.
>>
>> root@porteus:~/Downloads/pctel-0.9.7-9-rht-11/src# cat make.log | more
>>   CC    vuart.o
>>   LD    binary.a
>> make -C /lib/modules/2.6.38.8-porteus/build
>> M=/root/Downloads/pctel-0.9.7-9-rht-11/src
>> make[1]: Entering directory `/usr/src/linux-2.6.38.8'
>>   LD      /root/Downloads/pctel-0.9.7-9-rht-11/src/built-in.o
>>   CC [M]  /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.o
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:89:8: warning:
>> type defaults to 'int' in decla
>> ration of 'DECLARE_MUTEX'
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:89:1: warning:
>> parameter names (without types)
>>   in function declaration
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> 'linmodem_find_by_port':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:304:8: error:
>> 'linmodem_sem' undeclared (first
>>   use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:304:8: note:
>> each undeclared identifier is rep
>> orted only once for each function it appears in
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> 'linmodem_find_by_line':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:327:8: error:
>> 'linmodem_sem' undeclared (first
>>   use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: At top level:
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1204:8:
>> warning: type defaults to 'int' in dec
>> laration of 'DECLARE_MUTEX'
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1204:1:
>> warning: parameter names (without type
>> s) in function declaration
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> 'linmodem_register_port':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1231:8: error:
>> 'serial_sem' undeclared (first
>> use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> '__unregister_port':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1265:8: error:
>> 'serial_sem' undeclared (first
>> use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> 'linmodem_exit':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1325:8: error:
>> 'linmodem_sem' undeclared (firs
>> t use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> 'linmodem_new':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1349:8: error:
>> 'linmodem_sem' undeclared (firs
>> t use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: In function
>> 'linmodem_del':
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1396:8: error:
>> 'linmodem_sem' undeclared (firs
>> t use in this function)
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c: At top level:
>> /root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.c:1204:8:
>> warning: 'DECLARE_MUTEX' declared 'sta
>> tic' but never defined
>> make[2]: *** [/root/Downloads/pctel-0.9.7-9-rht-11/src/linmodem-2.6.o] Error 1
>> make[1]: *** [_module_/root/Downloads/pctel-0.9.7-9-rht-11/src] Error 2
>> make[1]: Leaving directory `/usr/src/linux-2.6.38.8'
>> make: *** [all] Error 2
>>
>>
>> However, by making some changes, the compilation goes through and the
>> driver is compiled:
>>
>> Line 89 in original source
>>
>> from
>> static DECLARE_MUTEX(linmodem_sem);
>> to
>> #if LINUX_VERSION_CODE<  KERNEL_VERSION(2,6,37)
>>   static DECLARE_MUTEX(linmodem_sem);
>> #else
>> static DEFINE_SEMAPHORE(linmodem_sem);
>> #endif
>>
>>
>> Line 1204 or so add:
>>
>> #if LINUX_VERSION_CODE<  KERNEL_VERSION(2,6,37)
>>   static DECLARE_MUTEX(serial_sem);
>> #else
>> static DEFINE_SEMAPHORE(serial_sem);
>> #endif
>>
>> I will try to write a script with sed that fixes this so I could patch
>> up a build script for porteus:
>>
>> http://www.forum.porteus.org/viewtopic.php?f=39&t=37&sid=83038aa01e399928c2a6e5b99bb96eb8
>>
>> I was looking for a fix and I saw the fix applied in this page:
>> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602367
>>
>> Hope to fix it so that users that need a working module for porteus
>> are not left in the dark.
>>
>> Regards,
>>
>> Antonio
>>
>