Commit graph

20 commits

Author SHA1 Message Date
Roy Luo
7c074a6c3c Use absolute path for udc device
Avoid search in /sys/class/udc directory

Bug: 339241080
Test: tested on gs201
Flag: EXEMPT bugfix
Change-Id: Iad74cae0d6ad6887d79d705dc8478f1b44532503
2024-07-09 03:03:33 +00:00
Jacky Liu
8548e9b2be Update i2c device paths
Update i2c device paths with static bus numbers.
Also remove some redundant paths.

Bug: 323447554
Test: Boot to home
Change-Id: Id3f0fccd39b70d247c0d7a17a1944223619ec40e
2024-02-07 04:00:46 +00:00
Jacky Liu
21dc8acdaa Revert "usb: Select usb-service rc files based on kernel versions"
This reverts commit 2371ea7920.

Use the same i2c device paths across all kernel versions.

Bug: 323447554
Change-Id: I0f970347a09e01f272a54fc7c940ea576a9e510b
Signed-off-by: Jacky Liu <qsliu@google.com>
2024-02-06 16:18:27 +00:00
Kyle Tso
2371ea7920 usb: Select usb-service rc files based on kernel versions
The sysfs paths in the rc file differ across kernel versions or build
targets. Given that the path is static in the newer kernels (6.1+),
modify the paths for newer kernels in the original rc file and create
another rc file for older kernels (i.e kernel 5.10). Put the correct rc
file to the vendor partition based on kernel versions.

Bug: 317946158
Change-Id: Ie313664ee14c837bc9f33113e9341f6e06192401
Signed-off-by: Kyle Tso <kyletso@google.com>
2024-02-03 01:14:43 +00:00
Kyle Tso
9bafd5f134 usb: Runtime search the i2c path
The paths of sysfs nodes are different on multiple build targets and are
also different between the old kernel (5.10) and newer kernel (6.1).
Since usb HAL code is shared by those targets and different kernel
versions, Runtime search the correct paths.

Bug: 317946158
Change-Id: I676455145232fd71db1578bb7a9801fed7bb327f
Signed-off-by: Kyle Tso <kyletso@google.com>
2024-02-03 01:14:43 +00:00
Amit Sunil Dhamne
d8e2a02998 UsbGadget: Update SDP enum timeout when gadget is pulled up
Indicate to the kernel that the usb gadget is pulled up
by writing to `update_sdp_enum_timeout` sysfs node. Write
to this node will inform the kernel that it can lower the SDP
timeout alarm value which is used to detect an SDP port
vs a DCP.

Bug:275687235
Test: Check `update_sdp_enum_timeout` is written into after usb
gadget is pulled up. Verify that the alarm timeout lowers.

Change-Id: Id3ae7e7a20b236cec6604414a7f81860e868bdd0
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
2023-09-20 16:24:35 +00:00
Ricky Niu
f14cbd6370 Add resetCb
Add the resetCb to complete asynchronous

Bug: 267252826
Test: Boot to home and function work
Change-Id: I9d6624cbe15c86c63e28f8f176d7c560aed8446f
2023-02-09 02:02:50 +00:00
Ricky Niu
5c7e338667 Fix up open bugs from gs201 AIDL migration
1. Remove unused group "wakelock".
2. Correct the right return value on setCurrentUsbFunctions.

Bug: 266694076
Test: Boot to home and function work
Change-Id: If0925a61e481e4deca560dc8dfc1be80a76c148f
2023-02-07 08:55:20 +00:00
Avichal Rakesh
72dbe87c42 UsbGadget: Add support for UVC function
UVC is a new USB function supported in Android. This CL adds UVC as a
valid function and gives it a new pid of 0x4ee[de]. UVC function is
guarded by the property `ro.usb.uvc.enabled`. When this property is set
to false, UVC won't be considered as a valid gadget function.

Bug: 242344221
Test: Manually tested that the UVC function is successfully configured
Change-Id: I7ce1cc192c09b5f3cd7c73405fe54426a1311dfb
2023-02-06 21:20:59 +00:00
Avichal Rakesh
9ba92eed60 Migrate IUsbGadget implementation to AIDL
This change migrates IUsbGadget implementation to AIDL.
Port of commit <d6d0b7d2ca5066988ee90889dccd00c06d64b694>.

Bug: 218791946
Test: USB function switch success and AIDL service is running.
Change-Id: I9613178d3cd2f9abd5396e4af763a257a8ef62a7
2023-01-26 20:18:09 +00:00
Ricky Niu
6d0bb7f43d usb: Correct the i2c path
Correct the I2C path to match the new memory address setting.

Test: Connect to HU work
Bug: 233996502

Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I27cca56698568e8a3060d9e40bad3a29ec072588
2022-05-30 03:06:56 +00:00
Ricky Niu
0eefbf303b usb: limit the current to 1.3A when connect to accessory am: e6cacbcff2
Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs201/+/18527913

Change-Id: I33790e25c4d57d2af41492f2f263c8124ea2ebf3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-24 01:01:25 +00:00
Ricky Niu
e6cacbcff2 usb: limit the current to 1.3A when connect to accessory
For imporve USB stability, limit the current to 1.3A,
when connect to accessory.

Bug: 206635552
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I2c1091aa7111e6242cc949923fbc86f27e54e976
2022-05-23 23:59:44 +00:00
Ray Chi
ee5795e850 usb: change function sequence if debug functions are enabled
On Windows platforms, wrong function sequnce will cause usb
driver installing not working. This patch will modify the
function sequence when debug functions are enabled.

Bug: 228800277
Test: tethering is working when debug functions are enabled.
Change-Id: I9f8b02354617b08a34fb4641ac710f32dabc643e
2022-04-14 03:59:15 +00:00
Ricky Niu
7d413565cd usb: Add dm condition in NCM
Add vid/pid 04e8/6862 for dm condition in NCM

Test: The usb gadget functions work normally
Bug: 226682477

Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I263f125d2ff961a6967b5b536c71fcbdcd87ed05
2022-03-25 10:34:56 +00:00
Ray Chi
f363704a92 tune usb irq (dwc3) in usb gadget hal
Since affinity permission is changed from root to system, original
permission change by script can't be used. Therefore, this patch
will move the functionality to usb gadget hal.

Bug: 220996010
Test: dwc3 irq could be located in medium/big cores after USB function switch
Change-Id: Id993db9fc303e85a9a6337a0e41b1dfd6fc9a86a
2022-03-07 07:45:50 +00:00
Ray Chi
b30924e359 usb: move the permission change to usb rc
Since permission change in hal rc may be late, gadget
hal would enable USB function failed. The solution will
change the permission before USB gadget hal starts.

Bug: 206902205
Test: build pass and verified pass
Change-Id: I45c1318f647220480fa03ba3b813a81b21393d71
2022-03-07 07:45:50 +00:00
Bob Badour
e3710a9f34 [LSC] Add LOCAL_LICENSE_KINDS
Added SPDX-license-identifier-Apache-2.0 to:
  usb/gadget/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Change-Id: Idea66093348d8c7e4a63b35e5f25a6d8bab9439a
2022-03-03 11:19:46 -08:00
Ray Chi
ef1c863453 Revert "usb: modify the permission of USB gadget hal"
This reverts commit bdd4728a17.

Reason for revert: original issue is fixed.

Bug: 206902205
Test: adb work without the error of gadget hal.
Change-Id: I3b7ab36f93e8bb7d6c23d53d4a12ed95d441fede
2022-03-01 18:33:17 +08:00
Badhri Jagan Sridharan
a1deb18dfb Migrate IUsb implementation to AIDL
Cherry-pick of <775523d1eb>

This change migrates IUsb implementation to AIDL.
Also, IUsb and IUsbGadget now run in its own processes
to improve stability and isolation.

Bug: 200993386
Change-Id: I02753af4a41916b77ce110f9531504bf8c6a4691
Merged-In: I02753af4a41916b77ce110f9531504bf8c6a4691
2022-03-01 03:32:23 +00:00