diff --git a/README.md b/README.md index 76110789e882b17302a0afa8279e3821f5a34021..cda25ee621ce253e2265ba681c1a159f17330e3f 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ int32_t SampleDriverBind(struct HdfDeviceObject *deviceObject) int32_t SampleDriverInit(struct HdfDeviceObject *deviceObject) { // TODO: Init hardware or other resources here. - return HDF_S UCCESS; + return HDF_SUCCESS; } ``` @@ -143,7 +143,7 @@ For details, see [Touchscreen Overview](en-us_topic_0000001052857350.md). ### WLAN -The WLAN module is developed based on the HDF and supports cross-OS migration, component adaptation, and modular assembly and compilation. Based on the unified APIs provided by the WLAN module, driver developers of WLAN vendors can adapt their driver code and developers of the HarmonyOS Driver Interfaces \(HDIs\) are capable of creating, disabling, scanning, and connecting to WLAN hotspots. +The WLAN module is developed based on the HDF and supports cross-OS migration, component adaptation, and modular assembly and compilation. Based on the unified APIs provided by the WLAN module, driver developers of WLAN vendors can adapt their driver code and developers of the Hardware Driver Interfaces \(HDIs\) are capable of creating, disabling, scanning, and connecting to WLAN hotspots. - APIs for implementing WLAN driver module capabilities: Implement the APIs of the WLAN HDI layer and provide capabilities of setting/obtaining the MAC address, obtaining the feature type, and setting the transmit power for upper-layer input services, as well as the capabilities of creating/releasing a **WifiModule**, connecting to/disconnecting from a WLAN hotspot, and applying for/releasing a **NetBuf** for developers. - APIs to be implemented by developers: Based on the provided platform driver, complete the board-level HCS configuration as well as the differentiated WLAN configuration, and offer APIs for initializing, deregistering, enabling, and disabling a network device. diff --git a/README_zh.md b/README_zh.md index e9d3ef0df4f747db495cc57d31725664d052de38..97548d00f8507f0fd1514808edcdf7ee7da98164 100644 --- a/README_zh.md +++ b/README_zh.md @@ -98,7 +98,7 @@ Init接口描述:当框架完成设备绑定动作后,就开始调用驱动 int32_t SampleDriverInit(struct HdfDeviceObject *deviceObject) { // TODO: Init hardware or other resources here. - return HDF_S UCCESS; + return HDF_SUCCESS; } ``` diff --git a/ability/sbuf/src/hdf_sbuf.c b/ability/sbuf/src/hdf_sbuf.c index 57b4944a3ae98a416e8709ec9ee5edc77c71ad25..60341b0da4a87a7c0879e738d883a09dfbcc5952 100644 --- a/ability/sbuf/src/hdf_sbuf.c +++ b/ability/sbuf/src/hdf_sbuf.c @@ -414,7 +414,7 @@ struct HdfSBuf *HdfSBufCopy(const struct HdfSBuf *sbuf) new->capacity = sbuf->capacity; new->readPos = 0; new->writePos = sbuf->writePos; - if (memcpy_s(new->data, new->capacity, sbuf->data, sbuf->capacity) != EOK) { + if (memcpy_s(new->data, new->capacity, sbuf->data, sbuf->writePos) != EOK) { HdfSBufRecycle(new); return NULL; } diff --git a/core/adapter/syscall/src/hdf_syscall_adapter.c b/core/adapter/syscall/src/hdf_syscall_adapter.c index cefcaa3e24e5e625faa3316e72c56e06a5353b39..2848d39c7ab35c65523c175464ddfd202cdba423 100644 --- a/core/adapter/syscall/src/hdf_syscall_adapter.c +++ b/core/adapter/syscall/src/hdf_syscall_adapter.c @@ -209,6 +209,14 @@ static int32_t AssignPfds(struct HdfDevListenerThread *thread, struct pollfd **p return pfdCount; } +static void HdfDevListenerThreadFree(struct HdfDevListenerThread *thread) +{ + OsalMutexDestroy(&thread->mutex); + OsalMemFree(thread->pfds); + OsalThreadDestroy(&thread->thread); + OsalMemFree(thread); +} + #define POLL_WAIT_TIME_MS 100 static int32_t HdfDevEventListenTask(void *para) { @@ -255,10 +263,7 @@ exit: if (thread->shouldStop) { /* exit due to async exit call, should free thread struct */ - OsalMutexDestroy(&thread->mutex); - OsalThreadDestroy(&thread->thread); - OsalMemFree(thread->pfds); - OsalMemFree(thread); + HdfDevListenerThreadFree(thread); } return HDF_SUCCESS; @@ -575,14 +580,6 @@ static void HdfListenThreadPollDel(struct HdfDevListenerThread *thread, struct OsalMutexUnlock(&thread->mutex); } -static void HdfDevListenerThreadFree(struct HdfDevListenerThread *thread) -{ - OsalMutexDestroy(&thread->mutex); - OsalMemFree(thread->pfds); - OsalThreadDestroy(&thread->thread); - OsalMemFree(thread); -} - static void HdfDevListenerThreadDestroy(struct HdfDevListenerThread *thread) { if (thread == NULL) { diff --git a/core/common/src/hdf_attribute.c b/core/common/src/hdf_attribute.c index 715832658535c6ef61a4538b364f2e1c73787caa..1d696fabc073a993c6e437525f9e554caa4dd8d3 100644 --- a/core/common/src/hdf_attribute.c +++ b/core/common/src/hdf_attribute.c @@ -323,11 +323,7 @@ bool HdfDeviceListAdd(const char *moduleName, const char *serviceName) if (svcName == NULL) { break; } - if (strcpy_s(svcName, strlen(serviceName) + 1, serviceName) != EOK) { - HDF_LOGE("%s: string copy fail", __func__); - OsalMemFree(svcName); - break; - } + strcpy(svcName, serviceName); deviceNodeInfo->svcName = svcName; HdfSListAdd(hostClnt->deviceInfos, &deviceNodeInfo->node); hostClnt->devCount++; diff --git a/include/core/hdf_device_desc.h b/include/core/hdf_device_desc.h index 9c64aa6f7f0a6640ac3528e593dd119f672b35e3..9c55e21cc55105d1fc0c43681742265b0e24c8db 100644 --- a/include/core/hdf_device_desc.h +++ b/include/core/hdf_device_desc.h @@ -254,7 +254,7 @@ struct HdfDriverEntry { /** * @brief Obtains the driver service object based on a driver service name. * - * @param serviceName Indicates the pointer to the released driver service name. + * @param svcName Indicates the pointer to the released driver service name. * * @return Returns the driver service object if the operation is successful; returns NULL otherwise. * @since 1.0 diff --git a/tools/hc-gen/bin/hc-gen b/tools/hc-gen/bin/hc-gen new file mode 100755 index 0000000000000000000000000000000000000000..196de1293733a24442bb4937cf670066b108a76a Binary files /dev/null and b/tools/hc-gen/bin/hc-gen differ