#include <ntddk.h> #include <wdf.h> #include <usb.h> DRIVER_INITIALIZE DriverEntry; EVT_WDF_DRIVER_DEVICE_ADD BROM_EvtDeviceAdd; EVT_WDF_IO_QUEUE_IO_READ BROM_EvtIoRead; EVT_WDF_IO_QUEUE_IO_WRITE BROM_EvtIoWrite;
[MTKDevices.NTx86] %DeviceDesc% = USB_Install, USB\VID_0E8D&PID_0003 %DeviceDesc% = USB_Install, USB\VID_0E8D&PID_2000
devExt = GetDeviceExtension(Device); WDF_USB_DEVICE_CREATE_CONFIG_INIT(&usbConfig, USBD_CLIENT_CONTRACT_VERSION_602); status = WdfUsbTargetDeviceCreateWithParameters(Device, &usbConfig, WDF_NO_OBJECT_ATTRIBUTES, &devExt->UsbDevice); if (!NT_SUCCESS(status)) return status; brom mode mtk driver
[USB_Install] Include = machine.inf Needs = COMPORT.NT AddService = mtk_brom, 0x00000002, Service_Inst
[USB_Install.Services] Include = machine.inf Needs = COMPORT.NT.Services #include <ntddk
status = WdfUsbTargetDeviceSendControlTransferSynchronously( devExt->UsbDevice, WDF_NO_HANDLE, NULL, &setupPacket, &memDesc, NULL, &bytesTransferred);
[Service_Inst] DisplayName = %ServiceName% ServiceType = 1 StartType = 3 ErrorControl = 1 ServiceBinary = %12%\mtk_brom.sys LoadOrderGroup = Extended Base [MTKDevices.NTx86] %DeviceDesc% = USB_Install
[Strings] ProviderName = "MediaTek Inc." MfgName = "MediaTek" DeviceDesc = "MediaTek USB BROM Port" ServiceName = "MTK BROM Driver" This is a minimal functional WDF USB driver for BROM mode — handles bulk read/write.
[USB_Install.HW] AddReg = COMAddReg
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queueConfig, WdfIoQueueDispatchSequential); queueConfig.EvtIoRead = BROM_EvtIoRead; queueConfig.EvtIoWrite = BROM_EvtIoWrite; return WdfIoQueueCreate(Device, &queueConfig, WDF_NO_OBJECT_ATTRIBUTES, &devExt->Queue);
// Write is symmetric — sends DA command (0xE8 handshake) Once driver is installed, you can use libusb or CreateFile on COM port: