Skip to content

Commit 1afb527

Browse files
committed
Revert "Removal of NCM usb gadget ethernet device after discussion with team"
This reverts commit ab19504.
1 parent 926432c commit 1afb527

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

recipes-devtools/android-tools/android-tools/android-tools-adbd.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Unit]
2-
Description=Android Debug Bridge & Usb ACM
2+
Description=Android Debug Bridge & Usb NCM
33
ConditionPathExists=/sys/class/typec/port0/data_role
44
After=network-pre.target dbus.service
55
Before=android-system.service

recipes-devtools/android-tools/android-tools/arduino-android-gadget-setup

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ start()
3535

3636
# populate config, optional
3737
mkdir configs/c.1/strings/0x409
38-
echo \"adb+acm\" > configs/c.1/strings/0x409/configuration
38+
echo \"adb+acm+ncm\" > configs/c.1/strings/0x409/configuration
3939
echo 900 > configs/c.1/MaxPower
4040

4141
# create a generic ffs for adb
@@ -44,6 +44,12 @@ start()
4444
# create the acm (serial) function
4545
mkdir functions/acm.GS0
4646

47+
# create the ncm function
48+
mkdir functions/ncm.usb0
49+
50+
# assign ncm function to configuration
51+
ln -s functions/ncm.usb0/ configs/c.1
52+
4753
# assign acm function to configuration
4854
ln -s functions/acm.GS0 configs/c.1
4955

recipes-support/arduino-ootb/arduino-ootb.bb

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RDEPENDS:${PN} += "systemd"
77
SRC_URI = " \
88
file://connection-status-led.timer \
99
file://connection-status-led.service \
10+
file://ncm-network.service \
1011
file://secure-device.service \
1112
file://create-docker-envfile.service \
1213
file://offline-update.service \
@@ -15,12 +16,13 @@ SRC_URI = " \
1516

1617
inherit systemd
1718

18-
SYSTEMD_SERVICE:${PN} = "connection-status-led.timer connection-status-led.service secure-device.service create-docker-envfile.service offline-update.service"
19+
SYSTEMD_SERVICE:${PN} = "connection-status-led.timer connection-status-led.service ncm-network.service secure-device.service create-docker-envfile.service offline-update.service"
1920

2021
do_install() {
2122
install -d ${D}${systemd_system_unitdir}
2223
install -m 0644 ${WORKDIR}/connection-status-led.timer ${D}${systemd_system_unitdir}/
2324
install -m 0644 ${WORKDIR}/connection-status-led.service ${D}${systemd_system_unitdir}/
25+
install -m 0644 ${WORKDIR}/ncm-network.service ${D}${systemd_system_unitdir}/
2426
install -m 0644 ${WORKDIR}/secure-device.service ${D}${systemd_system_unitdir}/
2527
install -m 0644 ${WORKDIR}/create-docker-envfile.service ${D}${systemd_system_unitdir}/
2628
install -m 0644 ${WORKDIR}/offline-update.service ${D}${systemd_system_unitdir}/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Configure link-local connection on usb ncm interface
3+
BindsTo=sys-subsystem-net-devices-usb0.device
4+
After=android-tools-adbd.service sys-subsystem-net-devices-usb0.device
5+
6+
[Service]
7+
Type=simple
8+
RemainAfterExit=yes
9+
ExecStart=/bin/sh -c '/usr/bin/nmcli c delete usbncm; /usr/bin/nmcli c add type ethernet ifname usb0 ipv4.method shared ipv4.addresses 192.168.224.1/24 ipv6.method disabled con-name usbncm && /usr/bin/nmcli c up usbncm'
10+
ExecStop=/bin/sh -c '/usr/bin/nmcli c down usbncm && /usr/bin/nmcli c delete usbncm'
11+
12+
[Install]
13+
WantedBy=usb-gadget.target

0 commit comments

Comments
 (0)