个人工具

“UbuntuHelp:UsbAdslModem/e-techV2”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的7个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/UsbAdslModem/e-techV2}}
 
{{From|https://help.ubuntu.com/community/UsbAdslModem/e-techV2}}
 
{{Languages|UbuntuHelp:UsbAdslModem/e-techV2}}
 
{{Languages|UbuntuHelp:UsbAdslModem/e-techV2}}
 +
<<Include(Tag/StyleCleanup)>>
 
This howto will help you to set up a e-tech V2 ADSL USB modem.
 
This howto will help you to set up a e-tech V2 ADSL USB modem.
 
===== Step 1 - drivers for the USB modem =====
 
===== Step 1 - drivers for the USB modem =====
====== Item 1.1: obtain firmware for the modem ======
 
 
Most USB modems contain a microprocessor (a 'simple' computer), which is programmable and therefore can do many different things, so it is sold a lot and can be cheap. The cxacru driver included in Ubuntu (since Ubuntu 6.x) will try to 'upload' a small program to the modem, allowing the microprocessor to do the 'modem-work'. This small program (called '''firmware''') is often licensed.  
 
Most USB modems contain a microprocessor (a 'simple' computer), which is programmable and therefore can do many different things, so it is sold a lot and can be cheap. The cxacru driver included in Ubuntu (since Ubuntu 6.x) will try to 'upload' a small program to the modem, allowing the microprocessor to do the 'modem-work'. This small program (called '''firmware''') is often licensed.  
 +
====== Item 1.1: obtain firmware for the modem ======
 
The drivers in Ubuntu do not contain this firmware (otherwise it would be illegal), but you probably got a CD along with the modem. One of the files of this CD contains the firmware. If you have the modem working for Windows, the firmware is in the Windows partition. So you already have a legal copy of the firmware, the only problem is finding the firmware. The sourceforge site gives you some intsructions. I have found a programm called cxacru-fw.c (I lost the URL name, the code is in Annex 1 at the end of this article). After compiling cxacru-fw.c (the URL gives you clear instructions), cxacru-fw can extract the firmware from a file called CnxEtU.sys on the modem CD, or the Windows partition. Make sure that you name the firmware file ''cxacru-fw.bin''
 
The drivers in Ubuntu do not contain this firmware (otherwise it would be illegal), but you probably got a CD along with the modem. One of the files of this CD contains the firmware. If you have the modem working for Windows, the firmware is in the Windows partition. So you already have a legal copy of the firmware, the only problem is finding the firmware. The sourceforge site gives you some intsructions. I have found a programm called cxacru-fw.c (I lost the URL name, the code is in Annex 1 at the end of this article). After compiling cxacru-fw.c (the URL gives you clear instructions), cxacru-fw can extract the firmware from a file called CnxEtU.sys on the modem CD, or the Windows partition. Make sure that you name the firmware file ''cxacru-fw.bin''
Check also [[UbuntuHelp:UsbAdslModem/AccessRunner]] on this issue.
+
Check also [[UbuntuHelp:UsbAdslModem/AccessRunner|UsbAdslModem/AccessRunner]] on this issue.
 +
====== Item 2.1: install the firmware and check whether it works ======
 
Place the file cxacru-fw.bin in:
 
Place the file cxacru-fw.bin in:
 
/lib/firmware  
 
/lib/firmware  
第19行: 第21行:
 
localhost kernel [4294769.585000] cxacru 1-1:1.0: ADSL line: up (384 Kib/s down | 128 Kib/s up)
 
localhost kernel [4294769.585000] cxacru 1-1:1.0: ADSL line: up (384 Kib/s down | 128 Kib/s up)
 
</nowiki></pre>
 
</nowiki></pre>
'''Item 1.1a: (optional):''' Initially I got errors:
+
Initially I got the following errors:
 
<pre><nowiki>
 
<pre><nowiki>
 
localhost kernel [4300944.253000] cxacru 1-1:1.0: firmware unavailable (hotplug configuration problem?)
 
localhost kernel [4300944.253000] cxacru 1-1:1.0: firmware unavailable (hotplug configuration problem?)
 
localhost kernel [4295543.593000] cxacru 1-1:1.0: poll status: error -5
 
localhost kernel [4295543.593000] cxacru 1-1:1.0: poll status: error -5
 
</nowiki></pre>
 
</nowiki></pre>
The 1. problem was I put the firmware in a wrong location.
+
The 1. problem (firmware unavailable) was that I had put the firmware in a wrong location.
The 2. problem may require newer firmware.
+
The 2. problem (poll status...) may require newer firmware - but the modem works nevertheless
In the current versions of Ubuntu the http://sourceforge.net/projects/accessrunner programs that actually upload the firmware to the modem are already included in the kernel. Older Ubuntu versions, (older than dapper drake) will not contain the drivers that upload the firmaware to the modem. See [[UbuntuHelp:InstallCxacruDriver]] on how to resolve that.
+
In the current versions of Ubuntu the http://sourceforge.net/projects/accessrunner programs that actually upload the firmware to the modem are already included in the kernel. Older Ubuntu versions, (older than dapper drake) will not contain the drivers that upload the firmaware to the modem. See [[UbuntuHelp:InstallCxacruDriver|InstallCxacruDriver]] on how to resolve that.
'''Note:''' this is Ubuntu specific - other Linux distributions use other locations.
+
'''Note:''' the location of the firmware is Ubuntu specific - other Linux distributions use other locations.
 
'''Note 2:''' the file cxacru-fw.bin is licensed, do not redistribute it.
 
'''Note 2:''' the file cxacru-fw.bin is licensed, do not redistribute it.
 
'''Note 3:''' the provider may assume that you logged in at the moment the firmware on the modem has connected to the network. This happens during linux startup. If you have to pay for the time being online, you have to dive in the details of cxacru to be able to logon and logoff at will.
 
'''Note 3:''' the provider may assume that you logged in at the moment the firmware on the modem has connected to the network. This happens during linux startup. If you have to pay for the time being online, you have to dive in the details of cxacru to be able to logon and logoff at will.
 
===== Step 2 - connect the modem to the ethernet 'talk' of Ubuntu =====
 
===== Step 2 - connect the modem to the ethernet 'talk' of Ubuntu =====
The modem is now connected to the provider by the telephone network (using the ADSL-splitter). It uses a communication mode called '''ATM''' (Asynchronous Transfer Mode). On the other hand, the operating system (Ubuntu) by default speaks a language called '''ethernet'''. To bridge the 'ethernet-talk' of Ubuntu to ATM, additional packages have to be installed.  
+
The modem is now connected to the provider computer. It uses a communication mode called '''ATM''' (Asynchronous Transfer Mode). On the other hand, the operating system (Ubuntu) by default speaks a language called '''ethernet'''. To bridge the 'ethernet-talk' of Ubuntu to ATM, additional packages have to be installed. This is called a bridge.
 
====== Item 2.1: Setting up the bridge ======
 
====== Item 2.1: Setting up the bridge ======
 
You will need:
 
You will need:
# the br2684ctl package (.deb file) for your installed ubuntu version (often i386), e.g. from
+
<ol><li>the br2684ctl package (.deb file) for your installed ubuntu version (often i386), e.g. from</li></ol>
 +
 
 
http://archive.ubuntu.com/ubuntu/pool/universe/b/br2684ctl/
 
http://archive.ubuntu.com/ubuntu/pool/universe/b/br2684ctl/
2. the libatm1 package (.deb file) for your installed ubuntu version (often i386), e.g. from  
+
<ol><li>the libatm1 package (.deb file) for your installed ubuntu version (often i386), e.g. from</li></ol>
 +
 
 
http://archive.ubuntu.com/ubuntu/pool/main/l/linux-atm/
 
http://archive.ubuntu.com/ubuntu/pool/main/l/linux-atm/
 
These can be installed by putting the .deb files on the desktop. Then double-click on the file. Synaptic will start and try to install the packages.
 
These can be installed by putting the .deb files on the desktop. Then double-click on the file. Synaptic will start and try to install the packages.
第46行: 第50行:
 
Remark further that more than one providers work through the same telecom-network, their datastreams are distuinguished by VPI.VCI codes.   
 
Remark further that more than one providers work through the same telecom-network, their datastreams are distuinguished by VPI.VCI codes.   
 
My provider:
 
My provider:
# uses LLC encapsualtion
+
<ol><li>uses LLC encapsualtion
# VPI.VCI code is 0.0.32
+
</li><li>VPI.VCI code is 0.0.32</li></ol>
 +
 
 
There is a nice list http://faq.eagle-usb.org/wakka.php?wiki=ListConfigADSL here for some countries. If you don't find there the VP/VC numbers for your country/provider then you should ask your provider.
 
There is a nice list http://faq.eagle-usb.org/wakka.php?wiki=ListConfigADSL here for some countries. If you don't find there the VP/VC numbers for your country/provider then you should ask your provider.
 
The syntax of the bridging command is the following :
 
The syntax of the bridging command is the following :
 
<pre><nowiki>
 
<pre><nowiki>
 
br2684ctl [-c n -e 0|1 -b 0|1 -s buf_size -a [itf].vpi.vci ]+
 
br2684ctl [-c n -e 0|1 -b 0|1 -s buf_size -a [itf].vpi.vci ]+
 +
 
-a [itf].vpi.vci : ATM PVC number, VPI and VCI. Mandatory
 
-a [itf].vpi.vci : ATM PVC number, VPI and VCI. Mandatory
 
-c n : BR2684 interface number such as nas0,
 
-c n : BR2684 interface number such as nas0,
第68行: 第74行:
 
====== Item 2.2: Login ======
 
====== Item 2.2: Login ======
 
Once the bridge is working, you have to login. Again this is provider specific. I have detected three alternative procedures:
 
Once the bridge is working, you have to login. Again this is provider specific. I have detected three alternative procedures:
# DHCP
+
<ol><li>DHCP
# PPPoA
+
</li><li>PPPoA
# PPPoE
+
</li><li>PPPoE</li></ol>
 +
 
 
For DHCP you typically do not have to give a username and password (I guess the provider recognises you through your telephone number). For both PPP procedures you will have to provide your username and pasword.
 
For DHCP you typically do not have to give a username and password (I guess the provider recognises you through your telephone number). For both PPP procedures you will have to provide your username and pasword.
 
====== DHCP ======
 
====== DHCP ======
第150行: 第157行:
 
<pre><nowiki>
 
<pre><nowiki>
 
/*****************************************************************************
 
/*****************************************************************************
*  cxacru-fw - utility to extract firmware for the USB ADSL modems based on
+
*  cxacru-fw - utility to extract firmware for the USB ADSL modems based on
* Conexant AccessRunner chipset, from the Conexant driver for
+
* Conexant AccessRunner chipset, from the Conexant driver for
* Windows(R)
+
* Windows(R)
*
+
*
*  Copyright (C) 2005 Roman Kagan (rkagan % mail ! ru)
+
*  Copyright (C) 2005 Roman Kagan (rkagan % mail ! ru)
*
+
*
*  This program is free software; you can redistribute it and/or modify
+
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
+
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
+
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
+
*  (at your option) any later version.
*
+
*
*  This program is distributed in the hope that it will be useful,
+
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
+
*  GNU General Public License for more details.
*
+
*
*  You should have received a copy of the GNU General Public License
+
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
+
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
+
*
****************************************************************************/
+
****************************************************************************/
 +
 
 
#include <stdio.h>
 
#include <stdio.h>
 
#include <fcntl.h>
 
#include <fcntl.h>
第181行: 第189行:
 
#include <endian.h>
 
#include <endian.h>
 
#include <byteswap.h>
 
#include <byteswap.h>
#if <u>BYTE_ORDER == </u>BIG_ENDIAN
+
 
 +
#if __BYTE_ORDER == __BIG_ENDIAN
 
static inline uint16_t le16_to_cpup(uint16_t *x) {return bswap_16(*x);}
 
static inline uint16_t le16_to_cpup(uint16_t *x) {return bswap_16(*x);}
 
static inline uint32_t le32_to_cpup(uint32_t *x) {return bswap_32(*x);}
 
static inline uint32_t le32_to_cpup(uint32_t *x) {return bswap_32(*x);}
第188行: 第197行:
 
static inline uint32_t le32_to_cpup(uint32_t *x) {return *x;}
 
static inline uint32_t le32_to_cpup(uint32_t *x) {return *x;}
 
#endif
 
#endif
 +
 
uint8_t *findfw(uint8_t *buf, int len, int *fwlen)
 
uint8_t *findfw(uint8_t *buf, int len, int *fwlen)
 
{
 
{
第196行: 第206行:
 
0x22, 0x00, 0x00, 0xeb, /* eb000022 bl 0x9c */
 
0x22, 0x00, 0x00, 0xeb, /* eb000022 bl 0x9c */
 
};
 
};
 +
 
const static uint8_t bpstart[] = {
 
const static uint8_t bpstart[] = {
 
0x78, 0x20, 0x9f, 0xe5, /* e59f2078 ldr r2, [pc, #0x78] */
 
0x78, 0x20, 0x9f, 0xe5, /* e59f2078 ldr r2, [pc, #0x78] */
第202行: 第213行:
 
0x70, 0x20, 0x9f, 0xe5, /* e59f2070 ldr r2, [pc, #0x70] */
 
0x70, 0x20, 0x9f, 0xe5, /* e59f2070 ldr r2, [pc, #0x70] */
 
};
 
};
 +
 
uint8_t *fw, *bp, *nt_header, *sect_header;
 
uint8_t *fw, *bp, *nt_header, *sect_header;
 
uint32_t tmp;
 
uint32_t tmp;
 
uint16_t nsect;
 
uint16_t nsect;
 
uint32_t dataoff, datalen;
 
uint32_t dataoff, datalen;
 +
 
*fwlen = 0;
 
*fwlen = 0;
 +
 
/* IMAGE_DOS_HEADER size and .Signature */
 
/* IMAGE_DOS_HEADER size and .Signature */
 
if (len < 0x40 || memcmp(buf, "MZ", 2)) {
 
if (len < 0x40 || memcmp(buf, "MZ", 2)) {
第212行: 第226行:
 
return NULL;
 
return NULL;
 
}
 
}
 +
 
/* IMAGE_NT_HEADERS size and .Signature */
 
/* IMAGE_NT_HEADERS size and .Signature */
 
tmp = le32_to_cpup((uint32_t *) (buf + 0x3c));
 
tmp = le32_to_cpup((uint32_t *) (buf + 0x3c));
第219行: 第234行:
 
return NULL;
 
return NULL;
 
}
 
}
 +
 
/* IMAGE_NT_HEADERS.FileHeader.NumberOfSections */
 
/* IMAGE_NT_HEADERS.FileHeader.NumberOfSections */
 
nsect = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x2));
 
nsect = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x2));
 +
 
/* IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader */
 
/* IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader */
 
tmp = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x10));
 
tmp = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x10));
 
sect_header = nt_header + 0x18 + tmp;
 
sect_header = nt_header + 0x18 + tmp;
 +
 
for (; nsect; nsect--, sect_header += 0x28) {
 
for (; nsect; nsect--, sect_header += 0x28) {
 
if (sect_header + 0x28 > buf + len) {
 
if (sect_header + 0x28 > buf + len) {
第229行: 第247行:
 
return NULL;
 
return NULL;
 
}
 
}
 +
 
if (!memcmp(sect_header, ".data", 5))
 
if (!memcmp(sect_header, ".data", 5))
 
break;
 
break;
 
}
 
}
 +
 
if (!nsect) {
 
if (!nsect) {
 
error(0, 0, "`.data' section not found");
 
error(0, 0, "`.data' section not found");
 
return NULL;
 
return NULL;
 
}
 
}
 +
 
/* IMAGE_SECTION_HEADER.SizeOfRawData */
 
/* IMAGE_SECTION_HEADER.SizeOfRawData */
 
datalen = le32_to_cpup((uint32_t *) (sect_header + 0x10));
 
datalen = le32_to_cpup((uint32_t *) (sect_header + 0x10));
第244行: 第265行:
 
return NULL;
 
return NULL;
 
}
 
}
 +
 
/* find the starting sequence of the firmware image */
 
/* find the starting sequence of the firmware image */
 
fw = (uint8_t *) memmem(buf + dataoff, datalen, fwstart, sizeof(fwstart));
 
fw = (uint8_t *) memmem(buf + dataoff, datalen, fwstart, sizeof(fwstart));
第251行: 第273行:
 
}
 
}
 
*fwlen = datalen - (fw - (buf + dataoff));
 
*fwlen = datalen - (fw - (buf + dataoff));
 +
 
/* find the starting sequence of the boot ROM patch, if present */
 
/* find the starting sequence of the boot ROM patch, if present */
 
bp = (uint8_t *) memmem(fw, *fwlen, bpstart, sizeof(bpstart));
 
bp = (uint8_t *) memmem(fw, *fwlen, bpstart, sizeof(bpstart));
第257行: 第280行:
 
return fw;
 
return fw;
 
}
 
}
 +
 
const char * argp_program_version = "002";
 
const char * argp_program_version = "002";
 
const char * argp_program_bug_address =
 
const char * argp_program_bug_address =
第265行: 第289行:
 
"INFILE - Windows driver file containing firmware (usually CnxEtU.sys)\n"
 
"INFILE - Windows driver file containing firmware (usually CnxEtU.sys)\n"
 
"OUTFILE - firmware image (usually cxacru-fw.bin)";
 
"OUTFILE - firmware image (usually cxacru-fw.bin)";
 +
 
struct args {
 
struct args {
 
char *infile;
 
char *infile;
 
char *outfile;
 
char *outfile;
 
};
 
};
 +
 
static error_t parse_opts(int key, char *arg, struct argp_state *state)
 
static error_t parse_opts(int key, char *arg, struct argp_state *state)
 
{
 
{
第285行: 第311行:
 
}
 
}
 
break;
 
break;
 +
 
case ARGP_KEY_END:
 
case ARGP_KEY_END:
 
if (state->arg_num < 2)
 
if (state->arg_num < 2)
 
argp_usage (state);
 
argp_usage (state);
 
break;
 
break;
 +
 
default:
 
default:
 
return ARGP_ERR_UNKNOWN;
 
return ARGP_ERR_UNKNOWN;
第294行: 第322行:
 
return 0;
 
return 0;
 
}
 
}
 +
 
static struct argp argp = {0, parse_opts, args_doc, doc};
 
static struct argp argp = {0, parse_opts, args_doc, doc};
 +
 
int main(int argc, char **argv)
 
int main(int argc, char **argv)
 
{
 
{
第302行: 第332行:
 
uint8_t *buf, *fw;
 
uint8_t *buf, *fw;
 
int len, fwlen;
 
int len, fwlen;
 +
 
argp_parse(&argp, argc, argv, 0, NULL, &args);
 
argp_parse(&argp, argc, argv, 0, NULL, &args);
 +
 
fd = open(args.infile, O_RDONLY);
 
fd = open(args.infile, O_RDONLY);
 
if (fd < 0)
 
if (fd < 0)
 
error(1, errno, "failed to open `%s' for reading", args.infile);
 
error(1, errno, "failed to open `%s' for reading", args.infile);
 +
 
ret = fstat(fd, &instat);
 
ret = fstat(fd, &instat);
 
if (ret)
 
if (ret)
 
error(1, errno, "failed to obtain the size of `%s'", args.infile);
 
error(1, errno, "failed to obtain the size of `%s'", args.infile);
 
len = instat.st_size;
 
len = instat.st_size;
 +
 
buf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
 
buf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
 
close(fd);
 
close(fd);
 
if (!buf)
 
if (!buf)
 
error(1, errno, "failed to mmap `%s'", args.infile);
 
error(1, errno, "failed to mmap `%s'", args.infile);
 +
 
fw = findfw(buf, len, &fwlen);
 
fw = findfw(buf, len, &fwlen);
 
if (!fw)
 
if (!fw)
 
error(1, 0, "can't find AccessRunner firmware in `%s'", args.infile);
 
error(1, 0, "can't find AccessRunner firmware in `%s'", args.infile);
 +
 
fd = open(args.outfile, O_WRONLY | O_CREAT | O_EXCL,
 
fd = open(args.outfile, O_WRONLY | O_CREAT | O_EXCL,
 
  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
 
  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
 
if (fd < 0)
 
if (fd < 0)
 
error(1, errno, "failed to open `%s' for writing", args.outfile);
 
error(1, errno, "failed to open `%s' for writing", args.outfile);
 +
 
if (write(fd, fw, fwlen) != fwlen)
 
if (write(fd, fw, fwlen) != fwlen)
 
error(1, errno, "failed to write firmware to `%s'", args.outfile);
 
error(1, errno, "failed to write firmware to `%s'", args.outfile);
 
close(fd);
 
close(fd);
 +
 
munmap(buf, len);
 
munmap(buf, len);
 
printf("found firmware in `%s' at offset %#x\n", args.infile, fw - buf);
 
printf("found firmware in `%s' at offset %#x\n", args.infile, fw - buf);
第329行: 第367行:
 
</nowiki></pre>
 
</nowiki></pre>
 
----
 
----
[[category:CategoryDocumentation]] [[category:CategoryNetworking]] [[category:CategoryCleanup]]
+
[[category:CategoryNetworking]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月20日 (四) 00:42的最新版本


<<Include(Tag/StyleCleanup)>> This howto will help you to set up a e-tech V2 ADSL USB modem.

Step 1 - drivers for the USB modem

Most USB modems contain a microprocessor (a 'simple' computer), which is programmable and therefore can do many different things, so it is sold a lot and can be cheap. The cxacru driver included in Ubuntu (since Ubuntu 6.x) will try to 'upload' a small program to the modem, allowing the microprocessor to do the 'modem-work'. This small program (called firmware) is often licensed.

Item 1.1: obtain firmware for the modem

The drivers in Ubuntu do not contain this firmware (otherwise it would be illegal), but you probably got a CD along with the modem. One of the files of this CD contains the firmware. If you have the modem working for Windows, the firmware is in the Windows partition. So you already have a legal copy of the firmware, the only problem is finding the firmware. The sourceforge site gives you some intsructions. I have found a programm called cxacru-fw.c (I lost the URL name, the code is in Annex 1 at the end of this article). After compiling cxacru-fw.c (the URL gives you clear instructions), cxacru-fw can extract the firmware from a file called CnxEtU.sys on the modem CD, or the Windows partition. Make sure that you name the firmware file cxacru-fw.bin Check also UsbAdslModem/AccessRunner on this issue.

Item 2.1: install the firmware and check whether it works

Place the file cxacru-fw.bin in: /lib/firmware Once the cxacru-fw.bin file is in the adquate directory, and the modem is connected, the system log will report that a connection has been set up. You can check this by opening a terminal and issue the following command:

dmesg | egrep -e 'cxacru|ADSL'

If everything went well you see:

localhost kernel [4294759.585000] cxacru 1-1:1.0: ADSL line: training
localhost kernel [4294764.599000] cxacru 1-1:1.0: ADSL line: channel analysis
localhost kernel [4294769.585000] cxacru 1-1:1.0: ADSL line: up (384 Kib/s down | 128 Kib/s up)

Initially I got the following errors:

localhost kernel [4300944.253000] cxacru 1-1:1.0: firmware unavailable (hotplug configuration problem?)
localhost kernel [4295543.593000] cxacru 1-1:1.0: poll status: error -5

The 1. problem (firmware unavailable) was that I had put the firmware in a wrong location. The 2. problem (poll status...) may require newer firmware - but the modem works nevertheless In the current versions of Ubuntu the http://sourceforge.net/projects/accessrunner programs that actually upload the firmware to the modem are already included in the kernel. Older Ubuntu versions, (older than dapper drake) will not contain the drivers that upload the firmaware to the modem. See InstallCxacruDriver on how to resolve that. Note: the location of the firmware is Ubuntu specific - other Linux distributions use other locations. Note 2: the file cxacru-fw.bin is licensed, do not redistribute it. Note 3: the provider may assume that you logged in at the moment the firmware on the modem has connected to the network. This happens during linux startup. If you have to pay for the time being online, you have to dive in the details of cxacru to be able to logon and logoff at will.

Step 2 - connect the modem to the ethernet 'talk' of Ubuntu

The modem is now connected to the provider computer. It uses a communication mode called ATM (Asynchronous Transfer Mode). On the other hand, the operating system (Ubuntu) by default speaks a language called ethernet. To bridge the 'ethernet-talk' of Ubuntu to ATM, additional packages have to be installed. This is called a bridge.

Item 2.1: Setting up the bridge

You will need:

  1. the br2684ctl package (.deb file) for your installed ubuntu version (often i386), e.g. from

http://archive.ubuntu.com/ubuntu/pool/universe/b/br2684ctl/

  1. the libatm1 package (.deb file) for your installed ubuntu version (often i386), e.g. from

http://archive.ubuntu.com/ubuntu/pool/main/l/linux-atm/ These can be installed by putting the .deb files on the desktop. Then double-click on the file. Synaptic will start and try to install the packages. To start the 'bridge' between the ATM modem and Ubuntu type in a terminal:

sudo modprobe br2684

There are various 'languages' that can be used to communicate through ATM, with names like 'AAL type 5'. Specific AAL5 dialects (encapsulation protocols) exist, such as LLC and VC-MUX. Remark further that more than one providers work through the same telecom-network, their datastreams are distuinguished by VPI.VCI codes. My provider:

  1. uses LLC encapsualtion
  2. VPI.VCI code is 0.0.32

There is a nice list http://faq.eagle-usb.org/wakka.php?wiki=ListConfigADSL here for some countries. If you don't find there the VP/VC numbers for your country/provider then you should ask your provider. The syntax of the bridging command is the following :

br2684ctl [-c n -e 0|1 -b 0|1 -s buf_size -a [itf].vpi.vci ]+

-a [itf].vpi.vci : ATM PVC number, VPI and VCI. Mandatory
-c n : BR2684 interface number such as nas0,
nas1,... Mandatory
-e 0|1 : Encapsulation method. 0=LLC, 1=VC mux.
default is 0, LLC
-b 0|1 : Running background. 1=background,
0=foreground. Default is 0
-s buf_size : send buffer size. Default is 8192.

In my case the interface is created by:

sudo br2684ctl -b -e 0 -c 0 -a 0.0.32

Now an interface called nas0 is created. This interface can be pictured as a software version of an ethernetcard in the PC.

Item 2.2: Login

Once the bridge is working, you have to login. Again this is provider specific. I have detected three alternative procedures:

  1. DHCP
  2. PPPoA
  3. PPPoE

For DHCP you typically do not have to give a username and password (I guess the provider recognises you through your telephone number). For both PPP procedures you will have to provide your username and pasword.

DHCP

If you use DHCP to login (this is used when you don't have to provide a password for connecting), use the dhcpclient command (in other linux distribution sthis is dhcpcd):

sudo dhclient nas0

It worked for me, although I always get a few warning-messages at the end)

sit0: unknown hardware address type 776
sit0: unknown hardware address type 776
Listening on LPF/nas0/00:d0:41:10:21:dc
Sending on   LPF/nas0/00:d0:41:10:21:dc
Sending on   Socket/fallback
DHCPREQUEST on nas0 to 255.255.255.255 port 67
DHCPACK from 82.172.112.1
bound to 82.172.112.235 -- renewal in 3125 seconds.
PPPoE

Follow the instructions on https://help.ubuntu.com/community/ADSLPPPoE Note: Since I use DHCP, I could not test this.

PPPoA

Since I use DHCP, I could not test this. For your convenience, I copied this from another website. I gues it will not work for Ubuntu without modifications. Check the other USBADSL modems referred to in this WIKI!! if PPPoA , download from http://accessrunner.sourceforge.net/debian-scripts/ the peers-pppoa and put it in /etc/ppp/peers, edit that file especially the user and the VPC/VCI peers. Add also your login password in the /etc/ppp/pap-secrets /etc/ppp/chap-secrets in the form login * password *

insmod /lib/modules/2.6.10-5-386/kernel/net/atm/pppoatm.ko
pppd call peers-pppoa

if PPPoE Install apt-get install libatm1 also you ll need to download 2 package from the ubuntu br2684ctl_20040226-1_i386.deb atm-tools_2.4.1-16_i386.deb ( I m not sure if that one needed) then install them with the command dpkg -i xxxxxfilexxxxx.deb download from http://accessrunner.sourceforge.net/debian-scripts/ the peers-pppoe and put it in /etc/ppp/peers, edit that file especially the user. Add also your login password in the /etc/ppp/pap-secrets /etc/ppp/chap-secrets in the form login * password * after that modify the /etc/network/interfaces and add : auto nas0 iface nas0 inet static address 192.0.2.1 netmask 255.255.255.0 broadcast 192.0.2.255 0x0x gateway 192.0.2.254 pre-up br2684ctl -b -c 0 -a 0.0.100 post-down kill $(cat /var/run/$IFACE.pid) (the 0.0.100 is the form itf.vpi.vci you should set vpi/vci accordingly to what you have see your ISP for this infos.) Restart the network to get the nas0 match the atm interface insmod /lib/modules/2.6.10-5-386/kernel/net/atm/br2684.ko /etc/init.d/networking restart And finally connect pppd call peers-pppoe I m sorry it s a bit hard and maybe not well organized but it should give you a better idea of what you need to do.

Automated bridge and login

With the procedures above the login is manually. If it works the procedure can be automated. Presently I have a small executable text-file on my desktop:

#
sudo modprobe br2684
sudo br2684ctl -b -c 0 -a 0.0.32
sudo dhclient nas0
sleep 5d

If the connection is successfull the terminal window can be closed by typing Ctrl-C. Note: the provider may assume that you logged in at the moment the firmware on the modem has connected to the network. This happens during linux startup. If you have to pay for the time being online, you have to dive in the details of cxacru to be able to logon and logoff at will. Actually, the commands modprobe ..., br2684ctl .. and dhclient or ppp... can be executed during linux startup. I haven't tried it (yet), but you can check the site: http://www.dse.nl/~torch/usb_adsl_modem/cxacru_auto.html (in Dutch)

Annex 1 - code of cxacru-fw.c

/*****************************************************************************
 *  cxacru-fw -	utility to extract firmware for the USB ADSL modems based on
 *		Conexant AccessRunner chipset, from the Conexant driver for
 *		Windows(R)
 *
 *  Copyright (C) 2005	Roman Kagan (rkagan % mail ! ru)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 ****************************************************************************/

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <error.h>
#include <argp.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <endian.h>
#include <byteswap.h>

#if __BYTE_ORDER == __BIG_ENDIAN
static inline uint16_t le16_to_cpup(uint16_t *x) {return bswap_16(*x);}
static inline uint32_t le32_to_cpup(uint32_t *x) {return bswap_32(*x);}
#else
static inline uint16_t le16_to_cpup(uint16_t *x) {return *x;}
static inline uint32_t le32_to_cpup(uint32_t *x) {return *x;}
#endif

uint8_t *findfw(uint8_t *buf, int len, int *fwlen)
{
	const static uint8_t fwstart[] = {	/*		ARM LE asm				*/
		0x1c, 0x24, 0x9f, 0xe5,		/*	e59f241c	ldr	r2, [pc, #0x41c]	*/
		0x00, 0x10, 0xa0, 0xe3,		/*	e3a01000	mov	r1, #0x0		*/
		0x00, 0x10, 0x82, 0xe5,		/*	e5821000	str	r1, [r2]		*/
		0x22, 0x00, 0x00, 0xeb,		/*	eb000022	bl	0x9c			*/
	};

	const static uint8_t bpstart[] = {
		0x78, 0x20, 0x9f, 0xe5,		/*	e59f2078	ldr	r2, [pc, #0x78]	*/
		0x01, 0x10, 0xa0, 0xe3,		/*	e3a01001	mov	r1, #0x1	*/
		0x00, 0x10, 0x82, 0xe5,		/*	e5821000	str	r1, [r2]		*/
		0x70, 0x20, 0x9f, 0xe5,		/*	e59f2070	ldr	r2, [pc, #0x70]	*/
	};

	uint8_t *fw, *bp, *nt_header, *sect_header;
	uint32_t tmp;
	uint16_t nsect;
	uint32_t dataoff, datalen;

	*fwlen = 0;

	/* IMAGE_DOS_HEADER size and .Signature */
	if (len < 0x40 || memcmp(buf, "MZ", 2)) {
		error(0, 0, "file is not a DOS executable");
		return NULL;
	}

	/* IMAGE_NT_HEADERS size and .Signature */
	tmp = le32_to_cpup((uint32_t *) (buf + 0x3c));
	nt_header = buf + tmp;
	if (len < tmp + 0x18 || memcmp(nt_header, "PE\0\0", 4)) {
		error(0, 0, "file is not a portable executable (PE)");
		return NULL;
	}

	/* IMAGE_NT_HEADERS.FileHeader.NumberOfSections */
	nsect = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x2));

	/* IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader */
	tmp = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x10));
	sect_header = nt_header + 0x18 + tmp;

	for (; nsect; nsect--, sect_header += 0x28) {
		if (sect_header + 0x28 > buf + len) {
			error(0, 0, "file header corrupted");
			return NULL;
		}

		if (!memcmp(sect_header, ".data", 5))
			break;
	}

	if (!nsect) {
		error(0, 0, "`.data' section not found");
		return NULL;
	}

	/* IMAGE_SECTION_HEADER.SizeOfRawData */
	datalen = le32_to_cpup((uint32_t *) (sect_header + 0x10));
	/* IMAGE_SECTION_HEADER.PointerToRawData */
	dataoff = le32_to_cpup((uint32_t *) (sect_header + 0x14));
	if (dataoff + datalen > len) {
		error(0, 0, "`.data' section extends beyond end of file");
		return NULL;
	}

	/* find the starting sequence of the firmware image */
	fw = (uint8_t *) memmem(buf + dataoff, datalen, fwstart, sizeof(fwstart));
	if (!fw) {
		error(0, 0, "firmware start sequence not found");
		return NULL;
	}
	*fwlen = datalen - (fw - (buf + dataoff));

	/* find the starting sequence of the boot ROM patch, if present */
	bp = (uint8_t *) memmem(fw, *fwlen, bpstart, sizeof(bpstart));
	if (bp)
		*fwlen = bp - fw;
	return fw;
}

const char * argp_program_version = "002";
const char * argp_program_bug_address =
		"<accessrunner-general at lists dot sourceforge dot net>";
const static char args_doc[] = "INFILE OUTFILE";
const static char doc[] =
		"Firmware extractor for Conexant AccessRunner ADSL USB modems\n"
		"INFILE - Windows driver file containing firmware (usually CnxEtU.sys)\n"
		"OUTFILE - firmware image (usually cxacru-fw.bin)";

struct args {
	char *infile;
	char *outfile;
};

static error_t parse_opts(int key, char *arg, struct argp_state *state)
{
	struct args *args = state->input;
	switch (key) {
	case ARGP_KEY_ARG:
		switch (state->arg_num) {
		case 0:
			args->infile = arg;
			break;
		case 1:
			args->outfile = arg;
			break;
		default:
			argp_usage (state);
		}
		break;

	case ARGP_KEY_END:
		if (state->arg_num < 2)
			argp_usage (state);
		break;

	default:
		return ARGP_ERR_UNKNOWN;
	}
	return 0;
}

static struct argp argp = {0, parse_opts, args_doc, doc};

int main(int argc, char **argv)
{
	int ret, fd;
	struct args args;
	struct stat instat;
	uint8_t *buf, *fw;
	int len, fwlen;

	argp_parse(&argp, argc, argv, 0, NULL, &args);

	fd = open(args.infile, O_RDONLY);
	if (fd < 0)
		error(1, errno, "failed to open `%s' for reading", args.infile);

	ret = fstat(fd, &instat);
	if (ret)
		error(1, errno, "failed to obtain the size of `%s'", args.infile);
	len = instat.st_size;

	buf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
	close(fd);
	if (!buf)
		error(1, errno, "failed to mmap `%s'", args.infile);

	fw = findfw(buf, len, &fwlen);
	if (!fw)
		error(1, 0, "can't find AccessRunner firmware in `%s'", args.infile);

	fd = open(args.outfile, O_WRONLY | O_CREAT | O_EXCL,
		  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
	if (fd < 0)
		error(1, errno, "failed to open `%s' for writing", args.outfile);

	if (write(fd, fw, fwlen) != fwlen)
		error(1, errno, "failed to write firmware to `%s'", args.outfile);
	close(fd);

	munmap(buf, len);
	printf("found firmware in `%s' at offset %#x\n", args.infile, fw - buf);
}