![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
automating the ifconfig usb0 192.168.2.1 on the host
So is there a way to automating the ifconfig usb0 192.168.2.1 on the host, I am on linux, and would like my computer to setup the usb0 to the proper ip address as soon as the kindle is connected to the computer.
|
![]() |
![]() |
![]() |
#2 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
google will be a help if you haven't written udev rules before. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Or you can use a script, such as "mntusb" in the hacks sticky thread, which I wrote to allow using multiple kindles at the same time on different USB ports.
|
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
ok so it's working but really ugly code atm :
I added a udev rule : KERNEL=="usb[0-9]*", DEVPATH=="/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/net/usb0", ACTION=="add", RUN+="/usr/local/sbin/kindle-usb-add.sh %k" I was not able to get the udev being trigger trough a ATTRS{vendor}=="Kindle " so I had to: udevadm monitor --kernel (and the connect the kindle) to find where the kindle was mounted. (hence the DEVPATH=="/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/net/usb0" ) Then the kindle-usb-add.sh has only the ifconfig usb0 192.168.2.1 in a bash script so it's working but the udev is plain ugly and would love to find something more classy so that udev can 'see' the kindle and not only look for the devpath. Even if I plug it in a different usb the udev don't work... |
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
ho well - the udev is kind of nice but I can't get it to look good enough, I used instead some network config in my /etc/network/interfaces:
allow-hotplug usb0 mapping hotplug script grep map usb0 iface usb0 inet static address 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255 up iptables -I INPUT 1 -s 192.168.2.1 -j ACCEPT which work the same, but is cleaner |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
There are a lot of different ones out there, and not all of them use that control file (they all use udev - even the Kindle uses udev). If you had provided a better question, I could have given you a better answer (see signature). |
|
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() Posts: 1
Karma: 10
Join Date: Jun 2012
Device: KT
|
Your distro most probably ships with networkmanager so instead of reinventing the wheel you could actually use it.
GUI configuration varies but files are similar, mine (in /etc/NetworkManager/system-connections/) looks like this: Code:
[802-3-ethernet] port=mii mac-address=ee:49:0:0:0:0 [connection] id=usbnet kindle uuid=30a862ca-e1a0-4f8a-ac91-e0410b53a391 type=802-3-ethernet permissions=user:zizzfizzix:; [ipv6] method=ignore [ipv4] method=manual addresses1=192.168.15.1;24;0.0.0.0; |
![]() |
![]() |
![]() |
#8 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Better to ask for clarification or assume the lowest common denominator. And even if: "Your distro most probably..." is true, you can't tell from the content of this thread the settings in /etc/NetworkManager/NetworkManager.conf, such as: Code:
[ifupdown] managed=false Translation: You can't assume the O.P. re-invented anything from the thread content here. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
automating news downloads | jimh12345 | Recipes | 8 | 07-07-2011 04:09 PM |
Improved recipe for hungarian '168 óra' | ironcat | Recipes | 1 | 03-24-2011 06:53 AM |
Automating news delivery | nohatjim | Calibre | 7 | 02-08-2011 03:37 AM |
automating news fetching | zerozombie72 | Calibre | 6 | 02-16-2010 04:31 PM |
Automating without Whispernet | Gideon | Amazon Kindle | 11 | 07-05-2008 02:10 PM |