#include "mtp_thread.h"
#include "mtp_transport.h"
#include "mtp_event_handler.h"
+#include "mtp_init.h"
#include <sys/prctl.h>
#include <systemd/sd-daemon.h>
* FUNCTIONS
*/
+/* LCOV_EXCL_START */
static mtp_bool __io_init()
{
int ret;
if (sd_listen_fds(0) >= 4) {
+ DBG("socket-activated");
g_usb_ep0 = SD_LISTEN_FDS_START;
g_usb_ep_in = SD_LISTEN_FDS_START + 1;
g_usb_ep_out = SD_LISTEN_FDS_START + 2;
DBG(__FILE__ "(%s):%d: USB_PTPREQUEST_%s",
__func__, __LINE__, requests[ctrl->bRequest-0x64]);
if (wValue != 0 || wIndex != 0 || wLength != 6) {
- DBG("Invalid request parameters: wValue:%d wIndex:%d wLength:%d\n");
+ DBG("Invalid request parameters: wValue:%hu wIndex:%hu wLength:%hu\n", wIndex, wValue, wLength);
rc = -EINVAL;
goto stall;
}
if (status != -1 || errno != EL2HLT) {
ERR(__FILE__"(%s):%d:stall error\n",
- __func__, __LINE__, ctrl->bRequestType, ctrl->bRequest);
+ __func__, __LINE__);
rc = errno;
}
return rc;
event.u.setup.wLength);
__setup(g_usb_ep0, &event.u.setup);
break;
+ case FUNCTIONFS_ENABLE:
+ DBG("ENABLE");
+ _util_set_local_usb_status(MTP_PHONE_USB_CONNECTED);
+ break;
+ case FUNCTIONFS_DISABLE:
+ DBG("DISABLE");
+ _util_set_local_usb_status(MTP_PHONE_USB_DISCONNECTED);
+ _eh_send_event_req_to_eh_thread(EVENT_USB_REMOVED, 0, 0, NULL);
+ break;
}
} while (status > 0);
ERR("_transport_init_usb_device Fail");
continue;
}
+ } else if (err < 0 && errno == ESHUTDOWN) {
+ DBG("ESHUTDOWN");
} else {
ERR("Unknown error : %d, errno [%d] \n", err, errno);
break;
{
mtp_int32 len = 0;
msgq_ptr_t pkt = { 0 };
- msgq_id_t l_mqid = *(msgq_id_t *)mq_id;
+ msgq_id_t l_mqid;
ret_if(mq_id == NULL);
+ l_mqid = *(msgq_id_t *)mq_id;
_transport_set_control_event(PTP_EVENTCODE_CANCELTRANSACTION);
while (TRUE == _util_msgq_receive(l_mqid, (void *)&pkt,
sizeof(msgq_ptr_t) - sizeof(long), 1, &len)) {
return MTP_MAX_PACKET_SIZE_SEND_HS;
}
+/* LCOV_EXCL_STOP */
const mtp_usb_driver_t mtp_usb_driver_ffs = {