View Single Post
Old 6th April 2014
blackhole's Avatar
blackhole blackhole is offline
Spam Deminer
 
Join Date: Mar 2014
Posts: 320
Default

I got a few mails from an OpenBSD developer and have tried as he suggested but pretty much reached the limit of my understanding rather quickly. I'll post what I have tried here, in the hope that it may be useful to others.

Firstly it was suggested to look at kernel source code for the athn driver and make a few changes in order to try and show where the firmware loading is falling down. I was advised to look at these two areas:

sys/dev/usb/if_athn_usb.c

Code:
                error = usbd_do_request(usc->sc_udev, &req, ptr);
                if (error != 0) {
                        free(fw, M_DEVBUF);
                        return (error);
                }
Code:
        error = usbd_do_request(usc->sc_udev, &req, NULL);
        /* Wait at most 1 second for firmware to boot. */
        if (error == 0 && usc->wait_msg_id != 0)
                error = tsleep(&usc->wait_msg_id, 0, "athnfw", hz);
        usc->wait_msg_id = 0;
        splx(s);
        return (error);
Add some printf() functions (luckily I have some very basic c knowledge), recompile the kernel and see what happened.

I modified as follows:

Code:
error = usbd_do_request(usc->sc_udev, &req, ptr);
        printf("usbd_do_request #1\n");
        if (error != 0) {
            free(fw, M_DEVBUF);
            printf("usbd_do_request ERROR #1\n");
            return (error);           
        }

Code:
error = usbd_do_request(usc->sc_udev, &req, NULL);
    printf("usbd_do_request #2\n");
    /* Wait at most 1 second for firmware to boot. */
    if (error == 0 && usc->wait_msg_id != 0)
        error = tsleep(&usc->wait_msg_id, 0, "athnfw", hz);
    usc->wait_msg_id = 0;
    splx(s);
    printf("usbd_do_request ERROR #2\n");
    return (error);
Recompiled the kernel and dmesg shows:

Code:
athn1 at uhub0 port 1 "ATHEROS USB2.0 WLAN" rev 2.00/1.08 addr 2
[...]
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #1
usbd_do_request #2
usbd_do_request ERROR #2
athn1: could not load firmware
As advised I next modified the second section to make it wait longer for the firmware - which I had no idea how to do - so I tried the following:

Code:
error = usbd_do_request(usc->sc_udev, &req, NULL);
    printf("usbd_do_request #2\n");
    /* Wait at most 1 second for firmware to boot. */
    if (error == 0 && usc->wait_msg_id != 0)
        error = tsleep(&usc->wait_msg_id, 0, "athnfw", hz*10);
    usc->wait_msg_id = 0;
    splx(s);
    printf("usbd_do_request ERROR #2\n");
    return (error);
(5th line "hz*10")

It waits at that point for about 10 seconds, but proceeds with exactly the same result.

Beyond that I've no idea (I think I put the extra wait time in the wrong place...)

Last edited by blackhole; 6th April 2014 at 02:04 PM.
Reply With Quote