thirtythreeforty / businesscard-linux

A Buildroot distribution small enough to run on my business card
https://www.thirtythreeforty.net/posts/2019/12/my-business-card-runs-linux/
1.81k stars 186 forks source link

ethernet-over-usb in LicheeNano #21

Open masoudr opened 3 years ago

masoudr commented 3 years ago

Hi, First I need to apologize if my question may be unrelated to the repo but I thought that you may already face the same issue. I'm trying to make ethernet over USB working on my Lichee Nano board with its micro USB connection. First I tried to set up with u-boot but it didn't work. Then I tried to set it up with Linux kernel which is more common so I followed this guide and the g_ether module seems to load properly. But my host PC doesn't recognize the USB connection as any device (it is like no device has been connected). Here is the log of kernel and modprobe command:

[    1.289782] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on mino0
[    1.299028] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supplyr
[    1.311040] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver                     
[    1.316977] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus numb1
[    1.331288] hub 1-0:1.0: 1 port detected                                                    
[    1.365448] ALSA device list:                                                     
[    1.372277] platform regulatory.0: Direct firmware load for regulatory.db failed 2
[    1.380993] cfg80211: failed to load regulatory.db                                
[    1.490189] random: crng init done                                                
[    2.737708] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xat.
[    2.758166] VFS: Mounted root (jffs2 filesystem) on device 31:3.                  
[    2.766941] devtmpfs: mounted                                                     
[    2.776014] Freeing unused kernel memory: 1024K                                   
# ^C                                                                                 
# modprobe g_ether                                                                   
[   46.910388] using random self ethernet address                                    
[   46.914870] using random host ethernet address                                    
[   46.919480] using host ethernet address: blah blah                      
[   46.920963] usb0: HOST MAC blah blah                                      
[   46.930977] usb0: MAC blah blah                                             
[   46.934898] using random self ethernet address                                    
[   46.939437] using random host ethernet address                                    
[   46.944072] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008           
[   46.950751] g_ether gadget: g_ether ready                                         
# ip a                                                                               
1: lo: <LOOPBACK> mtu 65536 qdisc noop qlen 1000                                     
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00                            
2: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000                         
    link/ether blah blah brd ff:ff:ff:ff:ff:ff                               
# ifconfig                                                                           
# ifconfig usb0 192.168.0.2                                                          
# ifconfig                                                                           
usb0      Link encap:Ethernet  HWaddr  blah blah                             
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0             
          UP BROADCAST MULTICAST  MTU:1500  Metric:1                                 
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0                         
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                       
          collisions:0 txqueuelen:1000                                               
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

I'm using this Linux version. It is the same version as https://github.com/Icenowy/linux.git with adding xt25f128b flash support. Thanks.

thirtythreeforty commented 3 years ago

I seem to recall that I had the Ethernet gadget working. Have you tried my kernel? I fixed a couple USB bugs (just typos, nobody had ever tried what I was trying). However, if you're getting as far as USB enumeration then it might work with your kernel.

masoudr commented 3 years ago

Thanks for the answer. I tried the f1c100s-v5.2.X version and I got the same behavior. Also, I can't use the f1c100s-usb-v5.6 because of SPI Flash xt25f128b support. As described here, in this version there is no m25p80.c file so I don't know how to add this chip support. Anyway, my aim is to use this feature in u-boot, which I think is more straightforward. Have you tested this feature with it?