Nook -> Ad-Hoc - Nook Color Android Development

I tried to get an ad-hoc connection running using directions under the G1 subforum. This was the post:
forum.xda-developers.com/showpost.php?p=2886271&postcount=13
I figured if the G1 could connect to an ad-hoc, the Nook should be able to. I got part of the way through this and ran into some road-blocks. Some of this is directly copied from the post above - I certainly am not savvy enough to put this all together myself. I had installed busybox before I started doing any of these steps.

First, make sure wifi is disabled on the phone gui.


Next, Set up the ad-hoc network. I used android wifi tether on my HTC G1 to start broadcasting. The SSID was "g1". I set it to use the 192.168.3.0 subnet. No encryption, no access control.
copy /system/etc/wifi/tiwlan.ini to /data/local/bin/tiwlan.ini for easy editing

In tiwlan.ini, look for "WiFiAdhoc = 0".
Change it to the following (set ssid to whatever you use):
WiFiAdhoc = 1
dot11DesiredSSID = g1
dot11DesiredBSSType = 0
After updating tiwlan.ini, enable wifi manually:
adb shell
# insmod /system/etc/wifi/tiwlan_drv.ko
# tiwlan_loader -f /system/etc/wifi/firmware.bin -e /proc/calibration -i /data/local/bin/tiwlan.ini
# ifconfig tiwlan0 192.168.3.99 netmask 255.255.255.0
# ifconfig tiwlan0 up
ifconfig showed the tiwlan0 interface was up.
lo
Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
tiwlan0
Link encap:Ethernet HWaddr 08:00:28:7F:57: DB
inet addr:192.168.3.99 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING 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:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
I then discovered I had no iptables binary, so I pulled it off the rooted HTC G1.

adb pull /data/data/android.tether/bin/iptables
adb shell
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# exit
adb push ./iptables /system/bin/iptables
adb shell
# chmod 755 /system/bin/iptables
# mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

Now, from the OP's post, the iptables rules:
iptables -I FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
gave this error:
iptables v1.3.7: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
when I run modprobe I get: "modprobe: cannot parse modules.dep"
<stopped here>
____________________________________________________
The rest of the commands I didn't bother to run:

iptables -I FORWARD -s 192.168.2.0/24 -j ACCEPT

iptables -P FORWARD DROP

iptables -t nat -I POSTROUTING -s 192.168.2.0/24 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward
If all went well, you now have internet access.
____________________________________________________
I also tried the wpa_supplicant hack from:
forum.xda-developers.com/showthread.php?t=754961&page=1
This didn't work, with either the version 0.5.11 or 0.6.10 of wpa_supplicant. Version 0.5.11 allows the wifi to start but I get a "unable to scan networks" error. The 0.6.10 version won't even start wifi.
Restoring the original wpa_supplicant and setting permissions back to 755 brought the wifi back
Anyone with more skills than I have any ideas?

Its not the nook, I connected successfully using my Fascinates Verizon 3G Hotspot software but wifi tether would not pick up. Its not the nook that needs hacking its the wifi tether broadcasting app. Something about it isn't broadcasting in a way that other android devices can pick up. I tried this in the verizon store the other day phone to phone. It just doesn't work. But the 3g hot spot works like a million bucks.

ad-hoc under android
Most android devices don't connect to ad-hoc networks. Some are capable of tethering and broadcasting as an infrastructure AP, but my phone isn't. I need the nook to see and connect to ad-hoc networks because that is all my G1 can broadcast. Its not a nook problem per se, but an android problem. There are hacks described on this forum to circumvent the problem, they just don't work with my phone or the nook.

Assuming this is the same problem I'm having trying to tether via MyWi on my iPhone. (Ad-Hoc vs infrastructure) I'm very jealous of my co-worker who's Evo tethers to his NC perfectly.

macndroid said:
I tried to get an ad-hoc connection running using directions under the G1 subforum. This was the post:
...
I also tried the wpa_supplicant hack from:
forum.xda-developers.com/showthread.php?t=754961&page=1
This didn't work, with either the version 0.5.11 or 0.6.10 of wpa_supplicant. Version 0.5.11 allows the wifi to start but I get a "unable to scan networks" error. The 0.6.10 version won't even start wifi.
Restoring the original wpa_supplicant and setting permissions back to 755 brought the wifi back
Anyone with more skills than I have any ideas?
Click to expand...
Click to collapse
I don't yet have a nook to try this on, but I've used both these techniques on more than 1 device... the second is better IF you can get as far as you did with the 0.5.11... I'd suspect that it might be as simple as an edit to the /system/etc/wifi/wpa_supplicant.conf that might be needed to have it set up the same as other devices using 0.5.x... I got this version working a few days ago on the Viewsonic Gtab (2.2 but running 0.5.11) so you might try comparing your conf with the one there... I'd suspect the only diff should/might be the cntl_interface definition...
I've attached the file with .txt added that worked for me on the Gtab...

macndroid said:
Most android devices don't connect to ad-hoc networks. Some are capable of tethering and broadcasting as an infrastructure AP, but my phone isn't. I need the nook to see and connect to ad-hoc networks because that is all my G1 can broadcast. Its not a nook problem per se, but an android problem. There are hacks described on this forum to circumvent the problem, they just don't work with my phone or the nook.
Click to expand...
Click to collapse
This is correct. From what I've read Android as of now doesn't support Ad-Hoc connections at all. All the HTC handsets I've used will work with Infrastructure mode because of the Broadcom chipset used. The OMAP based chips and Samsungs chips don't allow using them in Infrastructure mode from what I've read.
My Droid Inc works fantastic as a base station. My Droid didn't, and neither did my Vibrant.
I don't know why Android doesn't support Ad-Hoc connections yet, in my opinion that's just stupid.

Thanks
jtbnet said:
I don't yet have a nook to try this on, but I've used both these techniques on more than 1 device... the second is better IF you can get as far as you did with the 0.5.11... I'd suspect that it might be as simple as an edit to the /system/etc/wifi/wpa_supplicant.conf that might be needed to have it set up the same as other devices using 0.5.x... I got this version working a few days ago on the Viewsonic Gtab (2.2 but running 0.5.11) so you might try comparing your conf with the one there... I'd suspect the only diff should/might be the cntl_interface definition...
I've attached the file with .txt added that worked for me on the Gtab...
Click to expand...
Click to collapse
Wow - thanks for the input! I'll try again with your conf file when I get home and let you know how it goes.
It really is a shame Google didn't just make this work right the first time.
Edit: I also tried wpa_cli (pulled from my phone running CM 6) and added the ad-hoc network and tried to force it to connect but the interface remained disconnected even though the network was in the list wpa_cli generated. Details can be found here : www.olsr.org/?q=olsr_on_android. Maybe I need to try with the modified wpa_supplicant binary.....
Anyone know if there is an phone with the broadcom chipset that I can get used for a reasonable price AND I can use with T-mobile? At this point it might be the easiest solution.

SOLVED!
For those who haven't found the other thread, Cicada posted a wpa_supplicant (and directions for installation) that work on all Ad-Hoc networks tested so far.

Related

[Q] Problem with openvpn on Archos 101

Hi,
Last week I received my Archos 101. In general it is great. Even better is this forum
I installed urukdroid (thanks to the project-team!). I tried to use openvpn but it failed and I am not sure about the reason.
The server-configuration is
...
ifconfig-pool 10.10.10.120 10.10.10.130
push "route 10.10.10.1"
route 10.10.10.0 255.255.255.0
ifconfig 10.10.10.1 255.255.255.0
push "route-gateway 10.10.10.1"
push "route 10.10.10.0 255.255.255.0"
...
As the Archos is the only device it would get IP 10.10.10.120.
BUT: ifconfig shows:
inet addr.: 10.10.10.255 Bcast: 10.255.255.255 Mask 255.0.0.0
That did (and cannot) work. No ping to home network possible.
When I called route it looked fine (I used redirect-gateway).
When I send the command
ifconfig tap0 10.10.10.120 broadcast 10.10.10.1 netmask 255.255.255.0
from Archos Terminal I had at least access to my home network. But all route entries are gone.
Who has an idea what I am doing wrong? I checked it in the last day again and again... If there is no solution: is it possible to 'save' the entries from route and restore it after my manual change of ifconfig? I would like to do it via script, as my home network I only reachable via dyndns.
Thanks and best regards!
I used the OpenVPN Howto Quickstart and had no problems.
macemoneta said:
I used the OpenVPN Howto Quickstart and had no problems.
Click to expand...
Click to collapse
Yes, I know the guide. I did the same with my ubuntu-netbook and it works directly.
And I think, it would work also on the Archos, if the openvpn/ifconfig on Archos accept the 10.10.10.120. But the IP is changed to 10.10.10.255 and that did not fit.
Where the h*** did the 255 instead of 120 come from?
I noticed the same problem...
No idea where it comes from, but as a workaround, you can put a script somewhere containing a suitable "ip addr add x.x.x.x/y dev z" statement, and reference that in the .conf file as "up scriptname".
Note that you need to add "--script-security 2" to the openvpn commandline to make that work. I added that to the OPENVPN_CFG variable in /etc/uruk.conf/openvpn.
regards
Patrick
This is the openvpn configuration I use for my Archos 101 (on the server). I'm not having any problems, using openvpn 2.1.1:
Code:
port 1194
dev tun
tls-server
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/[COLOR="Blue"]<my host>[/COLOR].crt
key /etc/openvpn/keys/[COLOR="blue"]<my host>[/COLOR].key
dh /etc/openvpn/keys/dh1024.pem
mode server
ifconfig 10.8.0.1 10.8.0.2
ifconfig-pool 10.8.0.4 10.8.0.255
push "route 10.8.0.1 255.255.255.255"
client-config-dir ccd
push "redirect-gateway def1"
push "dhcp-option DOMAIN [COLOR="Blue"]<my domain>[/COLOR]"
push "dhcp-option DNS [COLOR="blue"]<my dns server>[/COLOR]"
keepalive 10 60
inactive 3600
route 10.8.0.0 255.255.255.0
user openvpn
group openvpn
persist-tun
persist-key
verb 4
I examined the situation a bit further.
The problem comes from the ifconfig command that openvpn calls itself:
Code:
/system/bin/ifconfig myvpn \
192.168.x.41 \
netmask 255.255.255.0 \
mtu 1500 \
broadcast 192.168.x.255
This is only used when tap interfaces are involved, which is the case in my setup, but not in the setup macemoneta is showing. caesar68: do you also use tap interfaces?
I can reproduce the problem by just using that ifconfig command again.
When I list the IP-address-to-set as the last argument, instead, it works, i.e.
Code:
/system/bin/ifconfig myvpn \
netmask 255.255.255.0 \
mtu 1500 \
broadcast 192.168.x.255 \
192.168.x.41
A quick scanning of the openvpn manpage, does not suggest a way to override the ifconfig command that is used, but it does give an option --ifconfig-noexec which suppresses its calling.
Unfortuntely, when I just pack the is-working-after-the-interface-is-up ifconfig command into an up script with this option, it just gives me an error SIOCSIFNETMASK (Cannot assign requested address) - even if the same commandline works when I run it over an already upped interface... Probably because the interface then already had an IP address...
No problem, though, ifconfig is obsolete anyway, let us just use ip link and ip addr, which are fortunately available under Uruk.
So, caesar68, the clean solution would be to have
--script-security 2 on the openvpn commandline, e.g. via OPENVPN_CFG in /etc/uruk.conf/openvpn
in your myvpn.conf file:
Code:
ifconfig-noexec
up-delay
up-restart
up /etc/openvpn/myvpn-on-up
a corresponding script /etc/openvpn/myvpn-on-up, executable, with content
Code:
#! /system/bin/sh
ip link set $dev mtu $tun_mtu up
ip addr add $ifconfig_local/$ifconfig_netmask \
broadcast $ifconfig_broadcast \
dev $dev
Works For Me
Thanks for the explanation and the workaround, brian_o'fish. Why are you using tap though? Tap provides an Ethernet bridge, so you'll be transporting packets that really don't need to be sent to your Archos (reducing available bandwidth). Tun is layer 3 routed, so only traffic destined for either endpoint goes over the VPN connection.
macemoneta said:
Why are you using tap though?
Click to expand...
Click to collapse
That's what the server I'm using, is configured to do, as it provides transparant bridged LAN access via VPN, and that is what I want, as I am the admin of said LAN and VPN.
If the low level of broadcasts we have, ever increases or appears to be a problem to me, I'll set up an additional tun server, but for now it is simply not an issue.
Anyway, good hint in general!
Hi all!
Thanks a lot for your comments. Yes I am using tap. I would like to have access to my home network (storage etc.). Therefore I want to use the brigde functionality. And that works only when I changed the ifconfig manually afterwards. But the route is distroyed then and packages to the internet are not routed secure thru my home-network.
@ brian_o'fish: Thanks for the advise. I will try that the next days. In the moment I am happy to read, that I am not the only one with the problem (and maybe to stupid to use openvpn - but on the netbook it works).
I have never worked with tun. Maybe I could check, if that is also a workaround.
I will keep you informed, but I am on a trip the next days.
Thanks again!
*** Update ***:
I didn't work neither with tap nor with tun. Meanwhile I tried to run VPNC. I had some trouble, but it works now.
caesar68 said:
I didn't work neither with tap nor with tun.
Click to expand...
Click to collapse
Did you try the approach I described with tap, and can tell where / how it failed?

[Q] Wifi MAC change

Hi all,
I've put CM7 on my HTC Legend and also upgraded the Radio as per instructions on some other thread here (http://forum.xda-developers.com/showthread.php?t=841932). All is fine, but I have some weird issues with not getting IP address from an AP
(NOTE: The wifi connecting problem was there before the radio upgrade, too - I upgraded radio to solve the GPS problems on CM7)
What happens (not always) is that Legend does not get an IP address from my local AP, while my notebook does, and internet access works (tested on several wifi clients).
The issue is fixed by restarting the AP - which is what I do not want to do anymore - like I said other wifi clients work fine and killing the AP for my Legend disturbs others that use the AP at that moment.
One thing I wanted to try was to change the MAC on the Legend to fool the AP.
I tried:
- busybox ip command that comes with CM7,
- busybox ifconfig command that comes with CM7,
- compiled 1.18.x busybox and tried ip and ifconfig
- tried with macchanger
all to have something like this printed:
# /data/local/download/busybox ifconfig tiwlan0 hw ether 00:23:76:dc:51:6e
ifconfig: SIOCSIFHWADDR: Operation not supported
tiwlan0 Link encap:Ethernet HWaddr 00:23:76C:51:6F
inet addr:192.168.1.2 Bcast:192.168.1.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:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
AFAIK, both ip and ifconfig should be able to do it.
Is there any other way to change the MAC? It does not need to be permanent (for now)..
OTOH, how can I get more information on wifi operation to see why it does not work?

USB to Ethernet dongle (from DealExtreme) - WORKS!

This is a DEV thread.
Unfortunately can't post in DEV forums as i never wrote in this site.
I've been working on enabling USB to Ethernet dongle on our Transformers as i didn't see any successful attempt in this area.
For my experiments I use USB to ethernet dongle from DealExtreme: (Link deleted. Can't post links. Search for "SKU 34691")
This dongle is based on ASIX AX88772B chipset.
Linux Driver was downloaded from: (Link deleted. Can't post links. Google for the driver v4.1.0)
I've compiled the driver with latest Clemsyn kernel downloaded from his git: (Link deleted. Can't post links)
The driver compiles without errors to asix.ko file (attached)
After insmoding the driver into the kernel i connected the dongle to USB port on the keyboard dock and connected RJ45 cable to it from my router. The blue led turned on and started to blink!! (Never happened before!).
Encouraged by this development i've executed the following sequence in terminal:
Code:
ifconfig eth0 10.0.1.17 netmask 255.255.255.0 broadcast 10.0.1.255
route add default gw 10.0.1.1
The commands executed without errors and i tried to ping my router
Code:
ping 10.0.1.1
and.. it WORKED!
Started pinging computers in my local LAN - everything WORKED!
Access to router web interface via browser - WORKS!
Here the happy story ends.
I couldn't manage to ping any IP addresses outside the local network.
I think i'm very close to make this work.
Any help will be appreciated.
Edit:
FULLY WORKS!!!
Need to add DNS configuration (i set to Google DNS server):
Code:
setprop net.dns1 8.8.8.8
And that is it!
USB to Ethernet dongle fully works on Asus Transformer
Edit 2:
Not all applications work with wired connection.
Browser and Gmail work, but Skype does not.
Need to investigate further.
Good stuff! It would be nice to have the option to use a wired network in case you needed to! Great work!
dear Quiethinker~~
i have been searching for whole day and finally reach your post. good stuffs
it would be even better if you can share the procedures step by step, such as how to "insmod" ....
thank you very much~~
jaseli said:
dear Quiethinker~~
i have been searching for whole day and finally reach your post. good stuffs
it would be even better if you can share the procedures step by step, such as how to "insmod" ....
thank you very much~~
Click to expand...
Click to collapse
I'll try to explain the procedure step by step (a bit improved sequence since my first trails):
1. Get USB to Ethernet dongle from DealExtreme (SKU 34691) - Do not attach it yet.
2. Install terminal application on the Transformer (such as "Android Terminal Emulator")
3. Turn off the WIFI.
4. Extract axis.ko.zip to some location in the Transformer (for example root of the sdcard)
5. Open terminal application and execute the following commands in the command line:
Code:
su
insmod [PATH_TO_KO]/axis.ko
6. Attach USB to Ethernet dongle to USB port on the Transformer's dock and connect RJ45 network cable. (Blue led on the dongle should start blinking)
7. Execute the following commands in the command line:
Code:
/system/bin/dhcpdc eth0
setprop net.dns1 8.8.8.8
8. Test that you have internet connection:
Code:
ping google.com
Currently there is lots of limitations with this solution:
- I compiled the KO module with clemsyn kernel v8b and checked only with this kernel.
- Android system doesn't recognize wired connection and therefore many apps think that there is no connection available
- When transformer going to power-down mode it disconnects the USB network. After waking up need to execute step 7 again.
I'm currently working on several directions in this area:
- Enabling support for more USB to Ethernet sticks within the kernel (custom kernel release is needed unless kernel devs will push the changes into their kernels)
- Enabling automatic configuration for wired network in android (Some scripting)
The achievement in this post is a proof of concept. I'm making a progress but very slowly due to very limited time. I hope more devs will pick this up.
Also attaching the sources for asix.ko driver so people can compile it with different available kernels
The drivers for ASIX AX88772B chipset are already in the kernel
I have one of these usb-eth dongles too and it works without the need for any extra drivers.
I simply run dhcpcd eth0 to pickup an ip address from dhcp and then setprop net.dns1 8.8.8.8 for dns.
I have an EDIMAX EU-4207
Other dongles using this chipset include the WII adapter, the Apple dongle and the linksys/cisco USB200M or USB300M
Roach2010 said:
The drivers for ASIX AX88772B chipset are already in the kernel
I have one of these usb-eth dongles too and it works without the need for any extra drivers.
I simply run dhcpcd eth0 to pickup an ip address from dhcp and then setprop net.dns1 8.8.8.8 for dns.
I have an EDIMAX EU-4207
Other dongles using this chipset include the WII adapter, the Apple dongle and the linksys/cisco USB200M or USB300M
Click to expand...
Click to collapse
Good to know that your kernel includes it!
(Checked your GITHUB, do your refer to CONFIG_USB_NET_AX8817X=y ?)
Till now i worked with Clemsyn-Blades kernel and this wasn't included (maybe need to switch kernels )
Now only need to find automatic way to configure eth0 on insert/wake-up and it will be usable for regular users.
Quiethinker said:
Good to know that your kernel includes it!
(Checked your GITHUB, do your refer to CONFIG_USB_NET_AX8817X=y ?)
Till now i worked with Clemsyn-Blades kernel and this wasn't included (maybe need to switch kernels )
Now only need to find automatic way to configure eth0 on insert/wake-up and it will be usable for regular users.
Click to expand...
Click to collapse
Ah yes, Asus added support since 3.2. I think we can enable it via a service call in init.rc but eth0 doesn't play too well with wlan0 I've found.
proby a dumb question anyways
but has to be a rooted device doesn't it?
lil-devil said:
proby a dumb question anyways
but has to be a rooted device doesn't it?
Click to expand...
Click to collapse
Shortly - yes
Ok, it works well with my USB Lan adapter (Browser, Market browsing, etc.), but if I want to download an app from the market it doesnt work (only over Bluetooth or Wifi).
Lines I used:
dhcpcd eth0
setprop net.dns1 8.8.8.8
Is there a solution for the market download problem?
Would one or both of these adapters be supported?
http://www.monoprice.com/products/subdepartment.asp?c_id=103&cp_id=10311&cs_id=1031102
Thanks.
No: Product ID: 6150
Maybe: Product ID: 5345
You need NetGear FA 120 (search ebay)
xperiaflooter said:
Ok, it works well with my USB Lan adapter (Browser, Market browsing, etc.), but if I want to download an app from the market it doesnt work (only over Bluetooth or Wifi).
Lines I used:
dhcpcd eth0
setprop net.dns1 8.8.8.8
Is there a solution for the market download problem?
Click to expand...
Click to collapse
Its a problem with honeycomb. Currently it doesn't support wired connections. We can trick it on "kernel level" but some applications use additional API to check for connectivity. Currently I don't know how to trick this API.
Sent from my HD2 using xda premium
Thanks for the info. But I dont know why Asus integrated USB LAN drivers, without automatic loaders. That makes no sense. But,... ok, I am glad that the driver is inside
xperiaflooter said:
Thanks for the info. But I dont know why Asus integrated USB LAN drivers, without automatic loaders. That makes no sense. But,... ok, I am glad that the driver is inside
Click to expand...
Click to collapse
Maybe in some future honeycomb update this feature will be built-in.
I really hope so at least!
I was able to get my USB 2.0 NIC working without a module on Stock3.2 (rooted) and Prime! 1.8.4.
I found a script on here that I placed in /data/ for DHCP
Code:
#!/system/bin/sh
netcfg eth0 dhcp
dhcpcd eth0
DNS1 = `getprop net.eth0.dns1`
DNS2 = `getprop net.eth0.dns2`
setprop net.dns1 $DNS1
setprop net.dns2 $DNS2
Here is the one for static.
Code:
#!/system/bin/sh
busybox ifconfig eth0 192.168.1.22
route add default gw 192.168.1.1
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4/
Here is the original post from XDA user : Linuxslate
http://forum.xda-developers.com/showpost.php?p=14367749&postcount=41
I don't recall the brand, but here is the chipset.
http://www.asix.com.tw/products.php?op=pItemdetail&PItemID=97;71;101&PLine=71
ciphercore said:
I was able to get my USB 2.0 NIC working without a module on Stock3.2 (rooted) and Prime! 1.8.4.
.....
I don't recall the brand, but here is the chipset.
http://www.asix.com.tw/products.php?op=pItemdetail&PItemID=97;71;101&PLine=71
Click to expand...
Click to collapse
That's pretty cool. The Cisco-Linksys USB300M adapter appears to be using that same chipset, so I went ahead and ordered one. I should receive it sometime next week, at which time I'll report back if it works.
I'm working now
Running 3.2 with the latest build 8.5.9. It seems to have the needed driver built in corectly. I've then taken the following script and put it in /system/sbin (I called it wired) The apple USB to ethernet adapter is the one I'm using (cheapest available)
#!/system/bin/sh
ifconfig eth0
if [ $? -gt "0" ]; then
netcfg eth0
dhcpcd eth0
export DNS1=`getprop net.eth0.dns1`
export DNS2=`getprop net.eth0.dns2`
setprop net.dns1 $DNS1
setprop net.dns2 $DNS2
else
netcfg eth0 down
fi
If the device is not up $? will be larger than 0 (0 is success and if the device is down the command fails.) So the script brings up eth0. If eth0 is up $? equals 0 and the script brings the device down cleanly.
Now If I can just figure out how to turn this into an icon on the desktop I'll be all set
linuxrebel said:
Running 3.2 with the latest build 8.5.9. It seems to have the needed driver built in corectly. I've then taken the following script and put it in /system/sbin (I called it wired) The apple USB to ethernet adapter is the one I'm using (cheapest available)
#!/system/bin/sh
ifconfig eth0
if [ $? -gt "0" ]; then
netcfg eth0
dhcpcd eth0
export DNS1=`getprop net.eth0.dns1`
export DNS2=`getprop net.eth0.dns2`
setprop net.dns1 $DNS1
setprop net.dns2 $DNS2
else
netcfg eth0 down
fi
If the device is not up $? will be larger than 0 (0 is success and if the device is down the command fails.) So the script brings up eth0. If eth0 is up $? equals 0 and the script brings the device down cleanly.
Now If I can just figure out how to turn this into an icon on the desktop I'll be all set
Click to expand...
Click to collapse
Great script!
Search for GScript app on the market. This is what you looking for
earlyberd said:
That's pretty cool. The Cisco-Linksys USB300M adapter appears to be using that same chipset, so I went ahead and ordered one. I should receive it sometime next week, at which time I'll report back if it works.
Click to expand...
Click to collapse
Just to update, the USB300M works fine as well.

[Q] Wifi tethering uses slightly broken iptables line for masquerading?

As seen when I type with wifi tethering enabled
iptables -L -t nat -v
the MASQUERADE line is like "-o pdp0 -i any", this means that packets are matched only when they exit via the mobile network.
However, the line should be more like "-i softap0 ! -o softap0". The MASQUERADE line should match packets that enter via the wifi access point, and leave via any other interface. (But see below, -i doesn't work, must use -s)
I found this while trying to use openvpn. When openvpn is running, the android device has complete access to the vpn according to my tests. The laptop associated with the AP can access the internet, the android device, but not the network behind the VPN connection. I can find no reason for this other than the MASQUERADE line. The routing table, sysctl *.forward etc. are all looking fine.
With this MASQUERADE line, it cannot possibly work, because when the unmasqueraded softap0 packets go down the tun0 interface, no machine knows where to route the reply packets.
This is on Android 2.3, Samsung galaxytab stock firmware. I'll investigate further.
Update:
when I stop tethering, the MASQUERADE rule goes away. This proves it's indeed controlled by tethering.
I tried it on Android 4.0, Sony Xperia pro, Cyanogenmod 9 ---> same thing
I can understand that noone ever thinks about making a MASQUERADE line with "-i interface", but it seems actually the right thing to me. (Must use -s addr/mask instead) I'm doing this on a laptop with lots of virtual machines connected to an internal network. This must be masqueraded for outgoing packets, no matter what interface it goes out (wlan0, eth0, openvpn etc.)
Update:
-i interface doesn't work in POSTROUTING. So the line should be "-s address_range_of_softap ! -o interface".
This complicates matters for a workaround. I'm planning to schedule a script at boot time, but I don't know how to (correctly) find the softap address when it's not running.
Update:
I tried tethering and replaced the iptables rule with "-s address_range_of_softap ! -o softap0" instead of just "-o pdp0". This still works to route/masquerade traffic to the internet, but doesn't work vor tun0 (openvpn). I don't know why. No packets/bytes go through it (counter doesn't increase) when pinging the other side of the vpn.

Configure WLAN manually in Android 8.1

Hi all,
In order to keep both WiFi and LTE connections working, I tried to start WiFi connections manually. I found following commands working successfully on a Nexus 4 with Android 4.3 (rooted, with busybox):
netcfg wlan0 up
cd /data/misc/wifi/.
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
dhcpcd wlan0
However, I met problems when attempting to apply the same methods on a Nexus 6P with Android 8.1 (rooted, with busybox). I run ifconfig instead of netcfg, but I am not sure about following steps.
Should I still use wpa_supplicant? I found it in /system/bin/hw rather than /system/bin. Besides, the configuration file wpa_supplicant.conf has a different format from Android 4.3 (no longer containing ssid and passwords). What is the correct way to assign wlan0 an ssid?
dhcpcd is not available as well. How should I request an IP address for wlan0?
Thanks!

Categories

Resources