// controlComplete handles the setup completion of control endpoint 0.
controlComplete handles the setup completion of control endpoint 0.
// controlComplete handles the setup completion of control endpoint 0 .
func (d *dcd) controlComplete(status uint32) {
	d.controlMask = 0
	switch d.setup.bmRequestType & descRequestTypeTypeMsk {
	case descRequestTypeTypeClass:
		switch d.setup.bmRequestType &
			(descRequestTypeRecipientMsk | descRequestTypeDirMsk) {
		case descRequestTypeRecipientInterface | descRequestTypeDirOut:
			switch d.setup.bRequest {
			case descCDCRequestSetLineCoding:
				switch d.cc.id {
				case classDeviceCDCACM:
					acm := &descCDCACM[d.cc.config-1]
					switch d.setup.wIndex {
					case descCDCACMInterfaceCtrl:
						d.uartSetLineCoding(descCDCACMLineCoding{
							baud:     packU32(acm.cx[:]),
							stopBits: acm.cx[4],
							parity:   acm.cx[5],
							numBits:  acm.cx[6],
						})
					default:
					}
				default:
				}
			case descHIDRequestSetReport:
				switch d.cc.id {
				case classDeviceHID:
					hid := &descHID[d.cc.config-1]
					switch d.setup.wIndex {
					 Keyboard Interface
					case descHIDInterfaceKeyboard:
						switch d.setup.wValue >> 8 {
						case descTypeConfigure:
							if 1 == d.setup.wLength {
								hid.keyboard.led = hid.cx[0]
								d.controlTransmit(uintptr(0), 0, false)
							}
						default:
						}
					 Serial Interface
					case descHIDInterfaceSerial:
						switch d.setup.wValue >> 8 {
						case descTypeString:
							if d.setup.wLength >= 4 && 0x68C245A9 == packU32(hid.cx[0:4]) {
								d.enableSOF(true, descHIDInterfaceCount)
							}
						default:
						}
					default:
					}
				default:
				}
			default:
			}
		default:
		}
	default:
		 type
	}
}
func ( d * dcd ) controlComplete ( status uint32 ) { d . controlMask = 0 switch d . setup . bmRequestType & descRequestTypeTypeMsk { case descRequestTypeTypeClass : switch d . setup . bmRequestType & ( descRequestTypeRecipientMsk | descRequestTypeDirMsk ) { case descRequestTypeRecipientInterface | descRequestTypeDirOut : switch d . setup . bRequest { case descCDCRequestSetLineCoding : switch d . cc . id { case classDeviceCDCACM : acm := & descCDCACM [ d . cc . config - 1 ] switch d . setup . wIndex { case descCDCACMInterfaceCtrl : d . uartSetLineCoding ( descCDCACMLineCoding { baud : packU32 ( acm . cx [ : ] ) , stopBits : acm . cx [ 4 ] , parity : acm . cx [ 5 ] , numBits : acm . cx [ 6 ] , } ) default : } default : } case descHIDRequestSetReport : switch d . cc . id { case classDeviceHID : hid := & descHID [ d . cc . config - 1 ] switch d . setup . wIndex { case descHIDInterfaceKeyboard : switch d . setup . wValue >> 8 { case descTypeConfigure : if 1 == d . setup . wLength { hid . keyboard . led = hid . cx [ 0 ] d . controlTransmit ( uintptr ( 0 ) , 0 , false ) } default : } case descHIDInterfaceSerial : switch d . setup . wValue >> 8 { case descTypeString : if d . setup . wLength >= 4 && 0x68C245A9 == packU32 ( hid . cx [ 0 : 4 ] ) { d . enableSOF ( true , descHIDInterfaceCount ) } default : } default : } default : } default : } default : } default : } }
controlComplete handles the setup completion of control endpoint 0.
controlComplete handles the setup completion of control endpoint 0 .
// Reset endpoint 0 notify mask // First, switch on the type of request (standard, class, or vendor) // === CLASS REQUEST === // Switch on the recepient and direction of the request // --- INTERFACE Rx (OUT) --- // Identify which request was received // CDC | SET LINE CODING (0x20): // Respond based on our device class configuration // CDC-ACM (single) // Determine interface destination of the request // CDC-ACM Control Interface: // Notify PHY to handle triggers like special baud rates, which // signal to reboot into bootloader or begin receiving OTA updates // Unhandled device interface // Unhandled device class // HID | SET REPORT (0x09) // Respond based on our device class configuration // HID // Determine interface destination of the request // HID Keyboard Interface // Determine the type of descriptor being requested // Configuration descriptor // Unhandled descriptor type // HID Serial Interface // Determine the type of descriptor being requested // String descriptor // Unhandled descriptor type // Unhandled device interface // Unhandled device class // Unhandled request // Unhandled recepient or direction // Unhandled request type