Subject: SMC EZ connect wlan & atu(4)
To: None <current-users@netbsd.org>
From: jarkko teppo <jht380@gmail.com>
List: current-users
Date: 04/02/2005 09:00:28
Hi,

I recently picked up the following from a bargain bin:

atu0: Standard Microsystems 2662W-AR Wireless Adapter, rev 1.10/1.00, addr 2

I just can't get it to work, even after hacking up if_atu[reg].[ch] based
on what openbsd has.

Here's what ifconfig sees:

atu0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ssid moyk
        powersave off
        bssid 02:00:13:48:6a:54 chan 11
        address: 00:04:e2:2a:95:31
        media: IEEE802.11 DS11 adhoc (autoselect mode 11b adhoc)
        status: active
        inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
        inet6 fe80::204:e2ff:fe2a:9531%atu0 prefixlen 64 scopeid 0x4

bash-2.05b# wiconfig atu0
NIC serial number:                      [  ]
Station name:                           [ lyngen ]
SSID for IBSS creation:                 [ moyk ]
Current netname (SSID):                 [ moyk ]
Desired netname (SSID):                 [ moyk ]
Current BSSID:                          [ 02:00:13:48:6a:54 ]
Channel list:                           [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ]
IBSS channel:                           [ 11 ]
Current channel:                        [ 11 ]
Comms quality/signal/noise:             [ 0 17 0 ]
Promiscuous mode:                       [ Off ]
Port type:                              [ 0 ]
MAC address:                            [ 00:04:e2:2a:95:31 ]
TX rate (selection):                    [ 11 ]
TX rate (actual speed):                 [ 11 ]
Beacon Interval (current) [msec]:       [ 100 ]
Maximum data length:                    [ 2312 ]
RTS/CTS handshake threshold:            [ 2312 ]
fragmentation threshold:                [ 2346 ]
RSSI -> dBm adjustment:                 [ ]
Create IBSS:                            [ On ]
Microwave oven robustness:              [ 0 ]
Roaming mode(1:firm,3:disable):         [ 1 ]
Access point density:                   [ 1 ]
Power Mgmt (1=on, 0=off):               [ 0 ]
Max sleep time (msec):                  [ 100 ]
Vendor info:
WEP encryption:                         [ Off ]
Authentication type
(1=OpenSys, 2=Shared Key):              [ 1 ]
TX encryption key:                      [ 1 ]
Encryption keys:                        [  ][  ][  ][  ]



Here's the neatest part: after switching both ends (atu and wi) manually
to media DS11 mediaopt adhoc, atu sees the traffic and pretends
to send it:

bash-2.05b# tcpdump -n -i atu0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on atu0, link-type EN10MB (Ethernet), capture size 96 bytes
08:52:42.998827 arp who-has 192.168.1.1 tell 192.168.1.2
08:52:42.998851 arp reply 192.168.1.1 is-at 00:04:e2:2a:95:31
08:52:57.591176 arp who-has 192.168.1.1 tell 192.168.1.2
08:52:57.591199 arp reply 192.168.1.1 is-at 00:04:e2:2a:95:31

Apparently I'm doing something wrong somewhere, any help appreciated!

Here's the quick and dirty adaptation from openbsd:

*** if_atu.c.orig       Fri Apr  1 18:01:22 2005
--- if_atu.c    Fri Apr  1 23:55:47 2005
***************
*** 76,81 ****
--- 76,82 ----
  #include <dev/microcode/atmel/atmel_rfmd2958-smc_fw.h>
  #include <dev/microcode/atmel/atmel_rfmd2958_fw.h>
  #include <dev/microcode/atmel/atmel_rfmd_fw.h>
+ #include <dev/microcode/atmel/atmel_at76c503_rfmd_acc_fw.h>

  #if NBPFILTER > 0
  #include <net/bpf.h>
***************
*** 143,148 ****
--- 144,151 ----
          RadioIntersil,        ATU_NO_QUIRK },
        { USB_VENDOR_OQO,       USB_PRODUCT_OQO_WIFI01,
          RadioRFMD2958_SMC,    ATU_QUIRK_NO_REMAP | ATU_QUIRK_FW_DELAY },
+       { USB_VENDOR_SMC3,      USB_PRODUCT_SMC3_2662WUSB,
+         AT76C503_rfmd_acc,    ATU_NO_QUIRK },
  };

  struct atu_radfirm {
***************
*** 163,169 ****
          atmel_fw_rfmd2958_smc_ext,    sizeof(atmel_fw_rfmd2958_smc_ext) },
        { RadioIntersil,
          atmel_fw_intersil_int,        sizeof(atmel_fw_intersil_int),
!         atmel_fw_intersil_ext,        sizeof(atmel_fw_intersil_ext) }
  };

  int   atu_newbuf(struct atu_softc *, struct atu_chain *, struct mbuf *);
--- 166,175 ----
          atmel_fw_rfmd2958_smc_ext,    sizeof(atmel_fw_rfmd2958_smc_ext) },
        { RadioIntersil,
          atmel_fw_intersil_int,        sizeof(atmel_fw_intersil_int),
!         atmel_fw_intersil_ext,        sizeof(atmel_fw_intersil_ext) },
!       { AT76C503_rfmd_acc,
!         atmel_at76c503_rfmd_acc_fw_int,      
sizeof(atmel_at76c503_rfmd_acc_f
w_int),
!         atmel_at76c503_rfmd_acc_fw_ext,      
sizeof(atmel_at76c503_rfmd_acc_f
w_ext)}
  };

  int   atu_newbuf(struct atu_softc *, struct atu_chain *, struct mbuf *);
***************
*** 977,982 ****
--- 983,989 ----

        case RadioRFMD:
        case RadioRFMD2958:
+       case AT76C503_rfmd_acc:
        case RadioRFMD2958_SMC:
                err = atu_usb_request(sc, UT_READ_VENDOR_INTERFACE, 0x33,
                    0x0a02, 0x0000, sizeof(rfmd_conf),

*** if_atureg.h.orig    Fri Apr  1 23:01:49 2005
--- if_atureg.h Fri Apr  1 23:53:41 2005
***************
*** 91,97 ****
        RadioRFMD = 0,
        RadioRFMD2958,
        RadioRFMD2958_SMC,
!       RadioIntersil
  };

  struct atu_type {
--- 91,98 ----
        RadioRFMD = 0,
        RadioRFMD2958,
        RadioRFMD2958_SMC,
!       RadioIntersil,
!       AT76C503_rfmd_acc
  };

  struct atu_type {


And then I copied the firmware-file to sys/dev/microcode/atmel/.

TIA,
-- 
jht