Exemplo n.º 1
0
uint8_t
Keyboard__get_report(USB_KeyboardReport_Data_t *report_data)
{
  reset();

#ifdef STDOUT_TO_KBREPORT
  if (!stdout_is_empty())
    stdout_to_report_queue();
#endif

  KeyboardReport *report = NULL;

  if (ReportQueue__is_empty())
  {
    scan_matrix();
    init_active_keys();

    if (!kb.error_roll_over && (report = ReportQueue__push()))
    {
      do
        update_bindings(report);
      while (momentary_mode_engaged() || modifier_keys_engaged(report));
      process_keys(report);
    }
  }

  report = ReportQueue__pop();
  return fill_report(report, report_data);
}
Exemplo n.º 2
0
void wlan_hdd_one_connection_scenario(hdd_context_t *hdd_ctx)
{
    enum cds_con_mode sub_type;
    enum cds_conc_priority_mode system_pref =
        hdd_ctx->config->conc_system_pref;
    uint8_t pcl[MAX_NUM_CHAN] = {0};
    uint32_t pcl_len = 0;
    bool status = false;
    enum cds_pcl_type pcl_type;
    char reason[20] = {0};
    CDF_STATUS ret;

    /* flush the entire table first */
    ret = cds_init_policy_mgr(hdd_ctx);
    if (!CDF_IS_STATUS_SUCCESS(ret)) {
        hdd_err("Policy manager initialization failed");
        return;
    }

    for (sub_type = 0; sub_type < CDS_MAX_NUM_OF_MODE; sub_type++) {
        /* validate one connection is created or no */
        if (cds_get_connection_count(hdd_ctx) != 0) {
            hddLog(LOGE,
                   FL("Test failed - No. of connection is not 0"));
            return;
        }
        cdf_mem_zero(pcl, sizeof(pcl));
        pcl_len = 0;
        pcl_type = get_pcl_from_first_conn_table(sub_type, system_pref);

        /* check PCL value for second connection is correct or no */
        cds_get_pcl(hdd_ctx, sub_type, pcl, &pcl_len);
        status = wlan_hdd_validate_pcl(hdd_ctx,
                                       pcl_type, pcl, pcl_len, 0, 0,
                                       reason, sizeof(reason));
        if ((pcl_type == CDS_MAX_PCL_TYPE) && (pcl[0] == 0))
            continue;

        fill_report(hdd_ctx, "1 connection", sub_type,
                    CDS_MAX_NUM_OF_MODE,
                    CDS_MAX_NUM_OF_MODE,
                    0, 0, 0,
                    status, pcl_type, reason, pcl);
    }
}
Exemplo n.º 3
0
void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
        uint8_t first_chnl, uint8_t second_chnl,
        enum cds_chain_mode chain_mask, uint8_t use_same_mac)
{
    uint8_t vdevid_1 = 0, tx_stream_1 = 2, rx_stream_1 = 2;
    uint8_t vdevid_2 = 1, tx_stream_2 = 2, rx_stream_2 = 2;
    uint8_t channel_id_1 = first_chnl, channel_id_2 = second_chnl;
    uint8_t mac_id_1, mac_id_2;
    uint8_t type_1 = WMI_VDEV_TYPE_STA, type_2 = WMI_VDEV_TYPE_STA;
    uint8_t pcl[MAX_NUM_CHAN] = {0};
    uint32_t pcl_len = 0;
    enum cds_chain_mode chain_mask_1;
    enum cds_chain_mode chain_mask_2;
    enum cds_con_mode sub_type_1, sub_type_2, next_sub_type;
    enum cds_con_mode dummy_type_1, dummy_type_2;
    enum cds_conc_priority_mode system_pref =
        hdd_ctx->config->conc_system_pref;
    enum cds_pcl_type pcl_type;
    enum cds_two_connection_mode third_index;
    char reason[20] = {0};
    bool status = false;
    CDF_STATUS ret;

    /* let's set the chain_mask, mac_ids*/
    if (chain_mask == CDS_TWO_TWO) {
        mac_id_1 = 1;
        mac_id_2 = 1;
        chain_mask_1 = CDS_TWO_TWO;
        chain_mask_2 = CDS_TWO_TWO;
    } else if (use_same_mac == 1) {
        mac_id_1 = 1;
        mac_id_2 = 1;
        chain_mask_1 = CDS_ONE_ONE;
        chain_mask_2 = CDS_ONE_ONE;
    } else {
        mac_id_1 = 1;
        mac_id_2 = 2;
        chain_mask_1 = CDS_ONE_ONE;
        chain_mask_2 = CDS_ONE_ONE;
    }

    for (sub_type_1 = CDS_STA_MODE;
            sub_type_1 < CDS_MAX_NUM_OF_MODE; sub_type_1++) {

        type_1 = wlan_hdd_valid_type_of_persona(sub_type_1);
        /* flush the entire table first */
        ret = cds_init_policy_mgr(hdd_ctx);
        if (!CDF_IS_STATUS_SUCCESS(ret)) {
            hdd_err("Policy manager initialization failed");
            return;
        }

        /* sub_type mapping between HDD and WMA are different */
        wlan_hdd_map_subtypes_hdd_wma(&dummy_type_1, &sub_type_1);
        /* add first connection as STA */
        cds_incr_connection_count_utfw(hdd_ctx, vdevid_1,
                                       tx_stream_1, rx_stream_1, chain_mask_1, type_1,
                                       dummy_type_1, channel_id_1, mac_id_1);
        /* validate one connection is created or no */
        if (cds_get_connection_count(hdd_ctx) != 1) {
            hddLog(LOGE,
                   FL("Test fail - No. of connection not 1"));
            return;
        }
        for (sub_type_2 = CDS_STA_MODE;
                sub_type_2 < CDS_MAX_NUM_OF_MODE; sub_type_2++) {

            type_2 = wlan_hdd_valid_type_of_persona(sub_type_2);
            /* sub_type mapping between HDD and WMA are different */
            wlan_hdd_map_subtypes_hdd_wma(&dummy_type_2,
                                          &sub_type_2);
            cds_incr_connection_count_utfw(hdd_ctx, vdevid_2,
                                           tx_stream_2, rx_stream_2, chain_mask_2, type_2,
                                           dummy_type_2, channel_id_2, mac_id_2);
            /* validate two connections are created or no */
            if (cds_get_connection_count(hdd_ctx) != 2) {
                hddLog(LOGE,
                       FL("Test fail - No. connection not 2"));
                return;
            }
            next_sub_type = CDS_STA_MODE;
            while (next_sub_type < CDS_MAX_NUM_OF_MODE) {
                third_index =
                    cds_get_third_connection_pcl_table_index(
                        hdd_ctx);
                if (CDS_MAX_TWO_CONNECTION_MODE ==
                        third_index) {
                    /* not valid combination */
                    next_sub_type++;
                    continue;
                }
                cdf_mem_zero(pcl, sizeof(pcl));
                pcl_len = 0;
                pcl_type =
                    get_pcl_from_third_conn_table(
                        third_index, next_sub_type,
                        system_pref,
                        wma_is_hw_dbs_capable());
                cds_get_pcl(hdd_ctx, next_sub_type,
                            pcl, &pcl_len);
                status = wlan_hdd_validate_pcl(hdd_ctx,
                                               pcl_type, pcl, pcl_len,
                                               channel_id_1, channel_id_2,
                                               reason, sizeof(reason));
                if ((pcl_type == CDS_MAX_PCL_TYPE) &&
                        (pcl[0] == 0)) {
                    next_sub_type++;
                    continue;
                }
                fill_report(hdd_ctx, "3 connections",
                            sub_type_1, sub_type_2,
                            next_sub_type, first_chnl,
                            second_chnl, 0, status,
                            pcl_type, reason, pcl);
                next_sub_type++;
            }
            /* remove entry to make a room for next iteration */
            cds_decr_connection_count(hdd_ctx, vdevid_2);
        }
        next_sub_type = CDS_STA_MODE;
    }
}
Exemplo n.º 4
0
void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
                                       uint8_t first_chnl, enum cds_chain_mode first_chain_mask)
{
    uint8_t vdevid = 0, tx_stream = 2, rx_stream = 2;
    uint8_t type = WMI_VDEV_TYPE_STA, channel_id = first_chnl, mac_id = 1;
    uint8_t pcl[MAX_NUM_CHAN] = {0};
    uint32_t pcl_len = 0;
    enum cds_chain_mode chain_mask = first_chain_mask;
    enum cds_con_mode sub_type, next_sub_type, dummy_type;
    enum cds_conc_priority_mode system_pref =
        hdd_ctx->config->conc_system_pref;
    enum cds_pcl_type pcl_type;
    enum cds_one_connection_mode second_index;
    char reason[20] = {0};
    bool status = false;
    CDF_STATUS ret;

    for (sub_type = CDS_STA_MODE;
            sub_type < CDS_MAX_NUM_OF_MODE; sub_type++) {
        type = wlan_hdd_valid_type_of_persona(sub_type);

        /* flush the entire table first */
        ret = cds_init_policy_mgr(hdd_ctx);
        if (!CDF_IS_STATUS_SUCCESS(ret)) {
            hdd_err("Policy manager initialization failed");
            return;
        }

        /* sub_type mapping between HDD and WMA are different */
        wlan_hdd_map_subtypes_hdd_wma(&dummy_type, &sub_type);
        /* add first connection as STA */
        cds_incr_connection_count_utfw(hdd_ctx, vdevid, tx_stream,
                                       rx_stream, chain_mask, type, dummy_type,
                                       channel_id, mac_id);
        /* validate one connection is created or no */
        if (cds_get_connection_count(hdd_ctx) != 1) {
            hddLog(LOGE,
                   FL("Test failed - No. of connection is not 1"));
            return;
        }
        next_sub_type = CDS_STA_MODE;
        while (next_sub_type < CDS_MAX_NUM_OF_MODE) {
            /* get the PCL value & check the channels accordingly */
            second_index =
                cds_get_second_connection_pcl_table_index(
                    hdd_ctx);
            if (CDS_MAX_ONE_CONNECTION_MODE == second_index) {
                /* not valid combination*/
                hddLog(LOGE, FL("couldn't find index for 2nd connection pcl table"));
                next_sub_type++;
                continue;
            }
            cdf_mem_zero(pcl, sizeof(pcl));
            pcl_len = 0;
            pcl_type = get_pcl_from_second_conn_table(second_index,
                       next_sub_type, system_pref,
                       wma_is_hw_dbs_capable());
            /* check PCL for second connection is correct or no */
            cds_get_pcl(hdd_ctx, next_sub_type, pcl, &pcl_len);
            status = wlan_hdd_validate_pcl(hdd_ctx,
                                           pcl_type, pcl, pcl_len, channel_id, 0,
                                           reason, sizeof(reason));
            if ((pcl_type == CDS_MAX_PCL_TYPE) && (pcl[0] == 0)) {
                next_sub_type++;
                continue;
            }
            fill_report(hdd_ctx, "2 connections", sub_type,
                        next_sub_type,
                        CDS_MAX_NUM_OF_MODE, first_chnl,
                        0, 0, status, pcl_type, reason, pcl);
            next_sub_type++;
        }
    }
}