Thursday, September 04, 2008

Getting Aztech UM-3100 USB Modem to work on CentOS 5

Our old Hylafax external modems decided to kick the bucket over the weekend, and it was an opportunity to refresh the hardware. They lasted a good 9 years (or more!) and I dont think they make them anymore.

Additionally they had to be powered by large adaptors, which took up way too much room. So a good solution would be to use some USB modems; small, cheap, USB powered and easily replaceable.

We chose Aztech UM-3100 USB Modem. Relatively cheap at about RM70, we thought it would be a great solution. So I plugged it into the machine, and this was the dmesg output:

usb 1-2: new full speed USB device using uhci_hcd and address 2
usb 1-2: device descriptor read/64, error -71
usb 1-2: device descriptor read/64, error -71
usb 1-2: new full speed USB device using uhci_hcd and address 3
usb 1-2: device descriptor read/64, error -71
usb 1-2: device descriptor read/64, error -71
usb 1-2: new full speed USB device using uhci_hcd and address 4
usb 1-2: device not accepting address 4, error -71
usb 1-2: new full speed USB device using uhci_hcd and address 5
usb 1-2: configuration #1 chosen from 2 choices
drivers/usb/class/cdc-acm.c: Zero length descriptor references

cdc_acm: probe of 1-2:1.0 failed with error -22
usbcore: registered new driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters


So not very good news to start off the day. This usb-modem isn't supported out of the box, fortunately it isn't too much a problem, but it does require a recompilation of the cdc-acm (USB Communication Device Class definition - Abstract Control Module). Here is a brief lowdown on how to get the Aztech modem recognised in CentOS 5.0.

Prepping the system for module compilation

First, we need to bring down the linux kernel source.

# wget -c ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/kernel-2.6.18-8.1.8.el5.src.rpm
Length: 48176889 (46M)
8% [==> ] 4,018,200 124.1K/s eta 7m 27s

It took only about 7 minutes to download. A "rpm -hiv" extracted the sources in /usr/src/redhat. You will then need to extract the source from redhats patches by doing this:

# rpmbuild -bp --target=$(uname -m) /usr/src/redhat/SPECS/kernel-2.6.spec

which should recreate the kernel source in /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686. Copy your config from the /boot directory to this directory

# cp /boot/config-`uname -r` ./.config

Now you are ready to compile the entire kernel ... if you want to. For me, I just want to compile the usb modem module, and not need to wait for the entire compilation process. But first, the modifications.

Adding support for the modem.

This ubuntu forum post "Shiro/Conexant (Rockwell) RD02-D400/Aztech UM3100 USB 56K Modem" provides the information to add support for the Aztech modem. First of all, we need to make sure that the ID as reported by lsusb is matches our modifications. To do so, type this:

# lsusb
Bus 001 Device 009: ID 0572:1328 Conexant Systems (Rockwell), Inc.


You will see that its 0x0572, 0x1328. This is what we will use in our modification. Modify the cdc-acm.c file:

# nano drivers/usb/class/cdc-acm.c

scroll down about 97%... put this in similar place, next to all the other devices
{ USB_DEVICE(0x0572, 0x1328), /* Aztech UM-3100 */
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
},
Save, and that's all with the source code modification. No big deal.

Compiling the specific module.

Instead of having to build the kernel and all the modules, we can tell 'make' to build from specific directories. First, you will have to compile some scripts which are used for MODPOST, which is important to make the .ko module files.

# make SUBDIRS=scripts/mod/
WARNING: Symbol version dump /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/Module.symvers
is missing; modules will have no dependencies and modversions.

CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
Building modules, stage 2.
MODPOST


Then you can actually build the modules which are of particular interest to you, in this case "drivers/usb/class"

# make SUBDIRS=drivers/usb/class modules
WARNING: Symbol version dump /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
MODPOST
CC drivers/usb/class/cdc-acm.mod.o
LD [M] drivers/usb/class/cdc-acm.ko
CC drivers/usb/class/usblp.mod.o
LD [M] drivers/usb/class/usblp.ko


The file which you need is drivers/usb/class/cdc-acm.ko so just copy this to the real modules directory of your running kernel.

# cp drivers/usb/class/cdc-acm.ko /lib/modules/2.6.18-8.el5/kernel/drivers/usb/class

Loading up the new module

Unload the module if it was loaded before:

# rmmod cdc_acm
ERROR: Module cdc_acm does not exist in /proc/modules


And load up the new one

# insmod cdc_acm

To check that its there:

# lsmod |grep cdc
cdc_acm 15136 0


And now, plug in the Aztech modem, and see what happens:

# dmesg
cdc_acm: no version for "struct_module" found: kernel tainted.
cdc_acm 1-2:1.0: ttyACM0: USB ACM device
usbcore: registered new driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters


Congratulations, it looks like its been recognised as ttyACM0

Testing the modem

Make sure you have the 'cu' utility installed. It usually comes in the 'uucp' package:
# yum install uucp
Once 'cu' is available, use '-l' to speak directly to the line.
# cu -l ttyACM0
Connected.
You can then reset the phone, and try to call out.
atz
OK
atdt9,012xxxxxxx
(9 is to get a dialtone from my PABX, and the comma is to wait).
Also test the modems ability to auto pickup after 1 ring with this command
ats0=1
However Hylafax controls the pickup process, so make sure this is not set. Reset the modem with this:
atz
And quit from 'cu' with this tilda command:
~.
Disconnected
Conclusion

Your Aztech modem should be recognised by the system even after a reboot (test it, its the only reboot you'll need to do). You can now plug in more USB modems to cater for your Fax server's needs.

yk.

5 lewsers:

Whirly said...

This same basic procedure works to get a Zoom Mini-USB 3095 modem working under CentOS 5. Thanks for posting!!! This saved me a bunch of time.

The only major difference for the Zoom modem is the device id block in the quirks section of the cdc-acm.c module source file. It would be:

{ USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
},

legendaryone said...

Good to know that someone finally gotten it to work but have you encountered any faxing issues on hylafax with this modem?

Tze-Howe said...

I'm using alternative DKMS procedure so that it's easier to deploy (IMO anyway).

To legendaryone: So far I'm only having 1 issue with this. I am unable to receive fax from Brother FAX-236S. Looking at the log file, it seems that there's problem training the modems.

To yk: Do you happen to have the same issue? Are you using the default configuration from HylaFAX faxaddmodem or do you customize from it? I'm unable to solve this issue yet.

Yoon Kit said...

TzeHowe: been running this without a problem, probably because I have two different types of faxmodems to receive the faxes, which is on a hunting line. So if one fails, the chances are, it will try the other line....


yk

Pang said...

What about in SUSE Enterprise Server 10? How is the step?
Please kindly provide!