Skip to content

Commit

Permalink
Add Miracast R2 functionality along with R1
Browse files Browse the repository at this point in the history
This provides an option to use an external library to execute Miracast
operations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  • Loading branch information
Amarnath Hullur Subramanyam authored and jmalinen committed Mar 17, 2017
1 parent 76401f5 commit 9c381f5
Show file tree
Hide file tree
Showing 10 changed files with 1,783 additions and 8 deletions.
16 changes: 15 additions & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ CFLAGS += -DCONFIG_WLANTEST
OBJS += wlantest.c
endif

### MIRACAST ###
OBJS += miracast.c
CFLAGS += -DMIRACAST
dhcpver = $(filter N%,$(PLATFORM_VERSION))
dhcpver += $(filter 7.%,$(PLATFORM_VERSION))
ifeq (,$(strip $(dhcpver)))
CFLAGS += -DMIRACAST_DHCP_M
endif
CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
CFLAGS += -DSIGMA_TMPDIR=\"/data\"

Expand Down Expand Up @@ -54,8 +62,14 @@ LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += \
$(LOCAL_PATH) frameworks/base/cmds/keystore system/security/keystore \
$(LOCAL_PATH) hardware/qcom/wlan/qcwcn/wifi_hal \
$(LOCAL_PATH) hardware/libhardware_legacy/include/hardware_legacy
$(LOCAL_PATH) system/core/include/cutils \
$(LOCAL_PATH) hardware/libhardware_legacy/include/hardware_legacy \
$(TARGET_OUT_HEADERS)/common/inc
LOCAL_SHARED_LIBRARIES := libc libcutils
ifneq (,$(strip $(dhcpver)))
LOCAL_SHARED_LIBRARIES += libnetutils
LOCAL_C_INCLUDES += $(LOCAL_PATH) system/core/include/netutils
endif
LOCAL_SHARED_LIBRARIES += libhardware_legacy
ifeq ($(BOARD_WLAN_DEVICE),qcwcn)
ifneq ($(wildcard hardware/qcom/wlan/qcwcn/wifi_hal/nan_cert.h),)
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ CFLAGS += -DCONFIG_SERVER
OBJS += server.o
endif

ifdef MIRACAST
OBJS += miracast.o
CFLAGS += -DMIRACAST -DMIRACAST_DHCP_M
LIBS += -ldl
endif

sigma_dut: $(OBJS)
$(LDO) $(LDFLAGS) -o sigma_dut $(OBJS) $(LIBS)

Expand Down
5 changes: 5 additions & 0 deletions cmds_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ void sigma_dut_register_cmds(void)
void server_register_cmds(void);
server_register_cmds();
#endif /* CONFIG_SERVER */

#ifdef MIRACAST
void miracast_register_cmds(void);
miracast_register_cmds();
#endif /* MIRACAST */
}
28 changes: 27 additions & 1 deletion dev.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
/*
* Sigma Control API DUT (station/AP/sniffer)
* Copyright (c) 2011-2013, Qualcomm Atheros, Inc.
* Copyright (c) 2011-2013, 2017, Qualcomm Atheros, Inc.
* All Rights Reserved.
* Licensed under the Clear BSD license. See README for more details.
*/

#include "sigma_dut.h"
#include "miracast.h"


static int cmd_dev_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
#ifdef MIRACAST
const char *program = get_param(cmd, "Program");

if (program && (strcasecmp(program, "WFD") == 0 ||
strcasecmp(program, "DisplayR2") == 0))
return miracast_dev_send_frame(dut, conn, cmd);
#endif /* MIRACAST */

if (dut->mode == SIGMA_MODE_STATION ||
dut->mode == SIGMA_MODE_UNKNOWN) {
sigma_dut_print(dut, DUT_MSG_DEBUG, "Convert "
Expand Down Expand Up @@ -51,6 +60,21 @@ static int cmd_dev_set_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
}


static int cmd_dev_exec_action(struct sigma_dut *dut, struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
#ifdef MIRACAST
const char *program = get_param(cmd, "Program");

if (program && (strcasecmp(program, "WFD") == 0 ||
strcasecmp(program, "DisplayR2") == 0))
return miracast_dev_exec_action(dut, conn, cmd);
#endif /* MIRACAST */

return -2;
}


static int req_intf_prog(struct sigma_cmd *cmd)
{
if (get_param(cmd, "interface") == NULL)
Expand All @@ -66,4 +90,6 @@ void dev_register_cmds(void)
sigma_dut_reg_cmd("dev_send_frame", req_intf_prog, cmd_dev_send_frame);
sigma_dut_reg_cmd("dev_set_parameter", req_intf_prog,
cmd_dev_set_parameter);
sigma_dut_reg_cmd("dev_exec_action", req_intf_prog,
cmd_dev_exec_action);
}
Loading

0 comments on commit 9c381f5

Please sign in to comment.