diff mbox

zd1211rw on ppc (iBook G4) -- Solved, somewhat)

Message ID 3ace41890909132041w2d3f10b7r72e0eb855f1ab2a5@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Hin-Tak Leung Sept. 14, 2009, 3:41 a.m. UTC
On Sun, Sep 13, 2009 at 11:13 AM, Hin-Tak Leung <hintak.leung@gmail.com> wrote:
> On Sat, Sep 12, 2009 at 11:43 PM, Leonardo H. Souza Hamada
> <leonardo.hamada@ufra.edu.br> wrote:
>> Hi all,
>>
>> At this moment, after tweaking the zd1211rw code in kernel
>> 2.6.31-gentoo, finally I am able to use the WLI-U2-KG54L wireless usb
>> dongle on this old ibook.
>>
>> Browsing the source with a cross referencing tool
>> (http://lxr.free-electrons.com) and making additional checking points, I
>> could trace the issue as follow.
>>
>> The problem is that this device returns a regulatory region of 0x49,
>> which is not defined in the zd1211rw tables. So the call
>>
>> r <http://lxr.free-electrons.com/ident?i=r> = zd_reg2alpha2 <http://lxr.free-electrons.com/ident?i=zd_reg2alpha2>(mac <http://lxr.free-electrons.com/ident?i=mac>->regdomain, alpha2);
>>
>> will fail the initialization process.
>>
>>
>> Workaround:
>>
>> ----snip----
>> int zd_mac_init_hw(struct ieee80211_hw *hw)
>> {
>> ...
>>        r = zd_read_regdomain(chip, &default_regdomain);
>>        /* A unknown regulatory of 0x49 will be set default to
>> ZD_REGDOMAIN_FCC. */
>>        if (0x49 == default_regdomain)
>>                default_regdomain = ZD_REGDOMAIN_FCC;
>> ...
>> ----snip----
>>
>> The above code will force the default regulatry to be FCC code for this
>> case. I think that this was the case in previous zd1211rw driver. What
>> is the country code for 0x49 region? There is a better way?
>>
>>
>> Thanks all,
>>
>> Phew!! Leonardo
>
> The vendor driver has quite a lot more regdomain code defined, and
> 0x49 is apparently
>
> ZD_Region_Japan_3           = 0x49,//G channel->ch1-13; A channel->8~16,34~46;
>
> the rw driver code probably should set it to most restrictive than let
> it fail...
>

Can you give this patch a try against a recent
wireless-testing/compat-wireless? I think this is the correct way to
do things.

Here is the content of the patch for others who doesn't like
attachments - it just sets 0x49 as Japan.
============================================

Comments

Luis Rodriguez Sept. 14, 2009, 4:09 a.m. UTC | #1
On Sun, Sep 13, 2009 at 8:41 PM, Hin-Tak Leung <hintak.leung@gmail.com> wrote:
> On Sun, Sep 13, 2009 at 11:13 AM, Hin-Tak Leung <hintak.leung@gmail.com> wrote:
>> On Sat, Sep 12, 2009 at 11:43 PM, Leonardo H. Souza Hamada
>> <leonardo.hamada@ufra.edu.br> wrote:
>>> Hi all,
>>>
>>> At this moment, after tweaking the zd1211rw code in kernel
>>> 2.6.31-gentoo, finally I am able to use the WLI-U2-KG54L wireless usb
>>> dongle on this old ibook.
>>>
>>> Browsing the source with a cross referencing tool
>>> (http://lxr.free-electrons.com) and making additional checking points, I
>>> could trace the issue as follow.
>>>
>>> The problem is that this device returns a regulatory region of 0x49,
>>> which is not defined in the zd1211rw tables. So the call
>>>
>>> r <http://lxr.free-electrons.com/ident?i=r> = zd_reg2alpha2 <http://lxr.free-electrons.com/ident?i=zd_reg2alpha2>(mac <http://lxr.free-electrons.com/ident?i=mac>->regdomain, alpha2);
>>>
>>> will fail the initialization process.
>>>
>>>
>>> Workaround:
>>>
>>> ----snip----
>>> int zd_mac_init_hw(struct ieee80211_hw *hw)
>>> {
>>> ...
>>>        r = zd_read_regdomain(chip, &default_regdomain);
>>>        /* A unknown regulatory of 0x49 will be set default to
>>> ZD_REGDOMAIN_FCC. */
>>>        if (0x49 == default_regdomain)
>>>                default_regdomain = ZD_REGDOMAIN_FCC;
>>> ...
>>> ----snip----
>>>
>>> The above code will force the default regulatry to be FCC code for this
>>> case. I think that this was the case in previous zd1211rw driver. What
>>> is the country code for 0x49 region? There is a better way?
>>>
>>>
>>> Thanks all,
>>>
>>> Phew!! Leonardo
>>
>> The vendor driver has quite a lot more regdomain code defined, and
>> 0x49 is apparently
>>
>> ZD_Region_Japan_3           = 0x49,//G channel->ch1-13; A channel->8~16,34~46;
>>
>> the rw driver code probably should set it to most restrictive than let
>> it fail...
>>
>
> Can you give this patch a try against a recent
> wireless-testing/compat-wireless? I think this is the correct way to
> do things.
>
> Here is the content of the patch for others who doesn't like
> attachments - it just sets 0x49 as Japan.
> ==============================
> diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c
> b/drivers/net/wireless/zd1211rw/zd_mac.c
> index 6d66635..b0d32c4 100644
> --- a/drivers/net/wireless/zd1211rw/zd_mac.c
> +++ b/drivers/net/wireless/zd1211rw/zd_mac.c
> @@ -42,6 +42,7 @@ static struct zd_reg_alpha2_map reg_alpha2_map[] = {
>        { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */
>        { ZD_REGDOMAIN_JAPAN, "JP" },
>        { ZD_REGDOMAIN_JAPAN_ADD, "JP" },
> +       { ZD_REGDOMAIN_JAPAN_3, "JP" },
>        { ZD_REGDOMAIN_SPAIN, "ES" },
>        { ZD_REGDOMAIN_FRANCE, "FR" },
>  };
> diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h
> b/drivers/net/wireless/zd1211rw/zd_mac.h
> index 7c27591..9701935 100644
> --- a/drivers/net/wireless/zd1211rw/zd_mac.h
> +++ b/drivers/net/wireless/zd1211rw/zd_mac.h
> @@ -193,6 +193,7 @@ struct zd_mac {
>  #define ZD_REGDOMAIN_FRANCE    0x32
>  #define ZD_REGDOMAIN_JAPAN_ADD 0x40
>  #define ZD_REGDOMAIN_JAPAN     0x41
> +#define ZD_REGDOMAIN_JAPAN_3   0x49

FWIW, this does seem right.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leonardo H. Souza Hamada Sept. 14, 2009, 4:47 p.m. UTC | #2
Luis R. Rodriguez wrote:
> On Sun, Sep 13, 2009 at 8:41 PM, Hin-Tak Leung <hintak.leung@gmail.com> wrote:
>   
>> On Sun, Sep 13, 2009 at 11:13 AM, Hin-Tak Leung <hintak.leung@gmail.com> wrote:
>>     
>>> On Sat, Sep 12, 2009 at 11:43 PM, Leonardo H. Souza Hamada
>>> <leonardo.hamada@ufra.edu.br> wrote:
>>>       
>>>> Hi all,
>>>>
>>>> At this moment, after tweaking the zd1211rw code in kernel
>>>> 2.6.31-gentoo, finally I am able to use the WLI-U2-KG54L wireless usb
>>>> dongle on this old ibook.
>>>>
>>>> Browsing the source with a cross referencing tool
>>>> (http://lxr.free-electrons.com) and making additional checking points, I
>>>> could trace the issue as follow.
>>>>
>>>> The problem is that this device returns a regulatory region of 0x49,
>>>> which is not defined in the zd1211rw tables. So the call
>>>>
>>>> r <http://lxr.free-electrons.com/ident?i=r> = zd_reg2alpha2 <http://lxr.free-electrons.com/ident?i=zd_reg2alpha2>(mac <http://lxr.free-electrons.com/ident?i=mac>->regdomain, alpha2);
>>>>
>>>> will fail the initialization process.
>>>>
>>>>
>>>> Workaround:
>>>>
>>>> ----snip----
>>>> int zd_mac_init_hw(struct ieee80211_hw *hw)
>>>> {
>>>> ...
>>>>        r = zd_read_regdomain(chip, &default_regdomain);
>>>>        /* A unknown regulatory of 0x49 will be set default to
>>>> ZD_REGDOMAIN_FCC. */
>>>>        if (0x49 == default_regdomain)
>>>>                default_regdomain = ZD_REGDOMAIN_FCC;
>>>> ...
>>>> ----snip----
>>>>
>>>> The above code will force the default regulatry to be FCC code for this
>>>> case. I think that this was the case in previous zd1211rw driver. What
>>>> is the country code for 0x49 region? There is a better way?
>>>>
>>>>
>>>> Thanks all,
>>>>
>>>> Phew!! Leonardo
>>>>         
>>> The vendor driver has quite a lot more regdomain code defined, and
>>> 0x49 is apparently
>>>
>>> ZD_Region_Japan_3           = 0x49,//G channel->ch1-13; A channel->8~16,34~46;
>>>
>>> the rw driver code probably should set it to most restrictive than let
>>> it fail...
>>>
>>>       
>> Can you give this patch a try against a recent
>> wireless-testing/compat-wireless? I think this is the correct way to
>> do things.
>>
>> Here is the content of the patch for others who doesn't like
>> attachments - it just sets 0x49 as Japan.
>> ==============================
>> diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c
>> b/drivers/net/wireless/zd1211rw/zd_mac.c
>> index 6d66635..b0d32c4 100644
>> --- a/drivers/net/wireless/zd1211rw/zd_mac.c
>> +++ b/drivers/net/wireless/zd1211rw/zd_mac.c
>> @@ -42,6 +42,7 @@ static struct zd_reg_alpha2_map reg_alpha2_map[] = {
>>        { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */
>>        { ZD_REGDOMAIN_JAPAN, "JP" },
>>        { ZD_REGDOMAIN_JAPAN_ADD, "JP" },
>> +       { ZD_REGDOMAIN_JAPAN_3, "JP" },
>>        { ZD_REGDOMAIN_SPAIN, "ES" },
>>        { ZD_REGDOMAIN_FRANCE, "FR" },
>>  };
>> diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h
>> b/drivers/net/wireless/zd1211rw/zd_mac.h
>> index 7c27591..9701935 100644
>> --- a/drivers/net/wireless/zd1211rw/zd_mac.h
>> +++ b/drivers/net/wireless/zd1211rw/zd_mac.h
>> @@ -193,6 +193,7 @@ struct zd_mac {
>>  #define ZD_REGDOMAIN_FRANCE    0x32
>>  #define ZD_REGDOMAIN_JAPAN_ADD 0x40
>>  #define ZD_REGDOMAIN_JAPAN     0x41
>> +#define ZD_REGDOMAIN_JAPAN_3   0x49
>>     
>
> FWIW, this does seem right.
>
>   Luis
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   
*
Ok, got *compat-wireless-2.6.tar.bz2
<http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2>*
"bleeding edge compat-wireless" from* here:
http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2

Steps done, so so:

tar -xjf compat-wireless-2.6.tar.bz2
cd compat-wireless-2009-09-14/
cp -v ../zd1211rw_jp3.diff .
`../zd1211rw_jp3.diff' -> `./zd1211rw_jp3.diff'
patch -p1 < zd1211rw_jp3.diff
patching file drivers/net/wireless/zd1211rw/zd_mac.c
patching file drivers/net/wireless/zd1211rw/zd_mac.h
./scripts/driver-select zd1211rw
Processing new driver-select request...
Backing up makefile: Makefile.bk
Backing up makefile: drivers/net/wireless/Makefile.bk
Backing up makefile: net/wireless/Makefile.bk
Backing up makefile: drivers/ssb/Makefile.bk
Backing up makefile: drivers/net/usb/Makefile.bk
Backing up makefile: drivers/misc/eeprom/Makefile.bk

make
/home/leo/compat-wireless-2009-09-14/config.mk:17: *** "ERROR: you have
MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot
replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If
you are using Fedora upgrade your kernel as later version should this
set as modular. For further information on Fedora see
https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using
your own kernel recompile it and make mac80211 modular".  Pare.

<<<Disabling original zd1211rw in kernel configuration, recompiled
kernel as instructed above, installed new kernel, reboot, many times
until I got it right>>>


Results:

dmesg seems ok. no errors.

can do iwlist wlan0

iwconfig wlan0 shows:
IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated  
          Tx-Power=20 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off


I do not seem to be able to connect to a given access point so far. LED
does not blink.

It can be that there is a query on the new values against other. Just a
guess.


Regards,
Leonardo

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hin-Tak Leung Sept. 14, 2009, 9:11 p.m. UTC | #3
On Mon, Sep 14, 2009 at 5:47 PM, Leonardo H. Souza Hamada
<leonardo.hamada@ufra.edu.br> wrote:

> <<<Disabling original zd1211rw in kernel configuration, recompiled
> kernel as instructed above, installed new kernel, reboot, many times
> until I got it right>>>

The patch isn't particularly version-specific - may have applied to
the kernel source itself...

> Results:
>
> dmesg seems ok. no errors.

No, I want to see dmesg - there should be something similiar to this?

cfg80211: Calling CRDA for country: GB
cfg80211: Regulatory domain changed to country: GB
	(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
	(2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
	(5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm)
	(5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm)
	(5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 mBm)

> can do iwlist wlan0
>
> iwconfig wlan0 shows:
> IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated
>          Tx-Power=20 dBm
>          Retry  long limit:7   RTS thr:off   Fragment thr:off
>          Encryption key:off
>          Power Management:off
>
>
> I do not seem to be able to connect to a given access point so far. LED
> does not blink.

stay dark or stay lit?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hin-Tak Leung Sept. 15, 2009, 1:08 a.m. UTC | #4
(I'd prefer *not* to have one-on-one exchanges, so where appropriate
please CC: the list)

On Tue, Sep 15, 2009 at 12:30 AM, Leonardo Hamada
<leonardo.hamada@ufra.edu.br> wrote:
>
> Em Seg, Setembro 14, 2009 18:11, Hin-Tak Leung escreveu:
>> On Mon, Sep 14, 2009 at 5:47 PM, Leonardo H. Souza Hamada
>> <leonardo.hamada@ufra.edu.br> wrote:
>>
>>> <<<Disabling original zd1211rw in kernel configuration, recompiled
>>> kernel as instructed above, installed new kernel, reboot, many times
>>> until I got it right>>>
>>
>> The patch isn't particularly version-specific - may have applied to
>> the kernel source itself...
>
>
> No, the patch was applied to compat package. The script install what is
> necessary.

I meant the patch should have applied to the vanilla kernel source as
well, if you have gone to the trouble of recompiling the kernel to get
mac80211 as module. (i.e. don't bother with compat-wireless).

>
>
>>
>>> Results:
>>>
>>> dmesg seems ok. no errors.
>>
>> No, I want to see dmesg - there should be something similiar to this?
>>
>> cfg80211: Calling CRDA for country: GB
>> cfg80211: Regulatory domain changed to country: GB
>>       (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
>>       (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
>>       (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm)
>>       (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm)
>>       (5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 mBm)
>
>
> I'm sure saw the first line as: cfg80211: Calling CRDA for country: JP
>
> There wasn't the rest (frequency stuff), I think. So this is suspicious.

That's strange. Do you have the crda package installed? You need the
regulatory database userland stuff for crda to work.
http://www.linuxwireless.org/en/developers/Regulatory/CRDA

>>> can do iwlist wlan0
>>>
>>> iwconfig wlan0 shows:
>>> IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated
>>>          Tx-Power=20 dBm
>>>          Retry  long limit:7   RTS thr:off   Fragment thr:off
>>>          Encryption key:off
>>>          Power Management:off
>>>
>>>
>>> I do not seem to be able to connect to a given access point so far. LED
>>> does not blink.
>>
>> stay dark or stay lit?
>>
>
>
> Before ifconfig wlan0 up it stays lit. After it, always dark.

Hmm, I am not familiar with the LED code in zd1211rw - somebody else
please comment.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 6d66635..b0d32c4 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -42,6 +42,7 @@  static struct zd_reg_alpha2_map reg_alpha2_map[] = {
 	{ ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */
 	{ ZD_REGDOMAIN_JAPAN, "JP" },
 	{ ZD_REGDOMAIN_JAPAN_ADD, "JP" },
+	{ ZD_REGDOMAIN_JAPAN_3, "JP" },
 	{ ZD_REGDOMAIN_SPAIN, "ES" },
 	{ ZD_REGDOMAIN_FRANCE, "FR" },
 };
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h
index 7c27591..9701935 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.h
+++ b/drivers/net/wireless/zd1211rw/zd_mac.h
@@ -193,6 +193,7 @@  struct zd_mac {
 #define ZD_REGDOMAIN_FRANCE	0x32
 #define ZD_REGDOMAIN_JAPAN_ADD	0x40
 #define ZD_REGDOMAIN_JAPAN	0x41
+#define ZD_REGDOMAIN_JAPAN_3	0x49
 
 enum {
 	MIN_CHANNEL24 = 1,