diff --git a/usb/bundle.json b/usb/bundle.json
index 8fdca89e462c86820fdfaabe810191152b625471..f24c4ad401319df0858801c5a1fd96fc75285204 100644
--- a/usb/bundle.json
+++ b/usb/bundle.json
@@ -32,6 +32,7 @@
"sub_component": [
"//drivers/interface/usb/v1_0:usb_idl_target",
"//drivers/interface/usb/v1_1:usb_idl_target",
+ "//drivers/interface/usb/v1_2:usb_idl_target",
"//drivers/interface/usb/gadget/mtp/v1_0:usbfn_mtp_idl_target",
"//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target"
],
@@ -120,6 +121,27 @@
"header_files": [],
"header_base": "//drivers/interface/usb"
}
+ },
+ {
+ "name": "//drivers/interface/usb/v1_2:libusb_proxy_1.2",
+ "header": {
+ "header_files": [],
+ "header_base": "//drivers/interface/usb"
+ }
+ },
+ {
+ "name": "//drivers/interface/usb/v1_2:libusb_stub_1.2",
+ "header": {
+ "header_files": [],
+ "header_base": "//drivers/interface/usb"
+ }
+ },
+ {
+ "name": "//drivers/interface/usb/v1_2:usb_idl_headers_1.2",
+ "header": {
+ "header_files": [],
+ "header_base": "//drivers/interface/usb"
+ }
}
]
}
diff --git a/usb/v1_2/BUILD.gn b/usb/v1_2/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..243297f42227754250d44eb8147e377dafe2d1d6
--- /dev/null
+++ b/usb/v1_2/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright (c) 2025 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build/config/components/hdi/hdi.gni")
+if (defined(ohos_lite)) {
+ group("libusb_proxy_1.2") {
+ deps = []
+ public_configs = []
+ }
+} else {
+ hdi("usb") {
+ module_name = "usbd"
+ imports = [ "ohos.hdi.usb.v1_1:usb" ]
+
+ sources = [
+ "IUsbInterface.idl",
+ "IUsbdTransferCallback.idl",
+ "UsbTypes.idl",
+ ]
+
+ language = "cpp"
+ subsystem_name = "hdf"
+ part_name = "drivers_interface_usb"
+ }
+}
diff --git a/usb/v1_2/IUsbInterface.idl b/usb/v1_2/IUsbInterface.idl
new file mode 100644
index 0000000000000000000000000000000000000000..3618d5cc42498f470d16d5e12345fced54cb06cf
--- /dev/null
+++ b/usb/v1_2/IUsbInterface.idl
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* *
+ * @addtogroup HdiUsb
+ *
+ * @brief Provides unified APIs for usb services to access usb drivers.
+ *
+ * A usb service can obtain a usb driver object or agent and then call APIs provided by this object or agent to
+ * access different types of usb devices based on the usb IDs, thereby obtaining usb information,
+ * subscribing to or unsubscribing from usb data, enabling or disabling a usb,
+ * setting the usb data reporting mode, and setting usb options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ */
+
+/* *
+ * @file IUsbInterface.idl
+ *
+ * @brief Declares the APIs provided by the usb module for obtaining usb information, subscribing to or
+ * unsubscribing from usb data, enabling or disabling a usb, setting the usb data reporting mode,
+ * and setting usb options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ * @version 1.0
+ */
+
+package ohos.hdi.usb.v1_2;
+
+import ohos.hdi.usb.v1_2.UsbTypes;
+import ohos.hdi.usb.v1_2.IUsbdTransferCallback;
+import ohos.hdi.usb.v1_1.UsbTypes;
+import ohos.hdi.usb.v1_1.IUsbInterface;
+
+/* *
+ * @brief Defines the functions for performing basic operations on usb.
+ *
+ * The operations include obtaining usb information, subscribing to or unsubscribing from usb data,
+ * enabling or disabling a usb, setting the usb data reporting mode, and setting usb options such as
+ * the accuracy and measurement range.
+ */
+interface IUsbInterface extends ohos.hdi.usb.v1_1.IUsbInterface{
+
+ /* *
+ * @brief Submit usb async transfer.
+ *
+ * @param dev Indicates the USB device address.
+ * @param info Indicates the param info of the USB transfer.
+ * @param cb Indicates the callback function of base.
+ * @param ashmem Indicates the object of share memory
+ *
+ * @return Returns 0 if the operation is successful; returns a non-0 value if the operation fails.
+ * @since 5.1
+ * @version 1.0
+ */
+ UsbSubmitTransfer([in] struct UsbDev dev, [in] USBTransferInfo info, [in] IUsbdTransferCallback cb, [in] Ashmem ashmem);
+
+ /* *
+ * @brief Cancels the usb async transfer by endpoint.
+ *
+ * @param dev Indicates the USB device address.
+ * @param endpoint Indicates the endpoint address.
+ *
+ * @return Returns 0 if the operation is successful; returns a non-0 value if the operation fails.
+ * @since 5.1
+ * @version 1.0
+ */
+ UsbCancelTransfer([in] struct UsbDev dev, [in] int endpoint);
+}
\ No newline at end of file
diff --git a/usb/v1_2/IUsbdTransferCallback.idl b/usb/v1_2/IUsbdTransferCallback.idl
new file mode 100644
index 0000000000000000000000000000000000000000..b0eff187c4f7cd26905ded6763d9d8240e3dcac6
--- /dev/null
+++ b/usb/v1_2/IUsbdTransferCallback.idl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @addtogroup HdiUsb
+ *
+ * @brief Provides unified APIs for usb services to access usb drivers.
+ *
+ * A usb service can obtain a usb driver object or agent and then call APIs provided by this object or agent to
+ * access different types of usb devices based on the usb IDs, thereby obtaining usb information,
+ * subscribing to or unsubscribing from usb data, enabling or disabling a usb,
+ * setting the usb data reporting mode, and setting usb options such as the accuracy and measurement range.
+ *
+ * @version 1.0
+ */
+
+package ohos.hdi.usb.v1_2;
+
+import ohos.hdi.usb.v1_2.UsbTypes;
+
+/**
+ * @brief Defines the callback for reporting usb data. This callback needs to be registered when
+ * a usb user subscribes to usb data. Only after the usb is enabled, the usb data subscriber can receive
+ * usb data. For details, see {@link IUsbInterface}.
+ *
+ * @since 5.1
+ */
+[callback] interface IUsbdTransferCallback {
+
+ OnTransferWriteCallback([in] int status, [in] int actLength, [in] UsbIsoPacketDescriptor[] descs, [in] unsigned long userData);
+
+ OnTransferReadCallback([in] int status, [in] int actLength, [in] UsbIsoPacketDescriptor[] descs, [in] unsigned long userData);
+
+}
\ No newline at end of file
diff --git a/usb/v1_2/UsbTypes.idl b/usb/v1_2/UsbTypes.idl
new file mode 100644
index 0000000000000000000000000000000000000000..5fd57896b8b4b2b12fb0a200bd81346d13dff9ab
--- /dev/null
+++ b/usb/v1_2/UsbTypes.idl
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * @addtogroup HdiUsb
+ *
+ * @brief Provides unified APIs for usb services to access usb drivers.
+ *
+ * A usb service can obtain a usb driver object or agent and then call APIs provided by this object or agent to
+ * access different types of usb devices based on the usb IDs, thereby obtaining usb information,
+ * subscribing to or unsubscribing from usb data, enabling or disabling a usb,
+ * setting the usb data reporting mode, and setting usb options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ */
+
+/**
+ * @file UsbTypes.idl
+ *
+ * @brief Defines the data used by the usb module, including the usb information,
+ * and reported usb data.
+ *
+ * @since 5.1
+ * @version 1.0
+ */
+
+package ohos.hdi.usb.v1_2;
+
+import ohos.hdi.usb.v1_1.UsbTypes;
+
+struct UsbIsoPacketDescriptor {
+ int isoLength;
+ int isoActualLength;
+ int isoStatus;
+};
+
+struct USBTransferInfo {
+ int endpoint;
+ int flags;
+ int type;
+ int timeOut;
+ int length;
+ unsigned long userData;
+ unsigned int numIsoPackets;
+};
\ No newline at end of file