Jump to content


Photo

pcDuino3 Android Ethernet driver

android ethernet

  • Please log in to reply
15 replies to this topic

#1 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 29 December 2014 - 06:31 PM

On http://www.linksprite.com/?page_id=855 we find some Android images, f.e.

 

1. Android 4.2 bootable SD image - dated 08-26-2014

    includes /system/vendor/modules/net622x.ko

 

2. Android 4.2 NAND image - dated 04-04-2014

    includes /system/vendor/modules/zet622x.ko

 

In the Preferences of Android someone can activate the communication over erthernet.

 

However, this mode can not be used until someone opens a terminal and as user root issues the command

for

1. insmod /system/vendor/modules/net622x.ko

or

2. insmod /system/vendor/modules/zet622x.ko

and disable and enable Ethernet again.

The appropriate insmod command has to be repeated at each boot of the pcDuino3.

 

Mounting the SD card for the image dated 08-26-2014 (see 1.) this process can be overcome by editing the file init.sun7i.rc directly on the SD card by inserting the line

insmod /system/vendor/modules/net622x.ko

directly under the line

# insmod network

 

Such modified file will overcome the problem of not being able to use Ethernet without manual insertion of the network module as described above.

 

For the Android 4.2 NAND image (see 2.) once installed such modification can not be done because

A. the file init.sun7i.rc is not modifiable even by root and

B. the file containing the recovery.img would need to be changed to.

 

My question is

Can anyone of Linksprite Android development team please make the above mentioned change to the script init.sun7i.rc (whereas the module mentioned under 1. is named net622x.ko and the module mentioned under 2. is named zet622x.ko) and make new images containing such changes available on the download page?

 

This would help those who do not have the capabilities to re-manufacture Android images.

 

Thank you for your kind attention.

 


  • carpinteyrolkh and shrewd.harmeetsingh like this

#2 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 31 December 2014 - 07:51 PM

In the meantime I've found a quick and dirty solution to dhcp.

 

Background:

The Android distributions mentioned in my first post don't provide

1. the automatic load of the ethernet kernel module

2. even if the resp. kernel module is loaded after each reboot the eth0 interface is set to address 192.168.1.222/24

    as defined in the script /system/bin/preinit.sh that is the last script executed by /init.rc

    Someone has to pull the ethernet cable and to re-plug it in order to receive a valid network address, gateway,

    etc.. from the router in case the routers basic network address is not 192.168.1.x

 

In order to automatically receive a correct address from a connected router without pulling and re-plugging the eth0 cable of the pcDuino3 board I've made the following changes using a bootable SD card.

 

1. Plug the microSD card into a computer that has an appropriate device for it (I use an USB/OTG adapter PQI Connect 203)

    prefer a computer with linux installed because the Android SD card uses linux ext4 filesystem and linux init files don't like

    the 'carriage return' bits added by M$ editors at the end of a line.

2. Mount the partition of the Android SD card that shows a size of 32MB. This is the boot partition.

3. On linux computers open a terminal and become root (su -i).

 

Kernel module for eth0

4. Open the file /init.sun7i.rc on the root of the SD card with an editor.

5. Find the line # insmod network and directly after that insert the line

    insmod /system/vendor/modules/zet622x.ko

6. Save the file.

 

DHCP for eth0 without fiddling with cable upon each reboot

 

7. Open the file /init.rc on the root of the SD card with an editor.

8. Near the end find the line

    service  preinstall  /system/bin/busybox  sh  /system/bin/preinstall.sh

    Such init file is executed last by the system init and will set the eth0 network address always to 192.168.1.222 upon boot.

9. Before such line insert the lines:

    # command to bring down the interface eth0 - execute only once (oneshot)

    service stop_eth0 /system/bin/netcfg eth0 down
        user root
        group root
        disabled
        oneshot

 

    # command to start the interface eth0 thereby requesting network information via DHCP

    # - execute only once (oneshot)     
    service start_eth0 /system/bin/netcfg eth0 up dhcp
        user root
        group root
        disabled
        oneshot

 

10. Go to the end of the file and insert the following lines:

 

      # execute stop interface eth0

      on property:sys.boot_completed=1

           start stop_eth0

 

      # execute start interface eth0

      on property:sys.boot_completed=1

           start start_eth0

 

11. Save the file.

12. Clean unmount the Android SD card and boot off it on the pcDuino3 board.

 

After Android is booted unlock the main screen. Go to the screen that shows all the installed programs by clicking on the icon that has six (6) dots. There open the program Terminal and type

netcfg<enter>

In the list you should see that eth0 now has an address in the range of your routers address space.

Close the terminal screen by typing

exit>enter>

Now you can try your bowser  to surf the internet.

 

PS: Any typos found in the above text belong to you ;)


  • shrewd.harmeetsingh likes this

#3 shrewd.harmeetsingh

shrewd.harmeetsingh

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 14 January 2015 - 08:09 PM

Hi Nunja, I am facing same problem.

After reading your instructions I have modified pcduino3 android img (pcduino3_android_20141210.img) with all the changes as instructed. Right now its getting installed using sdcard, so let me know if you too want this image file.

 

Thank you. :)



#4 shrewd.harmeetsingh

shrewd.harmeetsingh

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 14 January 2015 - 08:38 PM

Hi Nunja I have tested my image, its working for me...

1. When first boot finished, connect ethernet device and then enable it in settings.

2. Reboot pcduino and wait for boot finish (do not disconnecting ethernet device) and ethernet will get connected and have valid Ip addr automatically.

 

What not working is if you connect ethernet device after pcduino boot finish then ethernet will not get valid ip addr automatically. :(

 

But for now its ok for me...



#5 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 17 February 2015 - 06:34 AM

@shrewd.harmeetsingh

As I said it's a quick and dirty one. And i do not pull cables because my pcduino is running until i turn it off.

 

BTW, the reference to the load line

 

insmod /system/vendor/modules/zet622x.ko

 

has nothing to with the ethernet driver. It's simply there to give the system more time to work thru it's boot procedure until someone can reconfigure the ethernet settings :))



#6 deepakgh

deepakgh

    Advanced Member

  • Members
  • PipPipPip
  • 45 posts

Posted 18 February 2015 - 12:30 PM

I had the same issue and the instructions above helped and the ethernet is working now.

 

Thanks !!



#7 framil

framil

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 18 February 2015 - 06:28 PM

Thank you Nunja for the instructions.  This solved the annoying problem where ethernet is working, then is lost after a reboot. I have the Android 4.2 bootable SD image - dated 20140826. I installed ES File Explorer File Manager (set Root Explorer to ON under Tools), then edited the 2 files directly and rebooted. Easy!



#8 tawma1100

tawma1100

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 11 March 2015 - 07:16 PM

Does a properly changed image (SD preferably)  exist for download?

 

I've tried 6 ways from Sunday to follow the instructions above. I have had absolutely no luck in ever getting a valid IP address.

 

Any assistance that anyone can provide would be greatly appreciated.

 

Thanks



#9 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 21 March 2015 - 01:54 PM

tawma1100

I don't think you get a changed SD image thru linksys.

 

However, in case more than one is interested I might make one and put it on my ftp server for download.



#10 tawma1100

tawma1100

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 21 March 2015 - 02:04 PM

That would be great! I really appreciate the offer.



#11 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 23 March 2015 - 05:17 PM

twama1100

Did you read post #9 correct?

It says 'more than one is interested'



#12 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 27 March 2015 - 04:46 AM

twama1100

 

You might want to download

ftp://mungo.spdns.eu/pub/boards/linksprite.com/pcduino/3/android/images/sdcard/pcduino3_android_mmc_20140826_eth0.img.7z

 

On a linux installation use the dd command. Otherwise for alternative operation systems you use a similar tool.

 

Some small documentation is included in the archive.

 

You have to change the setting for language etc.. and activate the ethernet once upon first boot as with the original image.

 

Hope that helps.


  • cwilt and tawma1100 like this

#13 tawma1100

tawma1100

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 27 March 2015 - 09:22 PM

nunja,

 

Thanks for making the image available. I really appreciate it. Unfortunately, there must be some user error on my part because the system still does not connect to the network. I'll walk through my process and maybe someone can tell me what I'm doing wrong.

 

I used dd to put the image on an 8G SD card. Upon reboot Android boots off the sdcard and begins the setup process.

 

After selecting the language, by clicking on the languages above and below the selected languages, the image attempts to connect to Wifi. Since there's no dongle and no embedded wifi transceiver, I skipped this step along with the steps for setting up a google account.

 

I finally get a home screen with the all apps button on the bottom. I select that, then Settings. Wifi is off. There is a "More' tab a couple of entries down. It pops up a list on the right with Airplane, Ethernet, VPN, Portable Hotspot, and Mobile configs. I choose the ethernet config.

 

Ethernet is disabled. I took this to be the "activate the ethernet once upon first boot", and enabled it using the "Use Ethernet" checkbox. The MAC line below shows IP Mode: DHCP and a MAC address. IP is 0.0.0.0 both before selection, after selection, and after a reboot. I've tried it with the cable connected, with the cable disconnected then plugging in after booting, and disconnecting and replugging in the cable on the Ethernet settings page. With the latter action a "DISCONNECTED" message pops up under the "Use Ethernet" checkbox when the cable is disconnected and it never seems to disappear after that. Both the link and the traffic LEDs are lit or blinking when the cable is plugged in.

 

Just to be clear that everything networking works in exactly the same spot using the Ubuntu in NAND. On a whim I tested with a static IP. The status message changed to "Connected: USED DEVICE eth0". However, there does not seem to be any actual connectivity to the network for either names or IP addresses on either the local LAN or any wider connectivity. 

 

I guess I'm just a bit frustrated that what is arguably the most critical operation that the OS needs to accomplish seems to have absoutely the most trouble to get done.

 

Any suggestions would be great.

 

Thanks.



#14 nunja

nunja

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 27 March 2015 - 09:59 PM

twama1100

 

Let me recap the process:

 

Write the image to microSD card.

Boot to it using the pcduino3 with the ethernet (LAN) cable connected.

The first time the system is very slow because it does some internal works like reformatting the card etc.. Be patient.

Then try to overcome the chinese settings, time zone, language, etc.

In settings turn wifi off.

Go to the more settings and enable ethernet.

Wait a minute or two and reboot Android (switch off by using the red application button, unplug power supply, wait a minute, plugin power supply).

Back in Android unlock your screen.

After a while in the upper right corner of the Android interface you will see the connected icon appear (a blue icon).

(It takes sometime - here approx. two minutes - because this image like all Android versions are busy trying to use wifi even if it is disabled. A native Android doesn't have ethernet capabilities included.)

 

Remember:

Due to the nature of how the Android was modified to support ethernet by the vendor of the source code (sunxi ?) you DO NOT disconnect and reconnect the ethernet cable while Android is running. It will not reset the ethernet connection in such case. The only possibility in such a case is to reboot the Android once the connection to the router is lost.

 

I think I've already found the cause of such problem and will investigate such init scripts as time permits.

 

 

Hope that helps.



#15 cwilt

cwilt

    Advanced Member

  • Members
  • PipPipPip
  • 1,012 posts

Posted 27 March 2015 - 11:47 PM

Thanks for putting that out there nunja. At the moment I am in the middle of some other android work, but when that is done I will load yours and test it.



#16 jbloggs

jbloggs

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 18 August 2016 - 02:57 AM

​I'm using Android 4.2 bootable SD image - dated 08-26-2014 - set network settings to fixed IP correct Nrtmask/Broadcast/Gateway,Eth0 etc.

​No Network connection.

​Have solved this. I have a 1Port USBNetwork with 3Port USB Hub attached to my pcduino, to which I have attached my keyboard and mouse.

​If I connect my network cable to the Ethernet port ( 10/10 only) then Android connects to the network and internet.

YN8407ImageMain-515Wx515H.jpg

​Hope this helps somebody until the Android .img file is updated.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users