diff --git a/core/common/src/hdf_attribute.c b/core/common/src/hdf_attribute.c index d404c899..f9c334be 100644 --- a/core/common/src/hdf_attribute.c +++ b/core/common/src/hdf_attribute.c @@ -8,16 +8,9 @@ #include "hdf_attribute_manager.h" #include "devhost_service_clnt.h" -#include "devmgr_service.h" -#include "hcs_blob_if.h" -#include "hcs_parser.h" #include "hcs_tree_if.h" -#include "hdf_base.h" -#include "hdf_device_info.h" #include "hdf_host_info.h" #include "hdf_log.h" -#include "osal_mem.h" -#include "securec.h" #ifdef LOSCFG_DRIVERS_HDF_USB_PNP_NOTIFY #include "usb_pnp_manager.h" #endif @@ -243,4 +236,4 @@ int HdfAttributeManagerGetDeviceList(struct DevHostServiceClnt *hostClnt) } return HDF_SUCCESS; -} +} \ No newline at end of file diff --git a/core/host/src/devsvc_manager_clnt.c b/core/host/src/devsvc_manager_clnt.c index 87bc0cff..e2309184 100644 --- a/core/host/src/devsvc_manager_clnt.c +++ b/core/host/src/devsvc_manager_clnt.c @@ -7,10 +7,6 @@ */ #include "devsvc_manager_clnt.h" -#include "devmgr_service.h" -#include "devsvc_manager.h" -#include "hdf_attribute_manager.h" -#include "hdf_base.h" #include "hdf_log.h" #include "hdf_object_manager.h" diff --git a/core/host/src/hdf_device.c b/core/host/src/hdf_device.c index cce70f4b..0f9b2fb6 100644 --- a/core/host/src/hdf_device.c +++ b/core/host/src/hdf_device.c @@ -31,7 +31,7 @@ static int HdfDeviceAttach(struct IHdfDevice *devInst, struct HdfDeviceNode *dev // for dynamic added device node, assign device id here if (devNode->devId == 0) { devNode->devId = MK_DEVID(HOSTID(device->deviceId), DEVICEID(device->deviceId), - DlistGetCount(&device->devNodes)); + (uint32_t)DlistGetCount(&device->devNodes)); devNode->token->devid = devNode->devId; } diff --git a/core/host/src/hdf_device_object.c b/core/host/src/hdf_device_object.c index 9a805af1..e8238478 100644 --- a/core/host/src/hdf_device_object.c +++ b/core/host/src/hdf_device_object.c @@ -190,7 +190,9 @@ int HdfDeviceObjectRegister(struct HdfDeviceObject *dev) struct HdfDeviceNode *devNode = CONTAINER_OF(dev, struct HdfDeviceNode, deviceObject); struct IDriverLoader *driverLoader = HdfDriverLoaderGetInstance(); - if (dev == NULL || devNode->driverName == NULL || devNode->device == NULL) { + if (dev == NULL || devNode->driverName == NULL || devNode->device == NULL || driverLoader == NULL || + driverLoader->GetDriver == NULL) { + HDF_LOGE("failed to add device, param invalid"); return HDF_ERR_INVALID_PARAM; } diff --git a/core/host/src/hdf_driver_loader.c b/core/host/src/hdf_driver_loader.c index d7d06f63..9ce73922 100755 --- a/core/host/src/hdf_driver_loader.c +++ b/core/host/src/hdf_driver_loader.c @@ -19,7 +19,6 @@ int32_t HdfDriverEntryConstruct() struct HdfDriverEntry *driverEntry = NULL; size_t *addrBegin = NULL; int32_t count = (int32_t)(((uint8_t *)(HDF_DRIVER_END()) - (uint8_t *)(HDF_DRIVER_BEGIN())) / sizeof(size_t)); - if (count <= 0) { HDF_LOGE("%s: no hdf driver exist", __func__); return HDF_FAILURE; diff --git a/core/manager/src/devmgr_service.c b/core/manager/src/devmgr_service.c index 358b8956..674ccc2b 100644 --- a/core/manager/src/devmgr_service.c +++ b/core/manager/src/devmgr_service.c @@ -267,6 +267,7 @@ static int DevmgrServiceStartDeviceHost(struct DevmgrService *devmgr, struct Hdf static int DevmgrServiceStartDeviceHosts(struct DevmgrService *inst) { + uint32_t ret; struct HdfSList hostList; struct HdfSListIterator it; struct HdfHostInfo *hostAttr = NULL; @@ -279,7 +280,11 @@ static int DevmgrServiceStartDeviceHosts(struct DevmgrService *inst) HdfSListIteratorInit(&it, &hostList); while (HdfSListIteratorHasNext(&it)) { hostAttr = (struct HdfHostInfo *)HdfSListIteratorNext(&it); - DevmgrServiceStartDeviceHost(inst, hostAttr); + ret = DevmgrServiceStartDeviceHost(inst, hostAttr); + if (ret != HDF_SUCCESS) { + HDF_LOGW("%s failed to start device host, host id is %u, host name is '%s'", + __func__, hostAttr->hostId, hostAttr->hostName); + } } HdfSListFlush(&hostList, HdfHostInfoDelete); return HDF_SUCCESS; diff --git a/core/manager/src/devsvc_manager.c b/core/manager/src/devsvc_manager.c index 06e69de9..3c08149c 100644 --- a/core/manager/src/devsvc_manager.c +++ b/core/manager/src/devsvc_manager.c @@ -66,7 +66,7 @@ int DevSvcManagerAddService(struct IDevSvcManager *inst, const char *svcName, st int DevSvcManagerSubscribeService(struct IDevSvcManager *inst, const char *svcName, struct SubscriberCallback callBack) { - struct DevmgrService *devMgrSvc = (struct DevmgrService *)DevmgrServiceGetInstance();; + struct DevmgrService *devMgrSvc = (struct DevmgrService *)DevmgrServiceGetInstance(); struct HdfObject *deviceService = NULL; if (inst == NULL || svcName == NULL || devMgrSvc == NULL) { return HDF_FAILURE; diff --git a/core/manager/src/hdf_driver_installer.c b/core/manager/src/hdf_driver_installer.c index 655c6759..b972ce74 100644 --- a/core/manager/src/hdf_driver_installer.c +++ b/core/manager/src/hdf_driver_installer.c @@ -6,10 +6,8 @@ * See the LICENSE file in the root of this repository for complete details. */ -#include "hdf_attribute_manager.h" #include "hdf_driver_installer.h" #include "devhost_service.h" -#include "hdf_base.h" #include "hdf_log.h" #include "hdf_object_manager.h" diff --git a/test/unittest/manager/sample_driver_test.c b/test/unittest/manager/sample_driver_test.c index b0a69699..04e4ceb5 100644 --- a/test/unittest/manager/sample_driver_test.c +++ b/test/unittest/manager/sample_driver_test.c @@ -11,6 +11,7 @@ #include "hdf_device_object.h" #include "hdf_log.h" #include "hdf_pm.h" +#include "osal_file.h" #include "osal_mem.h" #define HDF_LOG_TAG sample_driver_test @@ -97,7 +98,8 @@ int32_t SampleDriverRegisterDevice(struct HdfDeviceObject *dev, struct HdfSBuf * return HDF_FAILURE; } - ret = HdfDeviceObjectPublishService(devObj, serviceName, SERVICE_POLICY_CAPACITY, 0664); + ret = HdfDeviceObjectPublishService(devObj, serviceName, SERVICE_POLICY_CAPACITY, + OSAL_S_IREAD | OSAL_S_IWRITE | OSAL_S_IRGRP | OSAL_S_IWGRP | OSAL_S_IROTH); if (ret != HDF_SUCCESS) { HDF_LOGE("faild to publish service for %s", serviceName); HdfDeviceObjectRelease(devObj); diff --git a/tools/hc-gen/src/macro_gen.cpp b/tools/hc-gen/src/macro_gen.cpp index b8c6ad7f..4858a0a2 100755 --- a/tools/hc-gen/src/macro_gen.cpp +++ b/tools/hc-gen/src/macro_gen.cpp @@ -241,11 +241,7 @@ void MacroGen::SetTypeData(uint32_t type, const std::shared_ptr &curr case PARSEROP_UINT16: case PARSEROP_UINT32: case PARSEROP_UINT64: { - if (arraySize != 0) { - GenArray(arrayName, arraySize, arrayType, current); - } else { - ofs_ << " " << current->IntegerValue() << std::endl; - } + SetTypeDataUinit64(arrayName, arraySize, arrayType, current); break; } case PARSEROP_STRING: @@ -284,3 +280,13 @@ void MacroGen::SetTypeData(uint32_t type, const std::shared_ptr &curr break; } } + +void MacroGen::SetTypeDataUinit64(const std::string &arrayName, uint32_t &arraySize, uint32_t arrayType, + const std::shared_ptr ¤t) +{ + if (arraySize != 0) { + GenArray(arrayName, arraySize, arrayType, current); + } else { + ofs_ << " " << current->IntegerValue() << std::endl; + } +} \ No newline at end of file diff --git a/tools/hc-gen/src/macro_gen.h b/tools/hc-gen/src/macro_gen.h index af557494..9325d3e1 100755 --- a/tools/hc-gen/src/macro_gen.h +++ b/tools/hc-gen/src/macro_gen.h @@ -36,6 +36,9 @@ private: void SetTypeData(uint32_t type, const std::shared_ptr ¤t, uint32_t &arraySize, uint32_t depth); + void SetTypeDataUinit64(const std::string &arrayName, uint32_t &arraySize, uint32_t arrayType, + const std::shared_ptr ¤t); + bool HeaderTopOutput(); bool HeaderBottomOutput();