From 73d1b82d82d2158382b4aaed6b378e0f0d9dd5d4 Mon Sep 17 00:00:00 2001 From: YWD Date: Sat, 26 Oct 2024 17:52:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E4=B8=AAUSBPort?= =?UTF-8?q?s=E7=AE=A1=E7=90=86=E5=92=8CRole=E5=88=87=E6=8D=A2=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YWD --- usb/v1_0/IUsbInterface.idl | 10 ++++++++++ usb/v1_0/UsbTypes.idl | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/usb/v1_0/IUsbInterface.idl b/usb/v1_0/IUsbInterface.idl index e3d63786..6ef0758b 100644 --- a/usb/v1_0/IUsbInterface.idl +++ b/usb/v1_0/IUsbInterface.idl @@ -404,6 +404,16 @@ interface IUsbInterface { */ QueryPort([out] int portId, [out] int powerRole, [out] int dataRole, [out] int mode); + /* * + * @brief Query the current settings of the device port list. + * + * @param portList is the detailed information of all ports on the current device. + * + * @return Returns 0 if the operation is successful; returns a non-0 value if the operation fails. + * @since 3.2 + */ + QueryPorts([out] struct UsbPort[] portList); + /* * * @brief Binds a subscriber. * diff --git a/usb/v1_0/UsbTypes.idl b/usb/v1_0/UsbTypes.idl index 055480eb..f89964a6 100644 --- a/usb/v1_0/UsbTypes.idl +++ b/usb/v1_0/UsbTypes.idl @@ -44,6 +44,8 @@ struct PortInfo { int powerRole; int dataRole; int mode; + int isConnected; + int supportedRoleCombinations; }; struct UsbDev { @@ -68,4 +70,18 @@ struct USBDeviceInfo { int status; int busNum; int devNum; +}; + +struct UsbPortStatus { + int currentMode; + int currentPowerRole; + int currentDataRole; + int isConnected; + int supportedRoleCombinations; +}; + +struct UsbPort { + int id; + int supportedModes; + UsbPortStatus usbPortStatus; }; \ No newline at end of file -- Gitee From f90a293294d0624df509e805b11a50bbf43526ee Mon Sep 17 00:00:00 2001 From: YWD Date: Wed, 13 Nov 2024 11:01:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=9APort=E7=AE=A1=E7=90=86=E5=92=8CRol?= =?UTF-8?q?e=E5=88=87=E6=8D=A2=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YWD --- usb/v1_0/IUsbdSubscriber.idl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usb/v1_0/IUsbdSubscriber.idl b/usb/v1_0/IUsbdSubscriber.idl index c484dfbc..68eae197 100644 --- a/usb/v1_0/IUsbdSubscriber.idl +++ b/usb/v1_0/IUsbdSubscriber.idl @@ -42,6 +42,5 @@ import ohos.hdi.usb.v1_0.UsbTypes; DeviceEvent([in] struct USBDeviceInfo info); - PortChangedEvent([in] struct PortInfo info); - + PortChangedEvent([in] struct UsbPort[] PortListInfo); } \ No newline at end of file -- Gitee