Friday, February 9, 2007

Synce & Linux & WM5 & Password

In a time I developed for WM5 under linux, I found that it was hard and tiresome to copy executable file to PDA for testing. Files were copied to PDA either by using of MMC card or by mounting of PDA as USB Storage. Both ways are not convenient at all when you do such actions every five minutes. In addition, the executable had to be executed to see how it did its job. I executed it by my hands. Indeed, there is no need to say that after I had developed in windows and such actions had been done by batch files there, I was annoyed in linux enough. Then when I tried to find a better solution for testing process, I came to synce project. At first, it seemed that usb-rndis driver for kernel had to be downloaded, compiled and installed. I did it, but it failed on compilation. Short studies of site were needed to found out that there was the new driver "usb-rndis-lite" It did well this time. As the result of installation I got new network device: rndis0. Then it was needed to setup synce utils and libs. It was hardest thing to complete. I tried to follow to the instruction from the wiki. But odccm gave me errors about d-bus, hal and so on. Error were dumb.. i.e. they were without any meaning of what really happened wrong. Then I tried vdccm... and it seemed that success was not even near to partitial... There was only one good thing - vdccm started without errors :). It was silent and sad. I started to google for the word vdccm and after a while I found out that one had used triggerconnection util to notify ActiveSync. But in my hands triggerconnection had no effect neither on vdccm nor on ActiveSync. I had walked through sources of the triggerconnection, it looked like it sends a pocket to the port 5679 of PPC. Then PPC was scanned by nmap. And nmap told me that there was no open ports on PPC!! I had no idea why port 5679 was not opened while ActiveSync had been started. I was exhausted and tired. Alas, I had spent a lot of time trying to figure out why port 5679 had been closed, although, at last, it came to me that the port could stay open for a few seconds after a device was plugged into a cradle. Indeed, vdcomm detected plug-event when I had started triggerconnection right after a PPC was plugged into a cradle. This time it made clear that one problem hid another one. At once, vdccm was able to detect a plugged PDA, but it was unable to hold connection more than a several seconds. And none of synce utils worked while it was connected these seconds. Again I googled. Somewhere someone wrote that vdccm doesn't work when device is protected by password. "@!#%@#%*#$!!!" cried me. I didn't wish to have device unprotected or to unlock it each time I plug it into my cradle. I made this patch for vdccm, when I had done reverse engineering of ActiveSync authorization protocol and synce sources had been explored enough for it. And ourtime time had came, patched vdccm worked great! Wheee! So, what I have done at last:
1. Installed usb-rndis-lite.
2. Installed libs: librapi2, libsynce.
3. Patched vdccm.
4. Installed ifplugd. It runs ifup/ifdown for rndis0 as needed.
5. Appended to /etc/network/interfaces:
iface rndis0 inet static
post-up /usr/local/bin/triggerconnection-delayed local-pda

6. Added line ' local-pda' into /etc/hosts.
7. Wrote /usr/local/bin/triggerconnection-delayed:

sleep 2
exec /usr/local/bin/triggerconnection $@

8. Following lineds added to ~/.xsession:
vdccm -d 3 -f -t -p `cat ~/.pda-pwd` 1>>~/logs/vdccm 2>>~/logs/vdccm &

9. Wrote my secret password into ~/.pda-pwd file (chmod 0600).

Now I could enjoy with all useful utils like pls, pstatus..., install cabs and etc.

It is all. Please, leave a comment if it was useful for you, or you have something to say about. Fell free to leave any kind of comment.

P.S. The patch I made is not fully featured. I wrote it in a very straightforward way. It does not support pending of password, so you must specify your password with the -p key-option. I really have no time to implement it well, sorry.

No comments:

Post a Comment