Attached is a trivial java program to start USBNet on the A780. It reproduces what usbnet.lin does which is merely to write MotNet to /proc/usbd-switch. There are two problems with the file access API, the first is that the program needs special permissions to run (permfile.txt attached), and the second is that you can only access files within the pre-designated "root" directories of the phone, namely /phone/ which is actually /diska on the A780 and /HHHHHHHHHH/ (hex) which is your transflash card.
I tried using .. but that gives me a security exception. Additionally, neither /diska nor the transflash card support symlinks or devices by default. Solution one is:
mkdir /diska/proc; mount -o bind /ram/proc /diska/proc
then you can write to /phone/proc/usbd-switch. The trouble with that is that you have to run those commands each time your phone boots.
Solution two appears to be to create a symlink supporting filesystem on the transflash card, perphaps vfm or ext2 or someething that the kernel supports. I have only tried this theoretically, as I would prefer to get a spare transflash card before messing with my copilot data. However, symlinks do look like they're followed. My theoretical test was:
mkdir /bind/root; mount -o bind / /diska/root; touch /tmp/abcd;chmod 666 /tmp/abcd;ln -s /tmp/foo /tmp/abcd
Then I wrote to /phone/root/tmp/foo and the text went in /tmp/abcd. If this works with the transflash card then it will survive a reboot and might be useful for a few things. If anyone has reformatted their transflash, can they give it a go?
To test, edit the attached jad which contains the following parameters:
root: /phone
File: proc/usbd-switch
Text: MotNet
install the jad, copy permfile.txt over /diska/.system/java/DownloadApps/MIDlet00NNN/permfile.txt
and then run.
Source attached also.
Edited. It seemed I could only have two attachments, so I've put everything in usbnet.tar.gz