150
150
151
151
enum ncm_notify_state_e
152
152
{
153
- NCM_NOTIFY_NONE , /* Don't notify */
154
- NCM_NOTIFY_CONNECT , /* Issue CONNECT next */
155
- NCM_NOTIFY_SPEED , /* Issue SPEED_CHANGE next */
153
+ NCM_NOTIFY_NONE , /* Don't notify */
154
+ NCM_NOTIFY_CONNECT , /* Issue CONNECT next */
155
+ NCM_NOTIFY_SPEED , /* Issue SPEED_CHANGE next */
156
+ NCM_NOTIFY_RESPONSE_AVAILABLE , /* Issue RESPONSE_AVAILABLE next */
156
157
};
157
158
158
159
struct ndp_parser_opts_s
@@ -392,6 +393,8 @@ static int cdcncm_ioctl(FAR struct netdev_lowerhalf_s *dev, int cmd,
392
393
unsigned long arg );
393
394
#endif
394
395
396
+ static void cdcncm_notify_worker (FAR void * arg );
397
+
395
398
/* USB Device Class Driver **************************************************/
396
399
397
400
/* USB Device Class methods */
@@ -724,6 +727,9 @@ static ssize_t cdcmbim_write(FAR struct file *filep, FAR const char *buffer,
724
727
}
725
728
726
729
uinfo ("wrote %zd bytes\n" , buflen );
730
+ DEBUGASSERT (self -> ncmdriver .notify == NCM_NOTIFY_RESPONSE_AVAILABLE );
731
+ work_queue (ETHWORK , & self -> ncmdriver .notifywork , cdcncm_notify_worker ,
732
+ self , 0 );
727
733
728
734
errout :
729
735
nxmutex_unlock (& self -> lock );
@@ -1521,12 +1527,12 @@ static void cdcncm_resetconfig(FAR struct cdcncm_driver_s *self)
1521
1527
EP_DISABLE (self -> epint );
1522
1528
EP_DISABLE (self -> epbulkin );
1523
1529
EP_DISABLE (self -> epbulkout );
1530
+ self -> notify = NCM_NOTIFY_SPEED ;
1524
1531
}
1525
1532
1526
1533
self -> parseropts = & g_ndp16_opts ;
1527
1534
self -> ndpsign = self -> isncm ? self -> parseropts -> ndpsign :
1528
1535
CDC_MBIM_NDP16_NOCRC_SIGN ;
1529
- self -> notify = NCM_NOTIFY_NONE ;
1530
1536
}
1531
1537
1532
1538
/****************************************************************************
@@ -1627,11 +1633,11 @@ static int cdcncm_setconfig(FAR struct cdcncm_driver_s *self, uint8_t config)
1627
1633
}
1628
1634
1629
1635
/****************************************************************************
1630
- * Name: ncm_notify
1636
+ * Name: cdcncm_notify
1631
1637
*
1632
1638
****************************************************************************/
1633
1639
1634
- static int ncm_notify (FAR struct cdcncm_driver_s * self )
1640
+ static int cdcncm_notify (FAR struct cdcncm_driver_s * self )
1635
1641
{
1636
1642
FAR struct usb_ctrlreq_s * req =
1637
1643
(FAR struct usb_ctrlreq_s * )self -> notifyreq -> buf ;
@@ -1677,7 +1683,20 @@ static int ncm_notify(FAR struct cdcncm_driver_s *self)
1677
1683
self -> notify = NCM_NOTIFY_CONNECT ;
1678
1684
break ;
1679
1685
}
1680
- }
1686
+
1687
+ case NCM_NOTIFY_RESPONSE_AVAILABLE :
1688
+ {
1689
+ req -> req = MBIM_RESPONSE_AVAILABLE ;
1690
+ req -> value [0 ] = LSBYTE (0 );
1691
+ req -> value [1 ] = MSBYTE (0 );
1692
+ req -> len [0 ] = LSBYTE (0 );
1693
+ req -> len [1 ] = MSBYTE (0 );
1694
+ ret = sizeof (* req );
1695
+
1696
+ self -> notify = NCM_NOTIFY_NONE ;
1697
+ break ;
1698
+ }
1699
+ }
1681
1700
1682
1701
req -> type = 0xa1 ;
1683
1702
req -> index [0 ] = LSBYTE (self -> devinfo .ifnobase );
@@ -1687,18 +1706,18 @@ static int ncm_notify(FAR struct cdcncm_driver_s *self)
1687
1706
}
1688
1707
1689
1708
/****************************************************************************
1690
- * Name: ncm_do_notify
1709
+ * Name: cdcncm_notify_worker
1691
1710
*
1692
1711
****************************************************************************/
1693
1712
1694
- static void ncm_do_notify (FAR void * arg )
1713
+ static void cdcncm_notify_worker (FAR void * arg )
1695
1714
{
1696
1715
FAR struct cdcncm_driver_s * self = arg ;
1697
1716
int ret ;
1698
1717
1699
1718
while (self -> notify != NCM_NOTIFY_NONE )
1700
1719
{
1701
- ret = ncm_notify (self );
1720
+ ret = cdcncm_notify (self );
1702
1721
if (ret > 0 )
1703
1722
{
1704
1723
FAR struct usbdev_req_s * notifyreq = self -> notifyreq ;
@@ -1709,6 +1728,12 @@ static void ncm_do_notify(FAR void *arg)
1709
1728
EP_SUBMIT (self -> epint , notifyreq );
1710
1729
}
1711
1730
}
1731
+
1732
+ /* After the NIC information is synchronized, subsequent notifications
1733
+ * are all related to the mbim control
1734
+ */
1735
+
1736
+ self -> notify = NCM_NOTIFY_RESPONSE_AVAILABLE ;
1712
1737
}
1713
1738
1714
1739
/****************************************************************************
@@ -1727,7 +1752,7 @@ static int cdcncm_setinterface(FAR struct cdcncm_driver_s *self,
1727
1752
}
1728
1753
1729
1754
netdev_lower_carrier_on (& self -> dev );
1730
- work_queue (ETHWORK , & self -> notifywork , ncm_do_notify , self ,
1755
+ work_queue (ETHWORK , & self -> notifywork , cdcncm_notify_worker , self ,
1731
1756
MSEC2TICK (100 ));
1732
1757
}
1733
1758
else
0 commit comments