Last time, we set up networking over USB on the Clara HD, but this required us to manually start and stop the network. We will now configure the Clara HD to automatically start USB networking when connected over USB.

The Clara HD uses udev to manage hardware events, and /usr/local/Kobo/udev/ac and /usr/local/Kobo/udev/plug are executed when connected over USB. We will patch these files to automatically start USB networking.

Recall from part 3 that these files will be automatically overwritten on an update, so to allow our changes to persist, we will make these changes in /opt and use /opt/afterinit.sh to replace the originals on every boot.

On the Clara HD, run:

mkdir /opt/udev
cp /usr/local/Kobo/udev/ac /opt/udev/ac
cp /usr/local/Kobo/udev/plug /opt/udev/plug

Now edit both /opt/udev/ac and /opt/udev/plug, and add the following line to the end of both:

/opt/usbtoeth

Edit /opt/afterinit.sh and add the following lines to the end:

cp /opt/udev/ac /usr/local/Kobo/udev/ac
cp /opt/udev/plug /usr/local/Kobo/udev/plug

(Assuming that you set up /opt/afterinit.sh in part 3, and created the /opt/usbtoeth script in part 4.1)

Now restart the Clara HD, and our patches will be applied.

If we connect the Clara HD to the computer via USB, the USB port will now automatically be switched to networking, and telnet can be accessed in the same way as in part 4.1.

(Note: I've experienced intermittent issues with the USB networking. I haven't identified the cause, but stability seems to be improved by dismissing the Computer detected dialog box.)

What next

Part 4.3: Automatically switching between USB networking and file transfer