DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Reply
 
Thread Tools Display Modes
Old 24th March 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 552
Thanked 14 Times in 13 Posts
Default

This thread is about a hardware driver. I'm puzzled why it was moved from "OpenBSD General" to "OpenBSD Installation and Upgrading" about 10 months after creation?
Reply With Quote
Old 24th March 2014
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,873
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by IdOp View Post
This thread is about a hardware driver. I'm puzzled why it was moved from "OpenBSD General" to "OpenBSD Installation and Upgrading" about 10 months after creation?
The "General" section is vastly overcrowded, & given that the original question(s) focused on loading firmware problems, this is handled intentionally by fw_update(1), a utility which is called upon first boot.

Should there be a reorganization of subforae? Perhaps, but there is no agreement upon how that should be accomplished.
Reply With Quote
Old 25th March 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 552
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by ocicat View Post
The "General" section is vastly overcrowded, & given that the original question(s) focused on loading firmware problems, this is handled intentionally by fw_update(1), a utility which is called upon first boot.
It can be, but, all these issues can arise much after installation if someone adds the USB device to their system then. Anyway, no biggy, I was just curious why it was moved, and thanks for taking the time to reply to my question.

Quote:
Should there be a reorganization of subforae? Perhaps, but there is no agreement upon how that should be accomplished.
The organization seems fine to me.
Reply With Quote
Old 25th March 2014
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,873
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by IdOp View Post
...all these issues can arise much after installation if someone adds the USB device to their system then.
...which is the installation of a new device.

Reply With Quote
Old 6th April 2014
cynwulf cynwulf is offline
Port Guard
 
Join Date: Mar 2014
Posts: 26
Thanked 0 Times in 0 Posts
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 cynwulf; 6th April 2014 at 02:04 PM.
Reply With Quote
Old 7th April 2014
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 552
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by cynwulf
I think I put the extra wait time in the wrong place...
I'm also entirely unfamiliar with this code, but it looks like a reasonable change to me, given the request. The man page for tsleep(9) says the final argument, when divided by hz, gives the max number of seconds it will sleep. So it originally slept (up to) 1 second, which ties in with the comment in the code, and then 10 seconds with your change.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to upgrade firmware? tls OpenBSD Installation and Upgrading 9 30th April 2012 10:50 PM
How to build upgt firmware AnilG FreeBSD Installation and Upgrading 2 20th March 2012 12:06 PM
How do I manually load firmware in OpenBSD? Shagbag OpenBSD Packages and Ports 3 18th September 2008 08:37 PM
NVIDIA driver fails to load, freebsd 7.0 mc_i2020 FreeBSD General 18 18th July 2008 01:12 PM
location for wpi-firmware-.tgz bsdnewbie999 OpenBSD General 1 18th June 2008 04:20 AM


All times are GMT. The time now is 01:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick