[SMARTLINK][64BIT] Patch for slusb module for 64bit kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Below Guiseppe's original instructions have been slightly expanded for clarity.
And followed by a few illustrations.
Thanks Guiseppe

MarvS
---------- Forwarded message ----------
From: Giuseppe Della Bianca <bepi@xxxxxxxx>
To: discuss@xxxxxxxxxxxxx
Date: Mon, 24 Sep 2007 22:08:18 +0200
Subject: [!][SMARTLINK][64BIT] Patch for slusb module for 64bit kernel
Hi.

With this patch slusb module work with 64bit (and 32bit, I suppose) kernel.

This patch disables the amrmo module only used in compilation of the
slamr.ko (amrlibs.o is only for 32bit kernel).

Download from http://linmodems.technion.ac.il/packages/smartlink/  two packages
slusb_x86_only.patch.tar.gz
slmodem-2.9.11-20070813.tar.gz

Within a common Linux partitions unpack with:
$ tar zxf  slm*.tar.gz
$ tar zxf slu*.patch.tar.gz

These creates:
Folder  slmodem-2.9.11-20070813/
and the patchfile    slusb_x86_only.patch

Move into the folder
$ cd slmodem-2.9.11-20070813

Apply the patch with
$ patch -p1 < ../slusb_x86_only.patch
patching file drivers/Makefile
patching file drivers/st7554.c
patching file modem/Makefile

Regards.
       Gdb
-------------
Some of the lines of slusb_x86_only.patch below are folded in this
email, so best start with slusb_x86_only.patch.tar.gz unless you are
experienced!

diff -Nru slmodem-2.9.11-20070813/drivers/Makefile
slmodem_patch-2.9.11-20070813/drivers/Makefile
--- slmodem-2.9.11-20070813/drivers/Makefile    2005-04-05
17:17:50.000000000 +0200
+++ slmodem_patch-2.9.11-20070813/drivers/Makefile      2007-09-24
21:28:02.000000000 +0200
@@ -20,7 +20,8 @@

 EXTRA_CFLAGS = -I$(obj) -I$(obj)/../modem

-obj-m := slamr.o slusb.o
+obj-m := slusb.o
+#obj-m := slamr.o slusb.o

 slamr-objs:= amrmo_init.o sysdep_amr.o amrlibs.o
 slusb-objs:= st7554.o
@@ -71,7 +72,7 @@
        $(LD) -r -o $@ $^

 install: uninstall-old
-       install -D -m 644 slamr.o $(module-dir)/slamr.o
+#      install -D -m 644 slamr.o $(module-dir)/slamr.o
        install -D -m 644 slusb.o $(module-dir)/slusb.o
        cp /etc/modules.conf /etc/modules.conf.slamr && \
            echo 'alias char-major-242 slamr' >> /etc/modules.conf && \
@@ -101,7 +102,7 @@
 all:
        $(MAKE) modules -C $(KERNEL_DIR) SUBDIRS=$(shell pwd)
 install:
-       install -D -m 644 slamr.ko $(module-dir)/slamr.ko
+#      install -D -m 644 slamr.ko $(module-dir)/slamr.ko
        install -D -m 644 slusb.ko $(module-dir)/slusb.ko
        /sbin/depmod -a
 uninstall:
diff -Nru slmodem-2.9.11-20070813/drivers/st7554.c
slmodem_patch-2.9.11-20070813/drivers/st7554.c
--- slmodem-2.9.11-20070813/drivers/st7554.c    2007-02-04
15:22:22.000000000 +0100
+++ slmodem_patch-2.9.11-20070813/drivers/st7554.c      2007-09-24
21:23:52.000000000 +0200
@@ -968,6 +968,11 @@
        return -ENOIOCTLCMD;
 }

+static long st7554_ioctl32(struct file *file, unsigned int cmd,
unsigned long arg)
+{
+        return st7554_ioctl(NULL, file, cmd, arg);
+}
+
 static int st7554_open(struct inode *inode, struct file *file)
 {
        struct st7554_state *s;
@@ -1011,7 +1016,9 @@
         .read =    st7554_read,
         .write =   st7554_write,
         .poll =    st7554_poll,
-        .ioctl =   st7554_ioctl,
+//        .ioctl =   st7554_ioctl,
+       .unlocked_ioctl = st7554_ioctl32,
+       .compat_ioctl = st7554_ioctl32,
         .open =    st7554_open,
         .release = st7554_close,
 };
diff -Nru slmodem-2.9.11-20070813/modem/Makefile
slmodem_patch-2.9.11-20070813/modem/Makefile
--- slmodem-2.9.11-20070813/modem/Makefile      2005-11-01
16:33:34.000000000 +0100
+++ slmodem_patch-2.9.11-20070813/modem/Makefile        2007-09-24
21:23:52.000000000 +0200
@@ -13,7 +13,7 @@
 #
 ###########################################################################

-CC:= gcc
+CC:= gcc -m32
 RM:= rm -f

 CFLAGS+= -Wall -g -O -I. -DCONFIG_DEBUG_MODEM


Here is a sample compile:
$ make clean
$ make all
marv@marvdesk:/usr/src/modules/slmodem-2.9.11-20070813$ make clean
make -C modem clean &&  make -C drivers clean &&  echo "done."
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
rm -f slmodemd modem_test modem_main.o modem_cmdline.o modem_test.o
modem.o modem_datafile.o modem_at.o modem_timer.o modem_pack.o
modem_ec.o modem_comp.o modem_param.o modem_debug.o homolog_data.o
dp_sinus.o dp_dummy.o sysdep_common.o
rm -f *~ *.orig *.rej
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
rm -f kernel-ver slusb.o slusb.ko *st7554.o amrmo_init.o sysdep_amr.o
*.mod.* .*.cmd *~
rm -f -r .tmp_versions
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
done.
marv@marvdesk:/usr/src/modules/slmodem-2.9.11-20070813$ make all
make -C modem all
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
rebuild profile...
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_main.o -c modem_main.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_cmdline.o -c
modem_cmdline.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem.o -c modem.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_datafile.o -c
modem_datafile.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_at.o -c modem_at.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_timer.o -c
modem_timer.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_pack.o -c modem_pack.c
modem_pack.c: In function 'modem_async_get_bits':
modem_pack.c:100: warning: pointer targets in passing argument 2 of
'm->get_chars' differ in signedness
modem_pack.c: In function 'modem_async_put_bits':
modem_pack.c:148: warning: pointer targets in passing argument 2 of
'm->put_chars' differ in signedness
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_ec.o -c modem_ec.c
modem_ec.c: In function 'tx_info':
modem_ec.c:723: warning: pointer targets in passing argument 2 of
'l->modem->get_chars' differ in signedness
modem_ec.c: In function 'push_rest_data':
modem_ec.c:811: warning: pointer targets in passing argument 2 of
'l->modem->put_chars' differ in signedness
modem_ec.c: In function 'rx_info':
modem_ec.c:860: warning: pointer targets in passing argument 2 of
'l->modem->put_chars' differ in signedness
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_comp.o -c modem_comp.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_param.o -c
modem_param.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_debug.o -c
modem_debug.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o homolog_data.o -c
homolog_data.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o dp_sinus.o -c dp_sinus.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o dp_dummy.o -c dp_dummy.c
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o sysdep_common.o -c
sysdep_common.c
gcc -m32  -o slmodemd modem_main.o modem_cmdline.o modem.o
modem_datafile.o modem_at.o modem_timer.o modem_pack.o modem_ec.o
modem_comp.o modem_param.o modem_debug.o homolog_data.o dp_sinus.o
dp_dummy.o dsplibs.o sysdep_common.o
gcc -m32 -Wall -g -O -I. -DCONFIG_DEBUG_MODEM   -o modem_test.o -c modem_test.c
gcc -m32  -o modem_test modem_test.o modem_cmdline.o modem.o
modem_datafile.o modem_at.o modem_timer.o modem_pack.o modem_ec.o
modem_comp.o modem_param.o modem_debug.o homolog_data.o dp_sinus.o
dp_dummy.o dsplibs.o sysdep_common.o
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
make -C drivers KERNEL_DIR=/lib/modules/2.6.20-15-generic/build
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
cc -I/lib/modules/2.6.20-15-generic/build/include -o kernel-ver kernel-ver.c
make all KERNEL_VER=2.6.20-15-generic
make[2]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make modules -C /lib/modules/2.6.20-15-generic/build
SUBDIRS=/usr/src/modules/slmodem-2.9.11-20070813/drivers
make[3]: Entering directory `/usr/src/linux-headers-2.6.20-15-generic'
  CC [M]  /usr/src/modules/slmodem-2.9.11-20070813/drivers/st7554.o
  LD [M]  /usr/src/modules/slmodem-2.9.11-20070813/drivers/slusb.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: modpost: GPL-incompatible module slusb.ko uses future
GPL-only symbol 'usb_deregister'
WARNING: modpost: GPL-incompatible module slusb.ko uses future
GPL-only symbol 'usb_register_driver'
  CC      /usr/src/modules/slmodem-2.9.11-20070813/drivers/slusb.mod.o
  LD [M]  /usr/src/modules/slmodem-2.9.11-20070813/drivers/slusb.ko
make[3]: Leaving directory `/usr/src/linux-headers-2.6.20-15-generic'
make[2]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'

Only the slusb.ko driver is created:
marv@marvdesk:/usr/src/modules/slmodem-2.9.11-20070813$ ls -l drivers/*.ko
-rw-r--r-- 1 marv root 177444 2007-09-24 19:29 drivers/slusb.ko

and the slmodemd
$ ls -l modem/slmodemd
-rwxr-xr-x 1 marv root 1304487 2007-09-24 19:29 modem/slmodemd

These can (on a Ubuntu System) be installed with:
$ sudo make install
Password:
make -C modem all
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
lmake[1]: eaving directory `/usr/src/linux-headers-2.6.20-15-generic'
make[2]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
marv@marvdesk:/usr/src/modules/slmodem-2.9.11-20070813$ ls -l drivers/*.ko
-rw-r--r-- 1 marv root 177444 2007-09-24 19:29 drivers/slusb.ko
marv@marvdesk:/usr/src/modules/slmodem-2.9.11-20070813$ ls -l modem/slmodemd
-rwxr-xr-x 1 marv root 1304487 2007-09-24 19:29 modem/slmodemd
marv@marvdesk:/usr/src/modules/slmodem-2.9.11-20070813$ sudo make install
Password:
make -C modem all
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/modem'
make -C drivers KERNEL_DIR=/lib/modules/2.6.20-15-generic/build
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
cc -I/lib/modules/2.6.20-15-generic/build/include -o kernel-ver kernel-ver.c
make all KERNEL_VER=2.6.20-15-generic
make[2]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make modules -C /lib/modules/2.6.20-15-generic/build
SUBDIRS=/usr/src/modules/slmodem-2.9.11-20070813/drivers
make[3]: Entering directory `/usr/src/linux-headers-2.6.20-15-generic'
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: modpost: GPL-incompatible module slusb.ko uses future
GPL-only symbol 'usb_deregister'
WARNING: modpost: GPL-incompatible module slusb.ko uses future
GPL-only symbol 'usb_register_driver'
make[3]: Leaving directory `/usr/src/linux-headers-2.6.20-15-generic'
make[2]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make install -C drivers KERNEL_DIR=/lib/modules/2.6.20-15-generic/build
make[1]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
cc -I/lib/modules/2.6.20-15-generic/build/include -o kernel-ver kernel-ver.c
mkdir -p /dev
mknod -m 600 /dev/slamr0 c 242 0 ;   mknod -m 600 /dev/slamr1 c 242 1
;   mknod -m 600 /dev/slamr2 c 242 2 ;   mknod -m 600 /dev/slamr3 c
242 3 ;  echo -n
mknod: `/dev/slamr0': File exists
mknod -m 600 /dev/slusb0 c 243 0 ;   mknod -m 600 /dev/slusb1 c 243 1
;   mknod -m 600 /dev/slusb2 c 243 2 ;   mknod -m 600 /dev/slusb3 c
243 3 ;  echo -n
make install KERNEL_VER=2.6.20-15-generic
make[2]: Entering directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
install -D -m 644 slusb.ko /lib/modules/2.6.20-15-generic/extra/slusb.ko
/sbin/depmod -a
make[2]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
make[1]: Leaving directory `/usr/src/modules/slmodem-2.9.11-20070813/drivers'
install -D -m 755 modem/slmodemd /usr/sbin/slmodemd
rm -f -rf /var/lib/slmodem
install -d -D -m 755 /var/lib/slmodem

With installation to:
$ ls -l /lib/modules/`uname -r`/extra
-rw-r--r-- 1 root root 177444 2007-09-24 19:33 slusb.ko

$ ls -l /usr/sbin/slmodemd-rwxr-xr-x 1 root root 1304487 2007-09-24
19:34 /usr/sbin/slmodemd

If is instructive to watch kernel messages with:
$ tail -f /var/log/messages &
Enter returns the COMMAND prompt while tail runs in the background

Intially the driver is not loaded:
$ lsmod | grep lsusb

Attaching a Smartlink chipset USB modem produces:

marv@marvdesk:~$ Sep 24 19:45:05 marvdesk kernel: [ 3015.960000] usb
1-8: new full speed USB device using ohci_hcd and address 3
Sep 24 19:45:05 marvdesk kernel: [ 3016.164000] usb 1-8: configuration
#1 chosen from 1 choice
Sep 24 19:45:05 marvdesk kernel: [ 3016.276000] slusb: module license
'Smart Link Ltd.' taints kernel.
Sep 24 19:45:05 marvdesk kernel: [ 3016.276000] Symbol
usb_register_driver is being used by a non-GPL module, which will not
be allowed in the future
Sep 24 19:45:05 marvdesk kernel: [ 3016.276000] Please see the file
Documentation/feature-removal-schedule.txt in the kernel source tree
for more details.
Sep 24 19:45:05 marvdesk kernel: [ 3016.276000] Symbol usb_deregister
is being used by a non-GPL module, which will not be allowed in the
future
Sep 24 19:45:05 marvdesk kernel: [ 3016.276000] Please see the file
Documentation/feature-removal-schedule.txt in the kernel source tree
for more details.
Sep 24 19:45:05 marvdesk kernel: [ 3016.284000] ST7554 USB Modem.
Sep 24 19:45:06 marvdesk kernel: [ 3016.336000] <6>slusb: slusb0 is found.
Sep 24 19:45:06 marvdesk kernel: [ 3016.336000] usbcore: registered
new interface driver ST7554 USB Modem

and needed drivers autoload
marv@marvdesk:~$ lsmod | grep slusb
slusb                  18276  0
usbcore               134280  6 slusb,usb_storage,libusual,ehci_hcd,ohci_hcd

The earlier "make install" created:
$ ls -l /dev/slusb0
crw------- 1 root root 243, 0 2007-09-24 19:33 /dev/slusb0
This port in RAM will disappear upon reboot.  On some systems it will
be created anyway upon slusb.ko  loading.  But it can be created
manually with:
$ sudo mknod -m 600 /dev/slusb0  c   243   0

A couple of elementary slmodem commands are:
$ slmodemd --help
$ slmodemd --countrylist

Before activating the modem with:
$ sudo slmodemd -c USA  /dev/slusb0
SmartLink Soft Modem: version 2.9.11 Sep 24 2007 19:29:45
symbolic link `/dev/ttySL0' -> `/dev/pts/2' created.
modem `slusb0' created. TTY is `/dev/pts/2'
Use `/dev/ttySL0' as modem device, Ctrl+C for termination.

Leave it running and open another TAB or console and probe the modem.
The normal target is /etc/wvdial.conf  , but you might instead want to
use wvtest
to avoid over writing an existing wvdial.conf
=====
$ sudo wvdialconf  /etc/wvdial.conf

Password:
Editing `/etc/wvdial.conf

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S1   S2   S3
WvModem<*1>: Cannot get information for serial port.
ttySL0<*1>: ATQ0 V1 E1 -- OK
ttySL0<*1>: ATQ0 V1 E1 Z -- OK
ttySL0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttySL0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttySL0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttySL0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttySL0<*1>: Modem Identifier: ATI -- SmartLink Soft Modem
ttySL0<*1>: Speed 4800: AT -- OK
ttySL0<*1>: Speed 9600: AT -- OK
ttySL0<*1>: Speed 19200: AT -- OK
ttySL0<*1>: Speed 38400: AT -- OK
ttySL0<*1>: Speed 57600: AT -- OK
ttySL0<*1>: Speed 115200: AT -- OK
ttySL0<*1>: Speed 230400: AT -- OK
ttySL0<*1>: Speed 460800: AT -- OK
ttySL0<*1>: Max speed is 460800; that should be safe.
ttySL0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found a modem on /dev/ttySL0.
wvtest<Warn>: Can't open 'wvtest' for reading: No such file or directory
wvtest<Warn>: ...starting with blank configuration.
Modem configuration written to wvtest.
ttySL0<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
=======

With
$ sudo gedit  /etc/wvdial.conf
Edit  to produce a final /etc/wvdial.conf  like:

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = Target_Phone_Number
ISDN = 0
Username = Your_Login_Name
Init1 = ATZ
 Password = Your_Password
Modem = /dev/ttySL0
Baud = 460800
# needed for  /dev/pts/N  ports:
Carrier  Check  = mp

Then Save and dial out with:
$ sudo wvdial

[Index of Archives]     [Linux Media Development]     [Asterisk]     [DCCP]     [Netdev]     [X.org]     [Xfree86]     [Fedora Women]     [Linux USB]

  Powered by Linux