Finchsync via USB using synce under Linux - Windows Mobile Development and Hacking General

I finally managed to use FinchSync via USB on my Linux box (running Fedora 9, but with minor changes, it should work on all other systems as well). I have a HTC Herald, but it should work for all devices supported by synce. All information to do this is in the synce-wiki, and a lot of help was provided by Marc Ellis on the synce mailing-list.
USE THIS AT YOUR OWN RISK! BACKUP YOUR DEVICE! http://www.dotfred.net/default.htm
First, install synce as described in the synce wiki (which has instructions for several distros, including Debian, Ubuntu, Gentoo, Fedora, Mandriva, FreeBSD...) http://www.synce.org/moin/SynceInstallation
For Fedora, this means (must be done as root!):
Code:
yum install odccm
service odccm start
chkconfig --level 35 odccm on
yum install synce-sync-engine synce-gnome synce-kde synce-software-manager synce-trayicon librapi
yum install dkms
rpm -Uhv http://fedora.lowlatency.de/review/synce-dkms/synce-usb-rndis-lite-dkms-0.11-1.fc9.noarch.rpm
yum install synce-sync-engine
echo "blacklist ipaq" >> /etc/modprobe.d/blacklist
iptables -F
iptables -X
iptables -Z
Now, plug in the device, and as the normal user:
Code:
sync-engine &
create_partnership.py "Some Name" "Files"
IT WON'T WORK UNLESS YOU CREATE A PARTNERSHIP, even though we don't use this partnership for syncing. BEWARE: WINDOWS Mobile deletes all items associated with the partnership when you delete the parnership.
Now, DTPT shoulde be working, and you can reach the PC from the PPC as 169.254.2.2
The iptables commands above disable the Firewall completely. You may want do use a more sophisticated approach here.

Related

Mounting the Xoom in Linux (as well as adb)

The xoom can mount just fine on Linux but it is an MTP not a Mass Storage device.
Disclaimer: I am not responsible for any damage to your device, computer, relationship, etc.... The following is meant as a guideline and worked for me but as always use your head.
I did this on my Kubuntu Maverick laptop, but it should apply to most *buntus plus debian. Other flavors should be similar, post a request and I will help if I can. I am familiar with Suse and RHEL/Centos as well but beyond those it will be guess work.
The first thing I would recommend doing is making the device read/write to normal users.
Code:
sudo touch /etc/udev/rules.d/51-android.rules
echo "SUBSYSTEM==\"usb\", SYSFS{idVendor}==\"22b8\", MODE=\"0666\"" |sudo tee -a /etc/udev/rules.d/51-android.rules
sudo /etc/init.d/udev restart
NOTE: This also "fixes" adb so it is useable with the xoom as a normal user. If that is all you want you can stop here.
NOTE 2: You could also set an OWNER rather than changing MODE but I chose the most common route for this example/
Now install either mtp-tools or mtpfs for mounting using FUSE. Since I went the fuse route that is what I will conver here. (I installed the mtp-tools package but beyond using it to debug getting mtpfs to work I have never used it before.)
Assuming you already have fuse configured, for (k|x)ubuntu or debian :
Code:
sudo apt-get install mtpfs
If you do not have fuse already configured then do that first. Look it up online if you have any questions. If you get stuck I will try and help but this post is not about how to configure FUSE.
After that it is simple. Plugin your xoom and from the command line type:
Code:
mtpfs mountpoint
and to dismount it
Code:
fusermount -u mountpoint
so in my case I mount it in a subdirectory under home called xoom
Code:
mtpfs /home/janetpanic/xoom
fusermount -u /home/janetpanic/xoom
I have confirmed moving files to and from the actual directories but not from the meta "playlists" directory. I hope that helps...
EDIT: Fixed Typo... had "(idVendor)" instead of the correct "{idVendor}"
Thanks for sharing your workaround. Unfortunately, it's no joy here. After following the procedure described, the terminal returned no error, but on trying to open the Xoom directory via Nautilus, I received the following message:
Code:
Error: Error stating file '/home/sog/Xoom': Transport endpoint is not connected
Please select another viewer and try again.
Unmounting proceeds without error.
Distribution: Ubuntu Lucid x64
Did you connect your xoom before or after you mounted? The most likely problem is the undeveloped configuration .
Change the line in 51-android.rules to
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", SYMLINK+="libmtp-%k", MODE="0666"
[\code]
Restart udev and then do a "ls -lah /dev/libmtp*" with the device attached and list the output. I need to figure out if the problem is the udev rule or elsewhere.
If the ls does not show any files then send the result of "lsusb |grep Motorola" which better list a line or there is something weird going on.
Sent from my Xoom using XDA App
Updated 51-android.rules as directed, then:
[email protected]:~$ ls -lah /dev/libmtp*
lrwxrwxrwx 1 root root 15 2011-02-27 19:59 /dev/libmtp-1-4 -> bus/usb/001/004
[email protected]:~$ lsusb | grep Motorola
Bus 001 Device 004: ID 22b8:70a8 Motorola PCS
Wait, you aren't able to get the Xoom to mount as a mass storage device?
ed. The leaked Xoom manual suggests it support mass storage. Phew. You were scaring me there a bit.
as far as I know, it's been confirmed that the current stack does not support mass storage, only mtp.
sogrady said:
as far as I know, it's been confirmed that the current stack does not support mass storage, only mtp.
Click to expand...
Click to collapse
Which stack, Linux or Honeycomb's? Where is it confirmed?
Non-working mass storage is a potential deal breaker.
honeycomb's. see here or here for details.
Thanks for the links.
This is a real WTF.
Can someone try running this attached apk to see if it enables mass storage? (It just runs enable, it won't run disable, so I don't know what will happen, it might cause apps to crash but rebooting should fix it, standard disclaimers apply, you run this at your own risk, etc., etc., etc.)
I don't have a Xoom, otherwise I'd try this myself.
Relevant code snippet for those interested:
Code:
StorageManager s = (StorageManager)getSystemService(Context.STORAGE_SERVICE);
Class c = s.getClass();
Method m = null;
try
{
m = c.getMethod("enableUsbMassStorage", (Class[]) null);
m.invoke(s);
}
catch(Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
There may even be an easier way to achieve this -- I can't verify for myself because Honeycomb isn't in AOSP -- it doesn't work in the sim, but it might on a device: run adb shell, then run "am start -n com.android.systemui/.usb.UsbStorageActivity".
ydaraishy said:
Can someone try running this attached apk to see if it enables mass storage? (It just runs enable, it won't run disable, so I don't know what will happen, it might cause apps to crash but rebooting should fix it, standard disclaimers apply, you run this at your own risk, etc., etc., etc.)
I don't have a Xoom, otherwise I'd try this myself.
There may even be an easier way to achieve this -- I can't verify for myself because Honeycomb isn't in AOSP -- it doesn't work in the sim, but it might on a device: run adb shell, then run "am start -n com.android.systemui/.usb.UsbStorageActivity".
Click to expand...
Click to collapse
I ran the activity manager command and it brought up the usb mass storage screen but did not mount on computer. Also ran the apk but did not mount. Awesome job though. keep fighting the good fight
sogrady said:
Updated 51-android.rules as directed, then:
[email protected]:~$ ls -lah /dev/libmtp*
lrwxrwxrwx 1 root root 15 2011-02-27 19:59 /dev/libmtp-1-4 -> bus/usb/001/004
[email protected]:~$ lsusb | grep Motorola
Bus 001 Device 004: ID 22b8:70a8 Motorola PCS
Click to expand...
Click to collapse
Well that is interesting . You have read write privileges on the xoom. Sounds like it is a fuse configuration issue. Do you have any other fuse file systems you run?
Sent from my Xoom using XDA App
bigrushdog said:
I ran the activity manager command and it brought up the usb mass storage screen but did not mount on computer. Also ran the apk but did not mount. Awesome job though. keep fighting the good fight
Click to expand...
Click to collapse
Damn it. Looks like I actually need a device to get it working, and the AOSP drop. It's so moronic why they disabled mass storage.
Hmm. Can someone run, from adb shell, the output from "mount", and "ls /sys/devices/platform" for me?
Never mind. Mass storage has been defined out of the stingray (Xoom) kernel. It's not even in the default kernel.
To get mass storage support, be prepared to build your own kernel and reflash the device (once that's done, the am command above or the enabler app will work properly).
I've founded a working(ish) solution. This Xoom forum post details an approach that permits transfer of video/music/etc to the Xoom via Linux.
Couple of caveats:
1. The gnomad2 application is very unstable. Crashes frequently.
2. It appears to be write-only: I have not been able to delete files from the Xoom using this interface.
Thanks for the instructions to connect to a xoom tablet via Linux! However, I'm using Opensuse 11.3 and 11.4 on two different systems. I did install the mtp-tools with no issues, however, there is NO file by the name of mtpfs. A search on the net does not reveal it either. Where do I get this, or what package is it part of? Thanks again. If I can't get this tablet to connect to my linux box, I will have to take it back, since I do NOT use winbloze or Mac. Pretty short sited of Motorola IMHO.
Personally, I've given up on MTP + Linux Combo. I just use a straigt FTP transfer over wifi ( FTP Server on tablet ). It's about the same speeds.
any headway on this...
i am getting the: Transport endpoint is not connected error still and i have no real experience with FUSE so im stuck to using windows for any transferring.
stlsaint said:
i am getting the: Transport endpoint is not connected error still and i have no real experience with FUSE so im stuck to using windows for any transferring.
Click to expand...
Click to collapse
try following the directions in this thread:
http://forum.xda-developers.com/showthread.php?t=981774
They are basically a superset of what I posted. If you still have trouble after that post in either thread (this one or that one) and I will try and help as best I can.
followed the thread up unto the fstab part as i dont wan to edit my fstab without confirmation that it will work. But i get the exact same error with the endpoint text. I am trying this on Crunchbang linux which is based off debain the same way ubuntu is. I am probably going wrong with FUSE somehow but i have never messed with it so i dont know how to troubleshoot it.

MotoUSB reverse tether w/ linux success

I have successfully used reverse USB tethering on a flipout. This method should be portable to other devices running the motorola android multi-device driver with usb0.
If you are comparing to any windows drivers, say that installed from the driver installer MSI when connecting a flipout and maybe other devices in 'portal' mode, the (windows) driver will be motousbnet. On linux, the driver is cdc_subset. However, this driver does not know how to bind to the motorola
1. Figure out the usb vendor id, product id, and interface class, interface subclass, and interface protocol of the networking interface. On the flipout, this is named the 'motorola networking interface'. On my device, it has these ids: 0x22b8, 0x41da, 0x02, 0x0a, 0x01. You can find these ids via exploring /sys/bus/usb on a linux system, or with the lsusb utility.
2. patch your cdc_subset driver to support the USB id and interface of the above device. You will need to inspect via lsusb or sysfs to setup a 'product' and 'driver info' structure in cdc_subset.c to select the correct interface and endpoints. The pertinent parts of my cdc_subset.c are as follows:
Code:
add to products
{
// Moto flipout usb
USB_DEVICE_AND_INTERFACE_INFO (0x22b8, 0x41da, 0x02, 0x0a, 0x01),
.driver_info = (unsigned long) &motousb_info,
},
add near other driver_infos:
static const struct driver_info motousb_info = {
.description = "Motorola USB endpoint",
.check_connect = always_connected,
.in=0x84, .out=0x03,
};
3. Doing such a mod and compiling yourself a new cdc_subset.ko, and installing that, will yield a usb driver that can talk to usb0 on your flipout. At this point, you just have to configure networking. I setup proxyarp on my LAN and usb0 interfaces, and set up some manual addresses and routes. Other options could be to add usb0 to a bridge, or do routing and DHCP, or routing + nat + DHCP. You'll probably need to netcfg rmnet0 down and setprop net.dns1 and net.rmnet0.dns1 your ips manually. Make sure you save your old dns. I'm not sure if that gets restored from carrier when you turn rmnet back on.
4. after all that, you should be online.
5. EDIT: all compiling and module installation steps noted above happen on the host PC, if that wasn't clear.
Work to follow:
use SL4A to automate usb0 bringup
interface with APNDroid to soft-down the 3g instead of nuking it the hard way. killing the radio process will get you back online, but thats effectively the same as resetting the baseband, so you'll need to re-unlock your SIM etc.
Thanks man! This is awesome. It worked on my Motorola Defy (same parameters) under Ubunutu.
Hi,
I thing this is what i am looking for, enable a motorola device (defy) to be a usb0 device with ubuntu so you can have an IP, and ssh easly with your droid (using vlc remote with usb cable). I realy appreciate this native feature with my old htc.
where is the cdc_subset.c ?
tkx
balek said:
Hi,
I thing this is what i am looking for, enable a motorola device (defy) to be a usb0 device with ubuntu so you can have an IP, and ssh easly with your droid (using vlc remote with usb cable). I realy appreciate this native feature with my old htc.
where is the cdc_subset.c ?
tkx
Click to expand...
Click to collapse
It's in the kernel source. -- You'll have to download the linux or kernel source package that matches the kernel you run on your ubuntu machine, modify your cdc_subset driver, rebuild it, and install it.
Learning things like the kernel build system and how to install a kernel module are exercises for the reader.
Good job! I'll try it once i get my Ubuntu installation up and running again ^_^
Defy and Debian USB network works partially...
Hello. The idea was good...
My config is:
- on one side: a Defy (CM7 1.0-RC1 Nightly build 2037, Gingerbread 2.3.4)
- on the other side: a Linux Debian (Squeeze , kernel 3.0.0-1-686-pae)
I patched the cdc_subset driver as proposed. I saw a little difference on the endpoints: lsusb -v reports 0x83 for 'in' endpoint and 0x2 (bulk) or 0x3 (interrupt) for 'out' endpoint. I tried all combinations and only 0x83/0x2 give a working ping between hosts. => Are the initial endpoints working (0x84/0x3) ?
See attached file for the complete listing, search 'SDX' to see where I patched.
When I plug the USB cable, the usb0 interface is brought up on linux automatically and that's perfect.
With a simple network configuration, ping works on both hosts.
.
So everything seems right.
I then tried to transfer a huge 100MB file to see the performance:
- scp from linux to defy => OK, ~5MB/s
- scp from defy to linux => FAILURE after a few MB transfered
In the second test, the connection is completely frozen and I see errors on both interfaces (ifconfig usb0, error packets). I repeated the test multiple times with alternate network configs, without wifi etc., and I could never transfer the file completely.
Can someone confirm me:
- that the transfer is working for him in both ways with huge files
- what is reported by "lsusb -v -d 22b8:41da" to see if my endpoints for a Defy are correct
I'm not sure, but maybe cdc_subset is not the right driver to patch ?
Or simply it's a bug in scp or sshd on Defy ! I should try with something else like ftp or http...
I keep working on this topic...Thx for any clue !
sdxmob said:
Hello. The idea was good...
My config is:
- on one side: a Defy (CM7 1.0-RC1 Nightly build 2037, Gingerbread 2.3.4)
- on the other side: a Linux Debian (Squeeze , kernel 3.0.0-1-686-pae)
I patched the cdc_subset driver as proposed. I saw a little difference on the endpoints: lsusb -v reports 0x83 for 'in' endpoint and 0x2 (bulk) or 0x3 (interrupt) for 'out' endpoint. I tried all combinations and only 0x83/0x2 give a working ping between hosts. => Are the initial endpoints working (0x84/0x3) ?
See attached file for the complete listing, search 'SDX' to see where I patched.
When I plug the USB cable, the usb0 interface is brought up on linux automatically and that's perfect.
With a simple network configuration, ping works on both hosts.
.
So everything seems right.
I then tried to transfer a huge 100MB file to see the performance:
- scp from linux to defy => OK, ~5MB/s
- scp from defy to linux => FAILURE after a few MB transfered
In the second test, the connection is completely frozen and I see errors on both interfaces (ifconfig usb0, error packets). I repeated the test multiple times with alternate network configs, without wifi etc., and I could never transfer the file completely.
Can someone confirm me:
- that the transfer is working for him in both ways with huge files
- what is reported by "lsusb -v -d 22b8:41da" to see if my endpoints for a Defy are correct
I'm not sure, but maybe cdc_subset is not the right driver to patch ?
Or simply it's a bug in scp or sshd on Defy ! I should try with something else like ftp or http...
I keep working on this topic...Thx for any clue !
Click to expand...
Click to collapse
Any news with defy ?

[Q] How to Access the device using Ubuntu?

Does anyone now how I can access the internal storage of my transformer through Ubuntu? I have the transformer connected via USB but it does not auto-mount or appear to be recognised as a storage disk
thanks for any help
I'm using SSHDroid and usb tethering when tablet is connected, find out the tablet ip, then you can use the ubuntu built-in "Connect To Server" via ssh.
readonlycn said:
I'm using SSHDroid and usb tethering when tablet is connected, find out the tablet ip, then you can use the ubuntu built-in "Connect To Server" via ssh.
Click to expand...
Click to collapse
Would you be able to explain the method you use a bit more thoroughly? I too am having frustrating problems getting my transformer mounted under Linux, and am sick of transferring everything via SD card
I tried over SSH, but Android automatically refuses connection. And why do we need to have it tethered via usb to SSH?
The transformer acts as an MTP device. I had some issues with it appearing properly in Ubuntu 10.04, but I believe is because I did something wrong. I have it all working now and mounted as /media/transformer - but I am also running 11.04 now.
This has been asked on the forum before and this answer assisted me in solving it[Full thread].
You also have some links in a different thread here.
poltak11 said:
I tried over SSH, but Android automatically refuses connection. And why do we need to have it tethered via usb to SSH?
Click to expand...
Click to collapse
What's your SSHD application? I recommend sshdroid, you search it in the market.
You needn't tethering if pc and android are in one lan (connected to same wifi for example). Getting android ip is the only purpose of tethering, you can run 'route' command in ubuntu to find out the gateway of usb0, which is the ip of android.
I use a combination of swiftp and droidsshd to access device from ubuntu. Works well. You might need to get the programs from code.google.com, as they are not in the market.
People... they aren't looking for an SSH application, they are looking to MOUNT THE DEVICE OVER USB.
You need to install either libmtp or mtpfs. On Arch Linux, libmtp is in the repos, while mtpfs is in AUR. I use mtpfs.
After getting mtpfs, all you need to do is: sudo mkdir /media/tf && mtpfs -o allow_other /media/tf.
I do it with ADB. adb push and and pull does the job easily, unless you've a ton of different files you want to place in different places.
Using gnomad2 from repo @ Fedora 15 Gnome3
since there is no flashy mtpfs for my distro :/
(to lazy to compile)

cm7 /system/xbin & #dropbear -D

This thread is informative with a question at the end.
Just to let you know there's plenty of useful binaries in the CM7 distro you can pull from system/xbin
including:
Code:
add-property-tag bash check-lost+found dbus-send hciconfig irssi lmptest opcontrol procmem rsync showmap su
agent bdaddr cpueater dexdump hcidump l2ping nano openvpn procrank scotest showslab tcpdump
attest btool crasher directiotest hcitool l2test nc openvpn-up.sh rawbu scp sqlite3 timeinfo
avinfo bttest daemonize dropbear hstest latencytop netperf oprofiled rctest sdptest ssh vfp-crasher
avtest busybox dbus-monitor dropbearkey htop librank netserver powertop rfcomm sftp-server strace vim
Unfortunately it seems dropbear doesn't include X11 or -D dynamic socks port forwarding(-D option), it's just not in the source ( http://talk.maemo.org/showthread.php?t=2991&page=2 ). And I haven't managed to get any other ssh client to work. Have you had any other luck with any ssh clients? I've tried:
- BTEP ssh (can't connect to update server)
- sshTunnel (gets confused with a password prompt that isn't standard for one time passwords)
The idea is to get OperaMobile to connect to 127.0.0.1:8080 via Opera:config. (OperaMini doesn't support this), then you have a secure connection when on openwifi.
Hi, I'm using SSH Tunnel, but with a local port, when I'm in the university, I only use it to connect to irc (localhost:1234)
Don't know about dynamic ports, hope you can solve it

Indicator to manage ADB Wifi connections

I developed a little tool which can be used to connect and disconnect adb sessions to Android devices via wifi.
Maby some of you will find it handy
The tool is targeted at Ubuntu 12.04 or above but it should run on other distributions too.
The following libraries will be needed to run this program:
Code:
libgtkmm-3.0-dev
libglibmm-2.4-dev
libsigc++-2.0-dev
libappindicator3-dev
libsqlite3-dev
libnotify-dev
The code is available here
The License is GPL3.
32-Bit version and debian packages will follow soon.

Categories

Resources