-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem setting up the bulk configuration using Jetson nano and M350 #229
Comments
Agent comment from Leon in Zendesk ticket #123724: °°° |
Hello, Thanks for your feedback ! I've achieved to make the service The /dev/usb-ffs/ folder is created but I cannot see the usb device using My nv-l4-usb-device-mode-start.sh file: #!/bin/bash
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -ex
# Ensure the script runs as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
# Load required modules
sudo modprobe configfs
sudo modprobe libcomposite
sudo modprobe usb_f_fs
# Mount configfs if not already mounted
if ! mountpoint -q /sys/kernel/config; then
sudo mount -t configfs none /sys/kernel/config
fi
script_dir="$(cd "$(dirname "$0")" && pwd)"
. "${script_dir}/nv-l4t-usb-device-mode-config.sh"
# Wait for any modules to load and initialize
for attempt in $(seq 60); do
udc_dev_t210=700d0000.xudc
if [ -e "/sys/class/udc/${udc_dev_t210}" ]; then
udc_dev="${udc_dev_t210}"
break
fi
udc_dev_t186=3550000.usb
if [ -e "/sys/class/udc/${udc_dev_t186}" ]; then
udc_dev="${udc_dev_t186}"
break
fi
sleep 1
done
if [ "${udc_dev}" == "" ]; then
echo No known UDC device found
exit 1
fi
macs_file="${script_dir}/mac-addresses"
if [ -f "${macs_file}" ]; then
. "${macs_file}"
else
# Generate unique data
if [ -f /proc/device-tree/serial-number ]; then
random="$(md5sum /proc/device-tree/serial-number|cut -c1-12)"
else
random="$(echo "no-serial"|md5sum|cut -c1-12)"
fi
# Extract 6 bytes
b1="$(echo "${random}"|cut -c1-2)"
b2="$(echo "${random}"|cut -c3-4)"
b3="$(echo "${random}"|cut -c5-6)"
b4="$(echo "${random}"|cut -c7-8)"
b5="$(echo "${random}"|cut -c9-10)"
b6="$(echo "${random}"|cut -c11-12)"
# Clear broadcast/multicast, set locally administered bits
b1="$(printf "%02x" "$(("0x${b1}" & 0xfe | 0x02))")"
# Set 4 LSBs to unique value per interface
b6_rndis_h="$(printf "%02x" "$(("0x${b6}" & 0xfc | 0x00))")"
b6_rndis_d="$(printf "%02x" "$(("0x${b6}" & 0xfc | 0x01))")"
b6_ecm_h="$(printf "%02x" "$(("0x${b6}" & 0xfc | 0x02))")"
b6_ecm_d="$(printf "%02x" "$(("0x${b6}" & 0xfc | 0x03))")"
# Construct complete MAC per interface
mac_rndis_h="${b1}:${b2}:${b3}:${b4}:${b5}:${b6_rndis_h}"
mac_rndis_d="${b1}:${b2}:${b3}:${b4}:${b5}:${b6_rndis_d}"
mac_ecm_h="${b1}:${b2}:${b3}:${b4}:${b5}:${b6_ecm_h}"
mac_ecm_d="${b1}:${b2}:${b3}:${b4}:${b5}:${b6_ecm_d}"
# Save values for next boot
echo "mac_rndis_h=${mac_rndis_h}" > "${macs_file}"
echo "mac_rndis_d=${mac_rndis_d}" >> "${macs_file}"
echo "mac_ecm_h=${mac_ecm_h}" >> "${macs_file}"
echo "mac_ecm_d=${mac_ecm_d}" >> "${macs_file}"
fi
mkdir -p /sys/kernel/config/usb_gadget/l4t
cd /sys/kernel/config/usb_gadget/l4t
# If this script is modified outside NVIDIA, the idVendor and idProduct values
# MUST be replaced with appropriate vendor-specific values.
echo 0x0955 > idVendor
echo 0x7020 > idProduct
# BCD value. Each nibble should be 0..9. 0x1234 represents version 12.3.4.
echo 0x0002 > bcdDevice
# Informs Windows that this device is a composite device, i.e. it implements
# multiple separate protocols/devices.
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol
mkdir -p strings/0x409
if [ -f /proc/device-tree/serial-number ]; then
serialnumber="$(cat /proc/device-tree/serial-number|tr -d '\000')"
else
serialnumber=no-serial
fi
echo "${serialnumber}" > strings/0x409/serialnumber
# If this script is modified outside NVIDIA, the manufacturer and product values
# MUST be replaced with appropriate vendor-specific values.
echo "NVIDIA" > strings/0x409/manufacturer
echo "Linux for Tegra" > strings/0x409/product
cfg=configs/c.1
mkdir -p "${cfg}"
cfg_str=""
# Note: RNDIS must be the first function in the configuration, or Windows'
# RNDIS support will not operate correctly.
if [ ${enable_rndis} -eq 1 ]; then
cfg_str="${cfg_str}+RNDIS"
func=functions/rndis.usb0
mkdir -p "${func}"
echo "${mac_rndis_h}" > "${func}/host_addr"
echo "${mac_rndis_d}" > "${func}/dev_addr"
ln -sf "${func}" "${cfg}"
# Informs Windows that this device is compatible with the built-in RNDIS
# driver. This allows automatic driver installation without any need for
# a .inf file or manual driver selection.
echo 1 > os_desc/use
echo 0xcd > os_desc/b_vendor_code
echo MSFT100 > os_desc/qw_sign
echo RNDIS > "${func}/os_desc/interface.rndis/compatible_id"
echo 5162001 > "${func}/os_desc/interface.rndis/sub_compatible_id"
ln -sf "${cfg}" os_desc
fi
# If two USB configs are created, and the second contains RNDIS and ACM, then
# Windows will ignore at the ACM function in that config. Consequently, this
# script creates only a single USB config.
if [ ${enable_acm} -eq 1 ]; then
cfg_str="${cfg_str}+ACM"
func=functions/acm.GS0
mkdir -p "${func}"
ln -sf "${func}" "${cfg}"
fi
# Copy system version information into the exposed filesystem image,
# so that any system that's attached to the USB port can identify this device.
# Do this even if $enable_ums!=1, since $fs_img is locally mounted too.
mntpoint="/mnt/l4t-devmode-$$"
rm -rf "${mntpoint}"
mkdir -p "${mntpoint}"
mount -o loop "${fs_img}" "${mntpoint}"
rm -rf "${mntpoint}/version"
mkdir -p "${mntpoint}/version"
if [ -f /etc/nv_tegra_release ]; then
cp /etc/nv_tegra_release "${mntpoint}/version"
fi
if dpkg -s nvidia-l4t-core > /dev/null 2>&1; then
dpkg -s nvidia-l4t-core > "${mntpoint}/version/nvidia-l4t-core.dpkg-s.txt"
fi
cp -r /proc/device-tree/chosen/plugin-manager "${mntpoint}/version/plugin-manager"
umount "${mntpoint}"
rm -rf "${mntpoint}"
if [ ${enable_ums} -eq 1 ]; then
cfg_str="${cfg_str}+UMS"
func=functions/mass_storage.0
mkdir -p "${func}"
ln -sf "${func}" "${cfg}"
# Prevent users from corrupting the disk image; make it read-only
echo 1 > "${func}/lun.0/ro"
echo "${fs_img}" > "${func}/lun.0/file"
fi
if [ ${enable_ecm} -eq 1 ]; then
cfg_str="${cfg_str}+${ecm_ncm_name}"
func=functions/${ecm_ncm}.usb0
mkdir -p "${func}"
echo "${mac_ecm_h}" > "${func}/host_addr"
echo "${mac_ecm_d}" > "${func}/dev_addr"
ln -sf "${func}" "${cfg}"
fi
enable_bulk=1
if [ ${enable_bulk} -eq 1 ]; then
mkdir -p /dev/usb-ffs
cfg_str="${cfg_str}+BULK1"
mkdir -p /dev/usb-ffs/bulk1
func=functions/ffs.bulk1
mkdir -p "${func}"
ln -sf "${func}" "${cfg}"
mount -o mode=0777 -o uid=2000 -o gid=2000 -t functionfs bulk1 /dev/usb-ffs/bulk1
/home/my_user/Desktop/startup_bulk/startup_bulk /dev/usb-ffs/bulk1 &
sleep 3
cfg_str="${cfg_str}+BULK2"
mkdir -p /dev/usb-ffs/bulk2
func=functions/ffs.bulk2
mkdir -p "${func}"
ln -sf "${func}" "${cfg}"
mount -o mode=0777 -o uid=2000 -o gid=2000 -t functionfs bulk2 /dev/usb-ffs/bulk2
/home/my_user/Desktop/startup_bulk/startup_bulk /dev/usb-ffs/bulk2 &
sleep 3
fi
mkdir -p "${cfg}/strings/0x409"
# :1 in the variable expansion strips the first character from the value. This
# removes the unwanted leading + sign. This simplifies the logic to construct
# $cfg_str above; it can always add a leading delimiter rather than only doing
# so unless the string is previously empty.
echo "$(echo "$cfg_str" | cut -c2-)" > "${cfg}/strings/0x409/configuration"
# Create and configure the network bridge before setting the UDC device. This
# ensures that no matter how quickly udev events (which run -runtime-start.sh)
# are triggered after setting the UDC device below, the bridge device is
# guaranteed to exist, so -runtime-start.sh is guaranteed to be able to
# configure it.
#
# Set the device to "down" initially; if/when -runtime-start.sh runs in response
# to cable presence, the interface will be set to "up".
/sbin/brctl addbr l4tbr0
/sbin/ifconfig l4tbr0 down
echo "${udc_dev}" > UDC
# Ethernet devices require additional configuration. This must happen after the
# UDC device is assigned, since that triggers the creation of the Tegra-side
# Ethernet interfaces.
#
# This script always assigns any-and-all Ethernet devices to an Ethernet
# bridge, and assigns the static IP to that bridge. This allows the script to
# more easily handle the potentially variable set of Ethernet devices.
#
# If your custom use-case requires separate IP addresses per interface, or
# only ever has one interface active, you may modify this script to skip
# bridge creation, and assign IP address(es) directly to the interface(s).
if [ ${enable_rndis} -eq 1 ]; then
/sbin/brctl addif l4tbr0 "$(cat functions/rndis.usb0/ifname)"
/sbin/ifconfig "$(cat functions/rndis.usb0/ifname)" up
fi
if [ ${enable_ecm} -eq 1 ]; then
/sbin/brctl addif l4tbr0 "$(cat functions/${ecm_ncm}.usb0/ifname)"
/sbin/ifconfig "$(cat functions/${ecm_ncm}.usb0/ifname)" up
fi
cd - # Out of /sys/kernel/config/usb_gadget
# Create a local disk device that exposes the same filesystem image that's
# exported over USB. This will allow local users to see the files too.
/sbin/losetup -f -r "${fs_img}"
exit 0
|
Agent comment from Leon in Zendesk ticket #123724:
°°° |
Hello,
But what you suggested is half way done in the file already. Besides, when i run the script manually, i have an error :
This what the l4t-usb-device-mode-start.sh looks like:
|
Agent comment from Leon in Zendesk ticket #123724: °°° |
Hello, I don't have any file
|
Agent comment from Leon in Zendesk ticket #123724: °°° |
Agent comment from Leon in Zendesk ticket #123724:
°°° |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Hello, Yes everything is installed correctly. |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Hello, Thanks for the feedback. I am already using a TypeC to A cable and an OTG cable. Is it normal that I cannot see any ports using lsusb ? |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Hello, Do you have another idea where to look ? |
Agent comment from Leon in Zendesk ticket #123724: °°° |
Hello,
I am trying to get the video feedback from my M350 dji drone using the e-port. I've followed the dji documentation without success. I am only able to get the telemetry using the serial port. I tried to set up the bulk port using the 2. Enable Jetson Nano's USB bulk function from the dji documentation and the README from the startup_bulk script. I did change the path
/home/dji/Desktop/startup_bulk/startup_bulk /dev/usb-ffs/bulk1 &
froml4-usb-device-mode-start.sh
andl4-usb-device-mode.sh
with my user.When I run the command after reboot:
ps -aux | grep startup_bulk
I only get the following output:
my_user 12171 0.0 0.0 8944 2052 pts/6 S+ 09:45 0:00 grep startup_bulk
I also tried to add changes made by another user facing the same issue but with another drone : #179, but nothing has changed.
Thank you for your assistance.
The text was updated successfully, but these errors were encountered: