Re: g_ether usb0 static IP

2,720 views
Skip to first unread message

Steve G

unread,
Oct 24, 2012, 10:51:02 AM10/24/12
to beagl...@googlegroups.com

I did some experiments with connman and found that connman does not appear to know about the g_ether usb ethernet device.

 
cd /usr/lib/connman/test/
./get-services
 
However when I plug a network cable into the ethernet (eth0) it reports information about that.
 
I'm still digging to find where/how the usb0 ethernet device is configured.

SuperJet

unread,
Oct 24, 2012, 3:20:04 PM10/24/12
to beagl...@googlegroups.com
You need to replace the “iface eth0 inet dhcp” line with hard-coded settings for your IP address, gateway, and DNS servers, although I've quit Angstrom, compared to Ubuntu, i found many plus points instead of long road around, but all ways goes to Rome, you can find the Default settings is

==========================

# Wired or wireless interfaces

auto eth0

iface eth0 inet dhcp

iface eth1 inet dhcp

 # Ethernet/RNDIS gadget (g_ether) or LAN9514

auto usb0

iface usb0 inet dhcp

 # Bluetooth networking

iface bnep0 inet dhcp

==========================


You can change it like this: 'Note it is my IP's change according to your Lan settings:

#iface eth0 inet dhcp
iface usb0 inet static
address 20.20.20.20.
netmask 255.255.255.0
network 20.20.20.0
broadcast 20.20.20.255
gateway 20.20.20.1
dns-nameservers 20.20.20.1

============================




On Wednesday, October 24, 2012 2:14:25 AM UTC+3, Steve G wrote:
I have an Angstrom BeagleBone and would like to configure it to come up with a static IP address on usb0 the g_ether interface.
Right now I hand configure usb0 for static IP on each boot which is inconvenient.  I've heard about connman but can't figure out how to use it or even if that's what I need to mess with.

Anyone have experience with this?

Steve G

unread,
Oct 24, 2012, 3:47:39 PM10/24/12
to beagl...@googlegroups.com
I believe that would be specified in /etc/network/interfaces.  Angstrom on the BeagleBone doesn't have that file.

Steve G

unread,
Oct 24, 2012, 7:34:33 PM10/24/12
to beagl...@googlegroups.com
OK, figured it out.  The usb0 interface is not configured using connman like eth0 is.  It's configured using udev.

In /etc/udev/rules.d is a file udhcpd.rules.  This file contains the rules for what actions to perform when usb0 gets plugged in and when it's unplugged.

The contents are:

SUBSYSTEM=="net",ACTION=="add",KERNEL=="usb0",RUN+="/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252",RUN+="/bin/systemctl start udhcpd.service"
SUBSYSTEM=="net",ACTION=="remove",KERNEL=="usb0",RUN+="/bin/systemctl stop udhcpd.service"

You can see from line 1 where the static IP address of 192.168.7.2 is assigned and also where the DHCP server is started.
Line 2 stops the DHCP server when usb0 is unplugged.

For my purposes I removed the command to start DHCP (i.e. removed RUN+="/bin/systemctl start udhcpd.service") and deleted line 2.
I then changed the IP address from 192.168.7.2 to my desired IP address as well as the netmask.

Voila, usb0 is now a simple static IP address of my choosing with no frills.

Víctor MV

unread,
Aug 31, 2013, 6:12:32 AM8/31/13
to beagl...@googlegroups.com
Hi Steve,

I followed your exact instructions but my usb0 interface is still getting the 192.168.7.2 address. No clue how to modify this. I even tried to remove this udhcpd.rules but nothing.

Actually i'd like to remove this interface totally because i think the usb-over-ethernet is causing the kernel to crash

root@beaglebone:/var/lib/connman# [  600.197574] INFO: task systemd-udevd:346 blocked for more than 60 seconds.                                                  
[  600.204837] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.                                                                         
[  600.213115] Kernel panic - not syncing: hung_task: blocked tasks                                                                                              
[  600.219439] [<c001051d>] (unwind_backtrace+0x1/0x8c) from [<c0373f21>] (panic+0x55/0x14c)                                                                     
[  600.228011] [<c0373f21>] (panic+0x55/0x14c) from [<c00617b3>] (watchdog+0x153/0x1a0)                                                                          
[  600.236129] [<c00617b3>] (watchdog+0x153/0x1a0) from [<c003ca4b>] (kthread+0x61/0x72)                                                                         
[  600.244336] [<c003ca4b>] (kthread+0x61/0x72) from [<c000c6fd>] (ret_from_fork+0x11/0x34)                                                                      
[  631.278836]  gadget: rndis req21.00 v0000 i0000 l12                                                                                                           
[  631.283984] rndis_msg_parser: RNDIS_MSG_HALT                                                                                                                  
[  631.295282] CAUTION: musb: Babble Interrupt Occurred                                                                                                          
[  631.300482]  gadget: reset config                                                                                                                             
[  631.303947]  gadget: rndis deactivated                                                                                                                        
[  631.307869] usb0: gether_disconnect                                                                                                                           
[  631.311542]  gadget: acm ttyGS0 deactivated                                                                                                                   
[  631.367452] CAUTION: musb: Babble Interrupt Occurred                                                                                                          
[  631.455212]  gadget: high-speed config #1: Multifunction with RNDIS                                                                                           
[  631.461773]  gadget: init rndis                                                                                                                               
[  631.465058]  gadget: RNDIS RX/TX early activation ...                                                                                                         
[  631.470441] usb0: qlen 10                                                                                                                                     
[  631.473180]  gadget: rndis_close                                                                                                                              
[  631.476554] rndis_set_param_medium: 0 0                                                                                                                       
[  631.480564] rndis_set_param_dev:                                                                                                                              
[  631.483941]  gadget: activate acm ttyGS0                                                                                                                      
[  631.488044] gserial_connect: start ttyGS0                                                                                                                     
[  631.492276]  gadget: acm ttyGS0 serial state 0003                                                                                                             
[  631.497201]  gadget: set_config: interface 4 (Mass Storage Function) requested delayed status                                                                 
[  631.506112]  gadget: delayed_status count 1                                                                                                                   
[  636.458230]  gadget: suspend                                                                                                                                  
[  636.464771] CAUTION: musb: Babble Interrupt Occurred                                                                                                          
[  636.469964]  gadget: reset config                                                                                                                             
[  636.473429]  gadget: rndis deactivated                                                                                                                        
[  636.477346] usb0: gether_disconnect                                                                                                                           
[  636.481006]  gadget: acm ttyGS0 deactivated                                                                                                                   
[  636.539648] CAUTION: musb: Babble Interrupt Occurred                                                                                                          
[  636.627806]  gadget: high-speed config #1: Multifunction with RNDIS                                                                                           
[  636.634363]  gadget: init rndis                                                                                                                               
[  636.637647]  gadget: RNDIS RX/TX early activation ...                                                                                                         
[  636.643026] usb0: qlen 10                                                                                                                                     
[  636.645764]  gadget: rndis_close                                                                                                                              
[  636.649138] rndis_set_param_medium: 0 0                                                                                                                       
[  636.653145] rndis_set_param_dev:                                                                                                                              
[  636.656522]  gadget: activate acm ttyGS0                                                                                                                      
[  636.660624] gserial_connect: start ttyGS0                                                                                                                     
[  636.664849]  gadget: acm ttyGS0 serial state 0003                                                                                                             
[  636.669773]  gadget: set_config: interface 4 (Mass Storage Function) requested delayed status                                                                 
[  636.678685]  gadget: delayed_status count 2                                                   


Any ideas about how to totally disable usb0 from connman?

Steve G

unread,
Aug 31, 2013, 6:50:57 AM8/31/13
to beagl...@googlegroups.com
I've seen that "babble interrupt" error before.  I don't know exactly what it means but it's a hardware level usb problem.
It sounds like you have more basic problems with your board that software configuration.  Has the usb ever worked?

SG

Brandon I

unread,
Sep 26, 2013, 7:47:44 PM9/26/13
to beagl...@googlegroups.com
Looking at my beaglebone with the 7-31 production image, there's a systemd service called storage-gadget-init. Check out what it's doing with "systemctl status storage-gadget-init":

          Loaded: loaded (/lib/systemd/system/storage-gadget-init.service; enabled)
          Active: active (running) since Tue 2000-01-04 00:57:51 UTC; 13 years 8 months ago
        Main PID: 122 (g-ether-load.sh)
          CGroup: name=systemd:/system/storage-gadget-init.service
                  |-122 /bin/sh /usr/bin/g-ether-load.sh
                  `-353 /usr/sbin/udhcpd -f -S /etc/udhcpd.conf

I'ts running a script g-ether-load.sh with a line at the end:

    /sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252

then fires up the dhcp server with the configuration from /etc/udhcpd.conf that sets the ip range for the dhcp server for the usb host, acting as a dhcp client, the usb cable is connected to:

    start      192.168.7.1
    end        192.168.7.1
    interface  usb0
    max_leases 1
    option subnet 255.255.255.252


So, you'll have to change both files with the subnet in mind.

I don't know if the udev rule comes into play at all. I deleted the file, rebooted with usb plugged in, I get an ip. Rebooted with usb disconnected, connect usb, get an ip. Probably some old thing that someone forgot about.

"Can't Linux without a little wtf." - Bob Dole, 1978
Reply all
Reply to author
Forward
0 new messages