代码拉取完成,页面将自动刷新
需要把ioService的绑定流程重构到HdfUartSampleBind方法中
static int32_t SampleAttach(struct UartHost *host, struct HdfDeviceObject *device)
{
int32_t ret;
struct UartDevice *uartDevice = NULL;
if (device->property == NULL) {
HDF_LOGE("%s: property is NULL", __func__);
return HDF_FAILURE;
}
uartDevice = (struct UartDevice *)OsalMemCalloc(sizeof(struct UartDevice));
if (uartDevice == NULL) {
HDF_LOGE("%s: OsalMemCalloc uartDevice error", __func__);
return HDF_ERR_MALLOC_FAIL;
}
SampleDispatchConstruct(uartDevice);
device->service = &uartDevice->ioService; // 服务应该在HdfUartSampleBind方法中进行绑定
ret = UartDeviceGetResource(uartDevice, device->property);
if (ret != HDF_SUCCESS) {
(void)OsalMemFree(uartDevice);
return HDF_FAILURE;
}
host->num = uartDevice->resource.num;
host->priv = uartDevice;
UartSampleAddDev(host);
return UartDeviceInit(uartDevice);
}
登录 后才可以发表评论