mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-24 09:18:33 +03:00
cardem: Implement WWAN Modem reset via USB
Using the SIMTRACE_MSGT_DT_MODEM_RESET message
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include "llist_irqsafe.h"
|
#include "llist_irqsafe.h"
|
||||||
#include "usb_buf.h"
|
#include "usb_buf.h"
|
||||||
#include "simtrace_prot.h"
|
#include "simtrace_prot.h"
|
||||||
|
#include "wwan_perst.h"
|
||||||
|
|
||||||
#define TRACE_ENTRY() TRACE_DEBUG("%s entering\r\n", __func__)
|
#define TRACE_ENTRY() TRACE_DEBUG("%s entering\r\n", __func__)
|
||||||
|
|
||||||
@@ -496,6 +497,30 @@ static void dispatch_usb_command_cardem(struct msgb *msg, struct cardem_inst *ci
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int usb_command_modem_reset(struct msgb *msg, struct cardem_inst *ci)
|
||||||
|
{
|
||||||
|
struct st_modem_reset *mr = msg->l2h;
|
||||||
|
|
||||||
|
if (msgb_l2len(msg) < sizeof(*mr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
switch (mr->asserted) {
|
||||||
|
case 0:
|
||||||
|
wwan_perst_set(ci->num, 0);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
wwan_perst_set(ci->num, 1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
wwan_perst_do_reset_pulse(ci->num, mr->pulse_duration_msec);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* handle a single USB command as received from the USB host */
|
/* handle a single USB command as received from the USB host */
|
||||||
static void dispatch_usb_command_modem(struct msgb *msg, struct cardem_inst *ci)
|
static void dispatch_usb_command_modem(struct msgb *msg, struct cardem_inst *ci)
|
||||||
{
|
{
|
||||||
@@ -504,6 +529,7 @@ static void dispatch_usb_command_modem(struct msgb *msg, struct cardem_inst *ci)
|
|||||||
hdr = (struct simtrace_msg_hdr *) msg->l1h;
|
hdr = (struct simtrace_msg_hdr *) msg->l1h;
|
||||||
switch (hdr->msg_type) {
|
switch (hdr->msg_type) {
|
||||||
case SIMTRACE_MSGT_DT_MODEM_RESET:
|
case SIMTRACE_MSGT_DT_MODEM_RESET:
|
||||||
|
usb_command_modem_reset(msg, ci);
|
||||||
break;
|
break;
|
||||||
case SIMTRACE_MSGT_DT_MODEM_SIM_SELECT:
|
case SIMTRACE_MSGT_DT_MODEM_SIM_SELECT:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user