Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-06-2012, 08:32 PM   #1
damaru
Enthusiast
damaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animals
 
damaru's Avatar
 
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.
damaru is offline   Reply With Quote
Old 06-06-2012, 08:35 PM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by damaru View Post
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.
You can define that behavior in a udev rule.
google will be a help if you haven't written udev rules before.
knc1 is offline   Reply With Quote
Old 06-06-2012, 08:52 PM   #3
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
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.
geekmaster is offline   Reply With Quote
Old 06-06-2012, 10:16 PM   #4
damaru
Enthusiast
damaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animals
 
damaru's Avatar
 
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...
damaru is offline   Reply With Quote
Old 06-06-2012, 10:31 PM   #5
damaru
Enthusiast
damaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animalsdamaru is kind to children and small, furry animals
 
damaru's Avatar
 
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
damaru is offline   Reply With Quote
Old 06-07-2012, 02:34 AM   #6
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by damaru View Post
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
I was unable to give you details in my first post because you forgot to mention which "Linux" you had installed.

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).
knc1 is offline   Reply With Quote
Old 06-07-2012, 03:32 AM   #7
zizzfizzix
Junior Member
zizzfizzix began at the beginning.
 
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;
zizzfizzix is offline   Reply With Quote
Old 06-07-2012, 08:05 AM   #8
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by zizzfizzix View Post
Your distro most probably ships with networkmanager so instead of reinventing the wheel you could actually use it.
Unless it ships with conman, one of the others, or none at all.

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
If the O.P. has Network Manager installed, and the above setting '=true' then it will 'manage' the ifup and ifdown commands - which in turn use the file the O.P. modified.

Translation: You can't assume the O.P. re-invented anything from the thread content here.
knc1 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 09:47 AM.


MobileRead.com is a privately owned, operated and funded community.