예제 #1
0
static int
uf_proc_show(struct seq_file *m, void *v)
{
    unifi_priv_t *priv;
    int i;

    /*
    * The following complex casting is in place in order to eliminate 64-bit compilation warning 
    * "cast to/from pointer from/to integer of different size"
    */
    priv = uf_find_instance((int)(long)m->private);
    if (!priv) {
        return 0;
    }

    seq_printf(m, "UniFi SDIO Driver: %s %s %s\n",
           CSR_WIFI_VERSION, __DATE__, __TIME__);
#ifdef CSR_SME_USERSPACE
    seq_puts(m, "SME: CSR userspace ");
#ifdef CSR_SUPPORT_WEXT
    seq_puts(m, "with WEXT support\n");
#else
    seq_putc(m, '\n');
#endif /* CSR_SUPPORT_WEXT */
#endif /* CSR_SME_USERSPACE */
#ifdef CSR_NATIVE_LINUX
    seq_puts(m, "SME: native\n");
#endif

#ifdef CSR_SUPPORT_SME
    seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n",
           priv->card_info.fw_build,
           priv->sme_versions.firmwarePatch);
#endif

    unifi_print_status(priv->card, m);

    seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string);

    seq_puts(m, "Last dbg16:");
    for (i = 0; i < 8; i++)
        seq_printf(m, " %04X", priv->last_debug_word16[i]);
    seq_putc(m, '\n');
    seq_puts(m, "           ");
    for (; i < 16; i++)
        seq_printf(m, " %04X", priv->last_debug_word16[i]);
    seq_putc(m, '\n');
    return 0;
} /* uf_read_proc() */
예제 #2
0
static int
uf_read_proc(char *page, char **start, off_t offset, int count,
        int *eof, void *data)
{
#define UNIFI_DEBUG_TXT_BUFFER 8*1024
    unifi_priv_t *priv;
    int actual_amount_to_copy;
    char *p, *orig_p;
    s32 remain = UNIFI_DEBUG_TXT_BUFFER;
    s32 written;
    int i;

    /*
    * The following complex casting is in place in order to eliminate 64-bit compilation warning
    * "cast to/from pointer from/to integer of different size"
    */
    priv = uf_find_instance((int)(long)data);
    if (!priv) {
        return 0;
    }

    p = kmalloc( UNIFI_DEBUG_TXT_BUFFER, GFP_KERNEL );

    orig_p = p;

    written = CsrSnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n",
            CSR_WIFI_VERSION, __DATE__, __TIME__);
    UNIFI_SNPRINTF_RET(p, remain, written);
#ifdef CSR_SME_USERSPACE
    written = CsrSnprintf(p, remain, "SME: CSR userspace ");
    UNIFI_SNPRINTF_RET(p, remain, written);
#ifdef CSR_SUPPORT_WEXT
    written = CsrSnprintf(p, remain, "with WEXT support\n");
#else
    written = CsrSnprintf(p, remain, "\n");
#endif /* CSR_SUPPORT_WEXT */
    UNIFI_SNPRINTF_RET(p, remain, written);
#endif /* CSR_SME_USERSPACE */
#ifdef CSR_NATIVE_LINUX
    written = CsrSnprintf(p, remain, "SME: native\n");
    UNIFI_SNPRINTF_RET(p, remain, written);
#endif

#ifdef CSR_SUPPORT_SME
    written = CsrSnprintf(p, remain,
            "Firmware (ROM) build:%lu, Patch:%lu\n",
            priv->card_info.fw_build,
            priv->sme_versions.firmwarePatch);
    UNIFI_SNPRINTF_RET(p, remain, written);
#endif
    p += unifi_print_status(priv->card, p, &remain);

    written = CsrSnprintf(p, remain, "Last dbg str: %s\n",
            priv->last_debug_string);
    UNIFI_SNPRINTF_RET(p, remain, written);

    written = CsrSnprintf(p, remain, "Last dbg16:");
    UNIFI_SNPRINTF_RET(p, remain, written);
    for (i = 0; i < 8; i++) {
        written = CsrSnprintf(p, remain, " %04X",
                priv->last_debug_word16[i]);
        UNIFI_SNPRINTF_RET(p, remain, written);
    }
    written = CsrSnprintf(p, remain, "\n");
    UNIFI_SNPRINTF_RET(p, remain, written);
    written = CsrSnprintf(p, remain, "           ");
    UNIFI_SNPRINTF_RET(p, remain, written);
    for (; i < 16; i++) {
        written = CsrSnprintf(p, remain, " %04X",
                priv->last_debug_word16[i]);
        UNIFI_SNPRINTF_RET(p, remain, written);
    }
    written = CsrSnprintf(p, remain, "\n");
    UNIFI_SNPRINTF_RET(p, remain, written);
    *start = page;

    written = UNIFI_DEBUG_TXT_BUFFER - remain;

    if( offset >= written )
    {
        *eof = 1;
        kfree( orig_p );
        return(0);
    }

    if( offset + count > written )
    {
        actual_amount_to_copy = written - offset;
        *eof = 1;
    }
    else
    {
        actual_amount_to_copy = count;
    }

    memcpy( page, &(orig_p[offset]), actual_amount_to_copy );

    kfree( orig_p );

    return( actual_amount_to_copy );
} /* uf_read_proc() */