# WiFi Patch: 3Com 3CRWE62092A PC Card for 2.6.x kernels

## KraptoR

The current driver is located there:

(HomePage) http://www.xs4all.nl/~bvermeul/swallow/

Get the drivers:

```
# wget http://www.xs4all.nl/~bvermeul/swallow/poldhu-0.3.1.tar.gz
```

Unpack the tarball:

```
# tar -xzvf poldhu-0.3.1.tar.gz
```

Compile and install the driver:

```

# cd poldhu

# make

# make install

```

This will create the poldhu_cs.ko module.

If you have some of the first 2.6 kernel releases, then it's possible that works as is.

For those using latest 2.6.x kernels you will get: Unknown symbol CardServices not found! if you try to modprobe it.

I've created a patch for the driver:

```

diff -ruN poldhu/README poldhu_r1/README

--- poldhu/README   2003-12-21 23:45:03.000000000 +0100

+++ poldhu_r1/README   2004-02-21 21:17:01.242412464 +0100

@@ -1,6 +1,6 @@

 No Wires Needed Poldhu driver

-version 0.3.1

-Mon Dec 21 12:00:00 CET 2003

+version 0.3.1-r1

+Sat Feb 21 12:00:00 CET 2004

 

 

 Introduction

diff -ruN poldhu/clients/poldhu.c poldhu_r1/clients/poldhu.c

--- poldhu/clients/poldhu.c   2003-12-21 23:29:35.000000000 +0100

+++ poldhu_r1/clients/poldhu.c   2004-02-21 21:17:01.244412160 +0100

@@ -4,9 +4,11 @@

 

     Copyright (C) 2002 Bas Vermeulen -- bvermeul@blackstar.nl

 

-    poldhu.c 0.3.1 2002/08/04

+    Adapted for 2.6.x kernels by David Anes -- danes@inf.upv.es

 

-    Version 0.3.1 is designed to work with kernel version 2.6.0+, 

+    poldhu.c 0.3.1-r1 2004/02/21

+

+    Version 0.3.1-r1 is designed to work with kernel version 2.6.x, 

     where the PCMCIA code has been integrated into the kernel.

 

     This software may be used and distributed according to the

@@ -173,7 +175,7 @@

    unsigned long state;

 };

 

-static char *version = "No Wires Needed Poldhu driver v0.3.1";

+static char *version = "No Wires Needed Poldhu driver v0.3.1-r1";

 

 #ifdef CONFIG_PCMCIA_POLDHU_DEBUG

 static int poldhu_debug = CONFIG_PCMCIA_POLDHU_DEBUG;

@@ -656,7 +658,8 @@

    client_reg.Version = 0x0210;

    client_reg.event_callback_args.client_data = link;

 

-   ret = CardServices(RegisterClient, &link->handle, &client_reg);

+// KRPATCH +++   ret = CardServices(RegisterClient, &link->handle, &client_reg);

+   ret = pcmcia_register_client(&link->handle, &client_reg);

    if (ret != 0) {

       cs_error(link->handle, RegisterClient, ret);

       poldhu_pcmcia_detach(link);

@@ -706,7 +709,8 @@

    }

 

    if (link->handle)

-      CardServices(DeregisterClient, link->handle);

+// KRPATCH ***      CardServices(DeregisterClient, link->handle);

+      pcmcia_deregister_client(link->handle);

 

    /* Unlink device structure, free bits */

    *linkp = link->next;

@@ -739,11 +743,14 @@

 

 ========================================================================*/

 

-#define CS_CHECK(fn, args...) \

-while ((last_ret = CardServices(last_fn=(fn), args)) != 0) goto cs_failed

+/* KRPATCH - These 2 macros have been expanded on the code

+   #define CS_CHECK(fn, args...) \   

+   while ((last_ret = CardServices(last_fn=(fn), args)) != 0) goto cs_failed

+

 

-#define CFG_CHECK(fn, args...) \

-if (CardServices(fn, args) != 0) goto next_entry

+   #define CFG_CHECK(fn, args...) \

+   if (CardServices(fn, args) != 0) goto next_entry

+*/

 

 static void poldhu_pcmcia_config(dev_link_t * link)

 {

@@ -770,20 +777,32 @@

     */

    tuple.Attributes = 0;

    tuple.DesiredTuple = CISTPL_CONFIG;

-   CS_CHECK(GetFirstTuple, handle, &tuple);

+

+// KRPATCH ***   CS_CHECK(GetFirstTuple, handle, &tuple);

+   last_fn = (GetFirstTuple);

+   while ((last_ret = pcmcia_get_first_tuple(handle, &tuple)) != 0) goto cs_failed;

+

    tuple.TupleData = (cisdata_t *) buf;

    tuple.TupleDataMax = sizeof(buf);

    tuple.TupleOffset = 0;

-   CS_CHECK(GetTupleData, handle, &tuple);

-   CS_CHECK(ParseTuple, handle, &tuple, &parse);

+// KRPATCH ***   CS_CHECK(GetTupleData, handle, &tuple);

+   last_fn = (GetTupleData);

+   while ((last_ret = pcmcia_get_tuple_data(handle, &tuple)) != 0) goto cs_failed;

+

+// KRPATCH ***   CS_CHECK(ParseTuple, handle, &tuple, &parse);

+   last_fn = (ParseTuple);

+   while ((last_ret = pcmcia_parse_tuple(handle, &tuple, &parse)) != 0) goto cs_failed;

+

    link->conf.ConfigBase = parse.config.base;

    link->conf.Present = parse.config.rmask[0];

 

    /* Is this a 3Com XJack card? */

    tuple.DesiredTuple = CISTPL_MANFID;

    tuple.Attributes = TUPLE_RETURN_COMMON;

-   if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) &&

-       (CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS))

+// KRPATCH ***   if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) &&

+// KRPATCH ***       (CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS))

+   if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) &&

+       (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS))

    {

       if ((buf[0] == 0x01) && (buf[1] == 0x01) &&

           (buf[2] == 0x92) && (buf[3] == 0x20))

@@ -807,12 +826,20 @@

       any Poldhu card, since that has an accurate CIS.

     */

    tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;

-   CS_CHECK(GetFirstTuple, handle, &tuple);

+

+// KRPATCH ***   CS_CHECK(GetFirstTuple, handle, &tuple);

+   last_fn = (GetFirstTuple);

+   while ((last_ret = pcmcia_get_first_tuple(handle, &tuple)) != 0) goto cs_failed;

+

    while (1) {

       cistpl_cftable_entry_t dflt = { 0 };

       cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);

-      CFG_CHECK(GetTupleData, handle, &tuple);

-      CFG_CHECK(ParseTuple, handle, &tuple, &parse);

+

+// KRPATCH ***      CFG_CHECK(GetTupleData, handle, &tuple);

+      if (pcmcia_get_tuple_data(handle, &tuple) != 0) goto next_entry;

+

+// KRPATCH ***      CFG_CHECK(ParseTuple, handle, &tuple, &parse);

+      if (pcmcia_parse_tuple(handle, &tuple, &parse) != 0) goto next_entry;

 

       if (cfg->flags & CISTPL_CFTABLE_DEFAULT)

          dflt = *cfg;

@@ -869,7 +896,9 @@

       }

 

       /* This reserves IO space but doesn't actually enable it */

-      CFG_CHECK(RequestIO, link->handle, &link->io);

+

+// KRPATCH ***      CFG_CHECK(RequestIO, link->handle, &link->io);

+      if (pcmcia_request_io(link->handle, &link->io) != 0) goto next_entry;

 

       /*

          Now set up a common memory window, if needed. There is room

@@ -891,28 +920,45 @@

          req.Size = mem->win[0].len;

          req.AccessSpeed = 0;

          link->win = (window_handle_t) link->handle;

-         CFG_CHECK(RequestWindow, &link->win, &req);

+

+// KRPATCH ***         CFG_CHECK(RequestWindow, &link->win, &req);

+         if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) goto next_entry;

+

          map.Page = 0;

          map.CardOffset = mem->win[0].card_addr;

-         CFG_CHECK(MapMemPage, link->win, &map);

+

+// KRPATCH ***         CFG_CHECK(MapMemPage, link->win, &map);

+         if (pcmcia_map_mem_page(link->win, &map) != 0) goto next_entry;

+

       }

       /* If we got this far, we're cool! */

       break;

 

          next_entry:

-      CS_CHECK(GetNextTuple, handle, &tuple);

+// KRPATCH ***      CS_CHECK(GetNextTuple, handle, &tuple);

+      last_fn = (GetNextTuple);

+      while ((last_ret = pcmcia_get_next_tuple(handle, &tuple)) != 0) goto cs_failed;

+

    }

 

    /* Allocate an interrupt line. */

    if (link->conf.Attributes & CONF_ENABLE_IRQ)

-      CS_CHECK(RequestIRQ, link->handle, &link->irq);

+// KRPATCH ***      CS_CHECK(RequestIRQ, link->handle, &link->irq);

+         {

+         last_fn = (RequestIRQ);

+         while ((last_ret = pcmcia_request_irq(link->handle, &link->irq)) != 0) goto cs_failed;

+         }

 

    /*

       This actually configures the PCMCIA socket -- setting up

       the I/O windows and the interrupt mapping, and putting the

       card and host interface into "Memory and IO" mode.

     */

-   CS_CHECK(RequestConfiguration, link->handle, &link->conf);

+

+// KRPATCH ***   CS_CHECK(RequestConfiguration, link->handle, &link->conf);

+   last_fn = (RequestConfiguration);

+   while ((last_ret = pcmcia_request_configuration(link->handle, &link->conf)) != 0) goto cs_failed;

+

 

    /* Report what we've done so far */

    printk(KERN_INFO "poldhu_cs: index 0x%02x: Vcc %d.%d",

@@ -1069,9 +1115,12 @@

 

    /* Remove proc file */

    remove_proc_entry(link->dev->dev_name, poldhu_proc_dir);

-   CardServices(ReleaseConfiguration, link->handle);

-   CardServices(ReleaseIO, link->handle, &link->io);

-   CardServices(ReleaseIRQ, link->handle, &link->irq);

+// KRPATCH ***   CardServices(ReleaseConfiguration, link->handle);

+   pcmcia_release_configuration(link->handle);

+// KRPATCH ***   CardServices(ReleaseIO, link->handle, &link->io);

+   pcmcia_release_io(link->handle, &link->io);

+// KRPATCH **   CardServices(ReleaseIRQ, link->handle, &link->irq);

+   pcmcia_release_irq(link->handle, &link->irq);

    link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);

 }

 

@@ -1111,7 +1160,8 @@

          if (link->open) {

             netif_device_detach(dev);

          }

-         CardServices(ReleaseConfiguration, link->handle);

+// KRPATCH ***         CardServices(ReleaseConfiguration, link->handle);

+         pcmcia_release_configuration(link->handle);

       }

       break;

    case CS_EVENT_PM_RESUME:

@@ -1119,8 +1169,8 @@

       /* Fall through */

    case CS_EVENT_CARD_RESET:

       if (link->state & DEV_CONFIG) {

-         CardServices(RequestConfiguration,

-                 link->handle, &link->conf);

+// KRPATCH ***         CardServices(RequestConfiguration, link->handle, &link->conf);

+         pcmcia_request_configuration(link->handle, &link->conf);

          if (link->open) {

             /* Enable interrupts if needed */

             if (!(INB(Comms7(dev->base_addr)) & INT_STATUS)) {

```

So apply it as a tree patch to poldhu directory.

Enjoy!

----------

## KraptoR

I've noticed som kernel warning messages using 2.6.4 kernels... but the patched driver still works perfectly. These messages are due to API changes for the PCMCIA devices... I'll try to fix these messages when I have some time.

----------

## supasin

I attempted to use the patch and it fails.  Can someone help?

Thanks.

----------

## KraptoR

Well... step by step instructions to apply the patch:

Copy & Paste the patch to a file, i.e: /root/poldhu.CardServices.patch

NOTE: I'll supose you have the downloaded driver version on /root/

1-. Go to /root/

```

# su -

Password:

# pwd

/root/

```

2-. Untar the driver:

```

# tar -xzvf poldhu-0.3.1.tar.gz 

poldhu/

poldhu/Makefile

poldhu/README

poldhu/TODO

poldhu/clients/

poldhu/clients/Makefile

poldhu/clients/poldhu.c

poldhu/clients/poldhu.h

poldhu/clients/ring.c

poldhu/clients/ring.h

poldhu/clients/snwnmp.c

poldhu/clients/snwnmp.h

poldhu/config/

poldhu/config/Makefile

poldhu/config/poldhu.conf

poldhu/scripts/

poldhu/scripts/setup.sh

```

3-. Apply the patch

```

# ls

drwxrwxr-x    5 500      500           192 Dec 21 23:45 poldhu

-rw-r--r--    1 root     root        28779 Dec 21 23:47 poldhu-0.3.1.tar.gz

-rw-r--r--    1 root     root         8514 Feb 21 22:02 poldhu.CardServices.patch

# patch -p0 < poldhu.CardServices.patch

patching file poldhu/README

patching file poldhu/clients/poldhu.c

```

NOTE: Use "patch -p0 -R < poldhu.CardServices.patch" if you get some warnings about Reverse Patch.

4-. Now use use the standard instructions!  :Smile: 

Enjoy!

----------

## supasin

Thanks for the quick reply, but this is what i've done so far and I'm still getting an error:

```

root@flanders root # tar -xzvf poldhu-0.3.1.tar.gz

poldhu/

poldhu/Makefile

poldhu/README

poldhu/TODO

poldhu/clients/

poldhu/clients/Makefile

poldhu/clients/poldhu.c

poldhu/clients/poldhu.h

poldhu/clients/ring.c

poldhu/clients/ring.h

poldhu/clients/snwnmp.c

poldhu/clients/snwnmp.h

poldhu/config/

poldhu/config/Makefile

poldhu/config/poldhu.conf

poldhu/scripts/

poldhu/scripts/setup.sh

root@flanders root # patch -p0 < poldhu.CardServices.patch

patching file poldhu/README

patching file poldhu/clients/poldhu.c

Hunk #1 FAILED at 4.

Hunk #2 succeeded at 175 with fuzz 1.

Hunk #3 FAILED at 658.

Hunk #4 FAILED at 709.

Hunk #6 FAILED at 777.

Hunk #7 FAILED at 826.

Hunk #8 FAILED at 896.

Hunk #9 FAILED at 920.

7 out of 9 hunks FAILED -- saving rejects to file poldhu/clients/poldhu.c.rej

missing header for unified diff at line 203 of patch

can't find file to patch at input line 203

Perhaps you used the wrong -p or --strip option?

The text leading up to this was:

--------------------------

|    printk(KERN_INFO "poldhu_cs: index 0x%02x: Vcc %d.%d",

--------------------------

File to patch:

```

----------

## KraptoR

Well... i found the posted code is not the same as the original patch i've made...

1-. My patch:

```

krmobile exp # ls -al ../poldhu.CardServices.patch.diff

-rw-r--r--    1 root     root         8514 Feb 21 22:02 ../poldhu.CardServices.patch.diff

```

2-. The posted version:

```

krmobile exp # ls -al patch.patch

-rw-r--r--    1 root     root         9014 Mar 31 18:57 patch.patch

```

Note the 500 bytes differece.

Well... I think is phpBB related problem... I'm fixing the issue.

Sorry for any inconvenience.

----------

## supasin

I was just wondering what the status was regarding the update of the patch.  Thanks for your help.

Supasin

----------

## KraptoR

Just remove the trailing blank spaces of every line...  :Wink:  PhpBB inserts blank spaces  :Sad: 

Also, be careful with possibly-inserted NEWLINES if you set your browser not wide enougth.

 :Wink: 

----------

## SpineBuster

Hi!

I wonder if it isn't possible to create an ebuild for this?

That would make things much easier.

Greetz!

----------

## KraptoR

I no longer use Gentoo... but anyone could make an ebuild.

You can download the patch here: http://biestado.kraptor.com/3crwe62092a-for-linux-263-kernels/

----------

