Commit graph

18 commits

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

Bug: 339241080
Test: tested on gs101
Flag: EXEMPT bugfix
Change-Id: Iad74cae0d6ad6887d79d705dc8478f1b44532503
2024-07-09 03:03:33 +00:00
Will McVicker
b54d8f91e3 usb: Update Usb and UsbGadget i2c logic
Update the logic to find the i2c bus number to use either the named i2c
devices or the static i2c bus numbers. This allows us to support both
cases -- v5.10 uses i2c-<devname> while v6.1 uses <i2c-bus#>-<reg>.

Bug: 291606723
Test: verify no errors from the usb services with v5.10 and v6.1
Change-Id: I6d41ac041ead68e72a3766e03d491bcd478468d3
2023-10-02 16:28:59 +00:00
Will McVicker
b1662cade2 init: update i2c bus numbers and move initialization to ueventd
Update the i2c bus numbers to use the statically assigned numbers
configured in the kernel device tree. In addition, use ueventd to set
the ACL for the i2c devices.

Bug: 291606723
Test: performance boot testing
Test: verify selinux labelling with ls -Z on the modified device nodes
Change-Id: Ib412510e4b6c086c978ad5487486323685732cae
2023-10-02 16:28:59 +00:00
Roy Luo
7bd4fdd98f Revert "init: update i2c bus numbers and move initialization to ..."
Revert submission 24855741-gs101-i2c-bus-fixes

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_main&target=bluejay-trunk_food-userdebug&lkgb=10876543&lkbb=10876988&fkbb=10876587, bug b/302549624.

Reverted changes: /q/submissionid:24855741-gs101-i2c-bus-fixes

Change-Id: I1c87ea91d0a2eaf441c554b8f4729cefd0eca068
BUG: 302549624
2023-09-28 18:00:06 +00:00
Roy Luo
dae6f56edd Revert "usb: Update Usb and UsbGadget i2c logic"
Revert submission 24855741-gs101-i2c-bus-fixes

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_main&target=bluejay-trunk_food-userdebug&lkgb=10876543&lkbb=10876988&fkbb=10876587, bug b/302549624.

Reverted changes: /q/submissionid:24855741-gs101-i2c-bus-fixes

Change-Id: I63de07348d45bd1a75e73da01f8ee402982cac30
BUG: 302549624
2023-09-28 18:00:07 +00:00
Will McVicker
901548943c usb: Update Usb and UsbGadget i2c logic
Update the logic to find the i2c bus number to use either the named i2c
devices or the static i2c bus numbers. This allows us to support both
cases -- v5.10 uses i2c-<devname> while v6.1 uses <i2c-bus#>-<reg>.

Bug: 291606723
Test: verify no errors from the usb services with v5.10 and v6.1
Change-Id: Ia68c424a3b6579457be6cfd0d07788e9da44a86e
2023-09-28 16:08:00 +00:00
Will McVicker
d9c462fc17 init: update i2c bus numbers and move initialization to ueventd
Update the i2c bus numbers to use the statically assigned numbers
configured in the kernel device tree. In addition, use ueventd to set
the ACL for the i2c devices.

Bug: 291606723
Test: performance boot testing
Test: verify selinux labelling with ls -Z on the modified device nodes
Change-Id: I579143fa38bc2e9b3bf7dc618b10e63001263e2e
2023-09-28 16:08:00 +00:00
Amit Sunil Dhamne
ed622856fc 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.

ported from c5c5b127a7ed0db559d286284fe77b656bef6945

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:59 +00:00
Ricky Niu
744f214f40 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
b77191c0fa Fix up open bugs from gs101 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 07:30:48 +00:00
Avichal Rakesh
eafdae6687 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: I5ba45ebb11d265b843dfde21407bc5bab1d070c9
2023-02-06 21:20:59 +00:00
Ricky Niu
5b86b2fb5f Use AIDL utils in GadgetHAL
Test: Built locally, and logcat confirms the new implementation is used
Bug: 218791946
Change-Id: I4122450326864de268f3908d920a1ffa472f3d7d
2023-01-19 17:40:18 -08:00
Ricky Niu
d6d0b7d2ca Migrate IUsbGadget implementation to AIDL
This change migrates IUsbGadget implementation to AIDL.

Bug: 261027750
Test: USB function switch success and AIDL service is running.
Change-Id: I7cc7070d875c26bc42f99aef84d5e5a41606223f
Signed-off-by: Ricky Niu <rickyniu@google.com>
2023-01-07 15:39:44 +08:00
Ricky Niu
ebd7fca53a 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-21 15:35:34 +00:00
Ray Chi
ba3dc9b3da 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: 224699556
Test: dwc3 irq could be located in medium/big cores after USB function switch
Change-Id: Id993db9fc303e85a9a6337a0e41b1dfd6fc9a86a
Merged-In: Id993db9fc303e85a9a6337a0e41b1dfd6fc9a86a
(cherry picked from commit f363704a92fd7611cf01c8b3bcaf6e8913255207)
2022-05-05 07:08:19 +00:00
Ray Chi
7da5d4f43f 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: 224699556
Test: build pass and verified pass
Change-Id: I45c1318f647220480fa03ba3b813a81b21393d71
Merged-In: I45c1318f647220480fa03ba3b813a81b21393d71
(cherry picked from commit b30924e3599f2e92aeae498a6ae15d3b9a397930)
2022-05-05 07:08:19 +00:00
chungkai
deca07793f init: modify path of i2c peripherals
add potential paths when enable parpllel module loading

Test: build pass
Bug: 228181404
Signed-off-by: chungkai <chungkai@google.com>
Change-Id: I929669a2ddc9155ad4dac1f40f808ffcb4c914f2
2022-04-07 09:33:25 +00:00
Badhri Jagan Sridharan
3c97a6bb68 Migrate IUsb implementation to AIDL
This change migrates IUsb implementation to AIDL.
Also, IUsb and IUsbGadget now run in its own processes
to improve stability and isolation.

Bug: 200993386
Bug: 199357330
Change-Id: I02753af4a41916b77ce110f9531504bf8c6a4691
2022-01-22 01:20:15 +00:00