void CRemConAbsoluteVolumeTarget::MrcibNewMessage(TUint aOperationId, 
		const TDesC8& aData, 
		TRemConMessageSubType aMsgSubType)
	{
	LOG_FUNC
	LOG2(KLogFormat, aOperationId, aData.Length());

	switch(aOperationId)
		{
	case KRemConSetAbsoluteVolume:
		{
		ProcessSetAbsoluteVolume(aData);
		break;
		}
	case KRemConAbsoluteVolumeNotification:
		{
		// register for Notifications
		if (aMsgSubType == ERemConNotifyCommandAwaitingInterim)
			{
			ProcessGetStatusAndBeginObserving();
			}
		else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged)
			{
			ProcessGetStatus();
			}
	 	break;
		}
	default:
		break; 
		};
	}
示例#2
0
static
void
ProcessSetupPacket(
    USB_DEVICE_REQUEST* pUdr,
    BOOL* pfProcessRndisMsg
    )
{
    BOOL fSendRecvStatusACK = TRUE;
    DWORD dwSuccess;

    USBDBGMSG(USBDBG_ZONE_FUNC, (L"usbdbg: +ProcessSetupPacket\r\n"));

    *pfProcessRndisMsg = FALSE;

    // class/vendor request
    //
    if (pUdr->bmRequestType & (USB_REQUEST_CLASS | USB_REQUEST_VENDOR))
    {
        switch (pUdr->bRequest) {

            case SEND_ENCAPSULATED_COMMAND:
                USBDBGMSG(USBDBG_ZONE_VERBOSE, (
                    L"UsbDbg:Setup request [SEND_ENCAPSULATED_COMMAND]\r\n"
                    ));

                // read the rndis msg from PDD
                dwSuccess = SendRecvData(CONTROL_ENDPT,
                                          ENDPT_DIR_RX,
                                          m_ep0MsgRxBuffer,
                                          pUdr->wLength,
                                          0);

                fSendRecvStatusACK = (dwSuccess == ERROR_SUCCESS);
                if (dwSuccess == ERROR_SUCCESS)
                {
                    // This is a RNDIS message. Set flag to process it
                    *pfProcessRndisMsg = TRUE;
                }
                break;

            case GET_ENCAPSULATED_RESPONSE:
                USBDBGMSG(USBDBG_ZONE_VERBOSE, (
                    L"UsbDbg:Setup request [GET_ENCAPSULATED_RESPONSE]\r\n"
                ));
                fSendRecvStatusACK = SendPendingRndisMsg();
                break;

            default:
                USBDBGMSG(USBDBG_ZONE_ERROR, (
                    L"ERROR!UsbDbg:Unrecognized Setup request. "
                    L"bmRequestType=0x%x. bRequest=0x%x\r\n",
                    pUdr->bmRequestType,
                    pUdr->bRequest
                ));
                break;
        }
    }

    //a standard request
    //
    else
    {
        switch(pUdr->bRequest) {
            case USB_REQUEST_GET_STATUS:
                if((pUdr->bmRequestType ==  (USB_REQUEST_DEVICE_TO_HOST |USB_REQUEST_FOR_DEVICE))
                    ||(pUdr->bmRequestType ==  (USB_REQUEST_DEVICE_TO_HOST |USB_REQUEST_FOR_INTERFACE))  )
                {
                    fSendRecvStatusACK = ProcessGetStatus(pUdr);
                }
                else
                {
                    USBDBGMSG(USBDBG_ZONE_WARN, (
                        L"WARN!UsbDbg:RequestType==0x%d, Unrecognzied"
                        L"or unsupported request\r\n", pUdr->bmRequestType
                        ));
                }
                break;

            case USB_REQUEST_CLEAR_FEATURE:
                if (pUdr->bmRequestType == 0x02)
                    USBDBGMSG(USBDBG_ZONE_WARN, (
                        L"WARN!UsbDbg:***RequestType==0x02\r\n"
                        ));
                break;

            case USB_REQUEST_SET_FEATURE:
                if (pUdr->bmRequestType == 0x02)
                    USBDBGMSG(USBDBG_ZONE_WARN, (
                        L"WARN!usbdbg:***RequestType==0x02\r\n"));
                break;

            case USB_REQUEST_SET_ADDRESS:
                USBDBGMSG(USBDBG_ZONE_VERBOSE, (
                    L"usbdbg:Recvd. USB_REQUEST_SET_ADDRESS.\r\n"));
                m_pddIfc.pfnIoctl(   // Call the PDD so it can handle the request
                        USBDBG_PDD_IOCTL_SET_ADDRESS,
                        &pUdr->wValue,
                        sizeof(pUdr->wValue),
                        NULL,
                        0,
                        NULL);

                break;

            case USB_REQUEST_GET_DESCRIPTOR:
                fSendRecvStatusACK = SendDescriptor(pUdr);
                break;

            case USB_REQUEST_SET_DESCRIPTOR:
                break;

            case USB_REQUEST_GET_CONFIGURATION:
                break;

            case USB_REQUEST_SET_CONFIGURATION:
                USBDBGMSG(USBDBG_ZONE_VERBOSE, (
                     L"usbdbg:Recvd. USB_REQUEST_SET_CONFIGURATION.\r\n"));
                m_pddIfc.pfnIoctl( // Call the PDD so it can handle the request
                     USBDBG_PDD_IOCTL_SET_CONFIGURATION,
                     &(pUdr->wValue),
                     sizeof(pUdr->wValue),
                     NULL,
                     0,
                     NULL);
                break;

            case USB_REQUEST_GET_INTERFACE:
                break;

            case USB_REQUEST_SET_INTERFACE:
                break;

            case USB_REQUEST_SYNC_FRAME:
                break;

            default:
                USBDBGMSG(USBDBG_ZONE_WARN, (
                    L"WARN!usbdbg:***Unknown request 0x%x\r\n", pUdr->bRequest
                ));
        }
    }   // end of else for standard request

    if (fSendRecvStatusACK)
    {
        if (USBFN_IS_OUT_REQUESTTYPE(pUdr->bmRequestType))//Host->Device request
            SendControlStatusHandshake();
        else    // Device->Host request
            RecvControlStatusHandshake();
    }
    USBDBGMSG(USBDBG_ZONE_FUNC, (L"usbdbg: -ProcessSetupPacket\r\n"));

}