/*- * Copyright (c) 2019 Adrian Chadd . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any * redistribution must be conditioned upon including a substantially * similar Disclaimer requirement for further binary redistribution. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD$ */ #include "diag.h" #include "ah.h" #include "ah_internal.h" #include #include #include #include #include #include "../common/ctrl.h" /* * This is a simple wrapper program around the ANI diagnostic interface. * It is for fetching and setting the live ANI configuration when trying * to diagnose a noisy environment. */ /* * HAL_DIAG_ANI_CMD is used to set the ANI configuration. * HAL_DIAG_ANI_CURRENT is used to fetch the current ANI configuration. */ struct ani_var { const char *name; int id; }; static struct ani_var ani_labels[] = { { "ofdm_noise_immunity_level", 1, }, { "noise_immunity_level", 1, }, { "ofdm_weak_signal_detect", 2, }, { "cck_weak_signal_threshold", 3, }, { "firstep_level", 4, }, { "spur_immunity_level", 5, }, { "mrc_cck", 8, }, { "cck_noise_immunity_level", 9, }, { NULL, -1, }, }; static void usage(void) { fprintf(stderr, "usage: athani [-i interface] [-l]\n"); fprintf(stderr, " -i: interface\n"); fprintf(stderr, " -l: list ANI labels\n"); fprintf(stderr, " If no args are given after flags, the ANI state will be listed.\n"); fprintf(stderr, " To set, use '