# dhcp, hotplug, and my zaurus

## Seth

Hello,

I'm trying to get the usb0 interface to come up more than intermittently when  when I plug my zaurus into its cradle. To that end, I've followed advice from some of the threads in the forums, but with little luck. Sometimes the interface comes up, but most times it doesn't. And I can't figure out why.

These are the steps I've taken.

1. Added the line iface_usb0="dhcp" to /etc/conf.d/net.

2. Copied net.eth0 to net.usb0 in /etc/init.d

3. Placed the following script (named usbdnet) in /etc/hotplug/usb:

```

#! /bin/bash 

 

 sleep 1 

 cp /root/modules.hotplug /lib/modules/2.4.19-gentoo-r10/modules.usbmap

 sleep 1 

 

 typeset -i num 

 num=`ifconfig | grep usb0 | wc -l` 

 if [ $num -eq 0 ] ; then 

 ifconfig usb0 192.168.129.1 netmask 255.255.255.255 up 

 route add -host 192.168.129.201 usb0 

 fi 

 
```

4. And, as the script implies, and as the post I got it from makes clear, I've got a copy of modules.usbmap in /root with the correct values that gets copied whenever hotplug runs the usbdnet script.

Now whenever I plug the zaurus into its cradle I get the following messages:

```

Mar 24 16:28:01 [kernel] hub.c: USB new device connect on bus1/2, assigned device number 16

Mar 24 16:28:01 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 start

Mar 24 16:28:04 [/etc/hotplug/usb.agent] Setup usbdnet for USB product 4dd/8004/0

Mar 24 16:29:01 [dhcpcd] timed out waiting for a valid DHCP server response

Mar 24 16:29:01 [rc-scripts] Failed to bring usb0 up

```

There are clearly things going on here that I don't understand. Is the zaurus supposed to be a valid DHCP server? If so, how do I get it to bring up the usb0 interface? If not, how do I get it to recognize a static usb0?

interface?

Thanks,

Seth

----------

## PorkySpine

Hello!

Ok, in your case it seems that your zaurus isn't running DHCP server, but every thing else is working fine  :Smile: 

So, instead of putting 

iface_usb0="dhcp" 

in /etc/conf.d/net, put

```

iface_usb0="192.168.129.1 broadcast 192.168.129.255 netmask 255.255.255.0"

```

 (I am using this configuration my self).

You don't need that script in /etc/hotplug/usb.

Bye!

----------

## Seth

Hello Tiago,

I'm glad you're still responding to questions about using a zaurus with gentoo!

 *PorkySpine wrote:*   

> 
> 
> in /etc/conf.d/net, put
> 
> ```
> ...

 

Thanks for the suggestion about changing the iface_usb0 in net. I did as you said and restarted net.eth0 and for a minute I could see the interface with the ip. Then the zaurus froze. I rebooted, but have been unable to bring usb0 up since. 

Maybe I haven't set the zaurus up properly. My current service is USB - TCP and I'm letting it  get its ip automatically. What it tells me is that its ip address is usbd0. 

What the heck does that mean?

Thanks, Seth

----------

## PorkySpine

Hello again.

1- You don't need to set that service. I just have the IP configured in "Sync" tab (192.168.129.201).

2- Restarting net.eth0? What for? If you wanted to say net.usb0, then you didn't needed to restart. Load all modules (including usbdnet), start hotplug, turn on your zaurus (in the cradle) and watch kernel messages... 

3- Usbdnet is quite a buggy ans unstable driver. It crashes my kernel sometimes (not the Zaurus... my desktop). Some say that usbnet in kernel 2.5 works perfectly, and it can be used in kernel 2.4.x, but i haven't tried yet.

I can't say why your zaurus crashed, or why usb0 didn't came up... kernel messages can give some clues. Try reloading modules, hotplug, bootstrap (ok... maybe not this one   :Very Happy: )...

As i said, i like to help with waht i can. I am much more helped that hepler...

----------

## Seth

Bah, this is so frustrating. Nothing I do works. When I pull the zaurus out of the cradle I get the following messages:

```

Mar 26 07:12:32 [kernel] usb.c: USB disconnect on device 35

Mar 26 07:12:33 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 stop

Mar 26 07:12:33 [modprobe] modprobe: Can't locate module usb0

```

When I reseat it, I get these messages:

```

Mar 26 07:13:27 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 start

Mar 26 07:13:27 [rc-scripts] WARNING:  "net.usb0" has already been started.

Mar 26 07:13:30 [/etc/hotplug/usb.agent] Setup usbdnet for USB product 4dd/8004/0

```

I wonder about the line

 *Quote:*   

> 
> 
> Can't locate module usb0
> 
> 

 

that shows up when I pull the zaurus out of the cradle.

Thanks,

Seth

----------

## happy

Here's as much relavent info that I can remember:

```

poretz root # uname -srvpio

Linux 2.4.20-gentoo-r1 #6 Tue Mar 25 15:58:12 PST 2003 Celeron (Coppermine) GenuineIntel GNU/Linux

poretz root # tail -f /var/log/everything/current

Mar 26 10:26:02 [rc-scripts] WARNING: "net.usb0" has already been started.

Mar 26 10:26:05 [/etc/hotplug/usb.agent] ... no modules for USB product 4dd/8004/0

Mar 26 10:30:47 [su(pam_unix)] session opened for user root by (uid=1000)

Mar 26 10:45:40 [kernel] usb.c: USB disconnect on device 00:07.2-1 address 3

Mar 26 10:45:41 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 stop

Mar 26 10:45:41 [modprobe] modprobe: Can't locate module usb0

Mar 26 10:45:45 [kernel] hub.c: new USB device 00:07.2-1, assigned address 4

Mar 26 10:45:45 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 start

Mar 26 10:45:45 [rc-scripts] WARNING: "net.usb0" has already been started.

Mar 26 10:45:49 [/etc/hotplug/usb.agent] Setup usbdnet for USB product 4dd/8004/0

poretz root # dmesg | grep usb

usb.c: registered new driver hub

usbdnet.c: v0.4b sl@lineo.com, tbr@lineo.com

usbdnet.c: USB Host to Device Network - for Linux USB Devices using MDLM/CDC

usb.c: registered new driver usbdnet

usb-uhci.c: $Revision: 1.275 $ time 16:28:00 Mar 25 2003

usb-uhci.c: High bandwidth mode enabled

usb-uhci.c: USB UHCI at I/O 0xdce0, IRQ 11

usb-uhci.c: Detected 2 ports

usb.c: new USB bus registered, assigned bus number 1

usb-uhci.c: v1.275:USB Universal Host Controller Interface driver

usbdnet: probe

usbdnet: CRC

usb-uhci.c: interrupt, status 2, frame# 1801

usb-uhci.c: process_transfer: fixed toggle

usb-uhci.c: process_transfer: fixed toggle

usb-uhci.c: process_transfer: fixed toggle

usb.c: USB disconnect on device 00:07.2-1 address 2

usb-uhci.c: process_transfer: fixed toggle

usbdnet: probe

usbdnet: CRC

usb.c: USB disconnect on device 00:07.2-1 address 3

usbdnet: probe

usbdnet: CRC

poretz root # lsmod

Module                  Size  Used by    Not tainted

floppy                 67004   0  (autoclean)

usb-uhci               29996   0  (unused)

parport_pc             14212   1  (autoclean)

lp                      7392   0  (autoclean)

parport                16544   1  (autoclean) [parport_pc lp]

maestro3               35568   0

soundcore               4132   2  [maestro3]

ac97_codec             11144   0  [maestro3]

3c575_cb               22148   2

cb_enabler              2896   2  [3c575_cb]

usbdnet                15424   0

ds                      7304   2  [cb_enabler]

i82365                 27008   2

pcmcia_core            49312   0  [cb_enabler ds i82365]

poretz root # cat /etc/hotplug/usb.usermap

# usb module         match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info

usbdnet              0x0003      0x04dd   0x8004    0x0000       0x0000       0x02         0x00            0x00            0xff                0x01               0x00               0x00000000

```

----------

## happy

Mar 26 10:25:41 [kernel] usb-uhci.c: interrupt, status 2, frame# 1801

Mar 26 10:25:41 [kernel] usb-uhci.c: process_transfer: fixed toggle

Mar 26 10:25:41 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 stop

Mar 26 10:25:41 [modprobe] modprobe: Can't locate module usb0

Mar 26 10:26:01 [kernel] hub.c: new USB device 00:07.2-1, assigned address 3

Mar 26 10:26:01 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 start

Mar 26 10:26:02 [rc-scripts] WARNING: "net.usb0" has already been started.

Mar 26 10:26:05 [/etc/hotplug/usb.agent] ... no modules for USB product 4dd/8004/0

poretz root # lsmod

Module                  Size  Used by    Not tainted

floppy                 67004   0  (autoclean)

usb-uhci               29996   0  (unused)

parport_pc             14212   1  (autoclean)

lp                      7392   0  (autoclean)

parport                16544   1  (autoclean) [parport_pc lp]

maestro3               35568   0

soundcore               4132   2  [maestro3]

ac97_codec             11144   0  [maestro3]

3c575_cb               22148   2

cb_enabler              2896   2  [3c575_cb]

usbdnet                15424   0

ds                      7304   2  [cb_enabler]

i82365                 27008   2

pcmcia_core            49312   0  [cb_enabler ds i82365]

poretz root #

poretz root # dmesg | grep usb

usb.c: registered new driver hub

usbdnet.c: v0.4b sl@lineo.com, tbr@lineo.com

usbdnet.c: USB Host to Device Network - for Linux USB Devices using MDLM/CDC

usb.c: registered new driver usbdnet

usb-uhci.c: $Revision: 1.275 $ time 16:28:00 Mar 25 2003

usb-uhci.c: High bandwidth mode enabled

usb-uhci.c: USB UHCI at I/O 0xdce0, IRQ 11

usb-uhci.c: Detected 2 ports

usb.c: new USB bus registered, assigned bus number 1

usb-uhci.c: v1.275:USB Universal Host Controller Interface driver

usbdnet: probe

usbdnet: CRC

usb-uhci.c: interrupt, status 2, frame# 1801

usb-uhci.c: process_transfer: fixed toggle

usb-uhci.c: process_transfer: fixed toggle

usb-uhci.c: process_transfer: fixed toggle

usb.c: USB disconnect on device 00:07.2-1 address 2

usb-uhci.c: process_transfer: fixed toggle

usbdnet: probe

usbdnet: CRC

poretz root #

poretz root # cat /etc/hotplug/usb.usermap

# usb module         match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info

usbdnet              0x0003      0x04dd   0x8004    0x0000       0x0000       0x02         0x00            0x00            0xff                0x01               0x00               0x00000000

poretz root #

----------

## PorkySpine

Ok. now i see that i have the same problem...

I will see this. Meanwile, i just put net.usb0 manualy:

```

# /etc/init.d/net.usb0 stop

```

It seems that every thing is working. Hotplug, and usbdnet are working, and net.usb down works when its executed manualy, but not by hotplug... very strange.

----------

## happy

Interesting. This gave me the idea to try this:

1) pull Zaurus from cradle.

2) execute /etc/init.d/net.usb0 stop

3) insert Zaurus into cradle

4) execute /sbin/ifconfig

5) tail /var/log/everything/current

Nothing came up on ifconfig for usb0.

Here's what I had in my log:

```

poretz root # tail -f /var/log/everything/current

Mar 26 11:23:01 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 stop

Mar 26 11:23:01 [modprobe] modprobe: Can't locate module usb0

Mar 26 11:23:04 [kernel] hub.c: new USB device 00:07.2-1, assigned address 6

Mar 26 11:23:04 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 start

Mar 26 11:23:04 [rc-scripts] WARNING: "net.usb0" has already been started.

Mar 26 11:23:07 [/etc/hotplug/usb.agent] Setup usbdnet for USB product 4dd/8004/0

Mar 26 15:54:40 [kernel] usb.c: USB disconnect on device 00:07.2-1 address 6

Mar 26 15:54:40 [/etc/hotplug/net.agent] invoke /etc/init.d/net.usb0 stop

Mar 26 15:54:41 [modprobe] modprobe: Can't locate module usb0

Mar 26 16:18:19 [modprobe] modprobe: Can't locate module usb0

poretz root #

```

Any idea what the problem is with the modprobe error?

----------

## Seth

Yes. Manually stopping net.usb0 does the trick. It's an interesting problem. Clearly hotplug is giving the command to unload the interface, and when I do the same I get 

 *Quote:*   

> 
> 
> ring init.d # ./net.usb0 stop
> 
>  * Bringing usb0 down...
> ...

 

So something is bringing usb0 down. But what? We should probaly check with the hotplug folks to see if it's a known bug.

Seth

----------

## PorkySpine

I get the same thing. But i think that it is not hotplug who is bringing that net.usb0 down. That is probably caused by the module. He is responsible to create a usb0 interface (has shown with ifconfig -a), and hotplug just has to bring net.usb0 up and down.

I don't have the time right now (its's about 2 am here in Portugal), but  i'll check in /etc/hotplug/net.agent, which is the script that calls /etc/init.d/net.usb0.

Maybe putting a sleep in it will help.

----------

## HandyAndE

You can write a simple getaround.

Edit vim /etc/hotplug/net.agent

and do a search replace changing "start" to "restart"

Now it does not matter if it has come down or not...

works for me anyhow...

Andy

----------

## trakon88

Hi Guys,

first of all: I use the 2.4.21-rc1-ac2 Kernel with usbnet compiled as a module ... all other usb stuff as usual

I just wrote a little script: /etc/hotplug/usb/usbnet

that's whats written in there ...

#! /bin/bash

dhcpcd -R usb0

and I can take the zaurus a million times out of the cradle, into the cradle, out of the cradle ...

what you think? dhcp is recomended with ROM 2.38 ...

greetings 

            aleX

----------

## NorthGoingZax

Hey everybody, i've gotten this far:

usb0      Link encap:Ethernet  HWaddr 40:00:00:00:FF:0B

          inet addr:192.168.129.1  Bcast:192.168.129.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:13 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100

          RX bytes:0 (0.0 b)  TX bytes:6135 (5.9 Kb)

if I ping 192.168.129.1 I get an instant response, but not with 192.168.129.201. Is this meaningfull ? IF so how can I ftp to my zaurus ?

----------

## lami

First I want to thank Seth and PorkySpine, your posts helped me connect my Zaurus C750 in a first try. After some hacking into source of usbdnet.c to recognize it, of course.

And it works 100% fine, when I switch it off, usb0 goes down etc. This error about module usb0 - in howto I read to compile usbdnet as module - do you have it so? Maybe it can be your problem.

----------

