LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Bitpim + Samsung SCH-U340 (Alltel Snap) (https://www.linuxquestions.org/questions/linux-hardware-18/bitpim-samsung-sch-u340-alltel-snap-638733/)

oot 04-29-2008 03:45 PM

Bitpim + Samsung SCH-U340 (Alltel Snap)
 
This is a write-up of my experiences getting the Alltel Snap (eg. a Samsung SCH-U340 mobile phone) to work with Bitpim under Slackware Linux 12.0.

I am not asking a question, the problems have already been solved, I'm just writing this up to help other people who might be searching for help with Bitpim.

The cable I am using is not an "official" one from Alltel or Samsung, it's just one I bought on eBay that was listed as being compatible with the phone.

NOTE: YOU DO NOT NEED TO FOLLOW THESE STEPS. These are the steps I actually went through, and are included to help people who've gotten partway through the process and run into trouble. If you're just looking for a step-by-step guide, see my reply to this post with a summary of the steps you need to take (there's only 5).

Step 1: Plugged the phone in to the computer. The phone started charging. Good, this means the cable is working.

Step 2: Had a look around and see what's happened in response to plugging the phone in.
Quote:

$ dmesg
usb 3-2: new full speed USB device using ohci_hcd and address 9
usb 3-2: configuration #1 chosen from 1 choice
drivers/usb/serial/usb-serial.c: USB Serial support registered for Handspring Visor / Palm OS
drivers/usb/serial/usb-serial.c: USB Serial support registered for Sony Clie 3.5
drivers/usb/serial/usb-serial.c: USB Serial support registered for Sony Clie 5.0
usb 3-2: palm_os_4_probe - error -32 getting connection info
visor 3-2:1.0: Handspring Visor / Palm OS converter detected
usb 3-2: Handspring Visor / Palm OS converter now attached to ttyUSB0
usb 3-2: Handspring Visor / Palm OS converter now attached to ttyUSB1
usb 3-2: palm_os_4_probe - error -32 getting connection info
visor 3-2:1.1: Handspring Visor / Palm OS converter detected
usb 3-2: Handspring Visor / Palm OS converter now attached to ttyUSB2
usb 3-2: Handspring Visor / Palm OS converter now attached to ttyUSB3
usbcore: registered new interface driver visor
drivers/usb/serial/visor.c: USB HandSpring Visor / Palm OS driver
usbcore: registered new interface driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
In addition, the list I get by typing "lsmod" shows that modules named "cdc-acm" and "visor" have been loaded.

It's mistaking my phone for a PDA. This will cause problems later (see step #8)

Step 3: I downloaded and installed BitPim. I use Slackware, and there was no Slackware package, so I decided to try the rpm.
Quote:

rpm -ivh --nodeps bitpim-1.0.5-0.i386.rpm
Installed fine.

Step 4: Ran BitPim. It attempted to auto-detect phone. I got the message "No phone detected/recognized. Run Settings?". I clicked "yes" to get to the settings page (the same one as under Edit->Settings).

Not a problem that the phone doesn't auto-detect. As of the time of writing this post, the SCH-U340 is not officially supported by BitPim (but you can still do stuff with it)

Step 5: Under settings, changed the phone type to "Other CDMA phone".

Step 6: Let's see if it works now... clicking "Get Data From Phone" will just show you a box with all the options greyed out, because the SCH-U340 is not supported by BitPim. Instead, you'll need to access the filesystem of the phone directly. To do this, choose "View Filesystem" under the "View" menu, then click "Filesystem" on the left where it appears.

Step 7: Attempting to browse the filesystem... it fails.

You will get an error message that looks like one of the following:
"Failed to auto-detect the port to use. I couldn't detect any candidate ports."
OR
a large window with a traceback will come up, and the relevant line is
"USBException: could not claim interface 1: Operation not permitted"
OR
"/dev/ttyUSB2: Could not open port: [Errno 13] Permission denied '/dev/ttyUSB2'"

In this case, all three of these errors result from the same problem: the wrong module was automatically loaded when I plugged the phone in. (If you are getting the third error with a different model of phone, it might be a permissions problem too, but in this case it wasn't).

Step 8: What went wrong?
Look back at Step 2 -- when I plugged the phone in, it was automatically detected as a Visor. This is incorrect.
To fix this, you need to run (as root):
Quote:

rmmod visor
rmmod cdc-acm
modprobe cdc-acm
This will unload the "visor" module, and unload and reload the "cdc-acm" module (the unload and reload is necessary because the visor module interfered with the cdc-acm module creating /dev/ttyACM0).

Step 9: Go back to BitPim. Under Edit->Settings->Comm Port find /dev/ttyACM0. NOTE: if /dev/ttyACM0 is listed under "inoperable ports", you need to log in as root and do "chmod 666 /dev/ttyACM0", then click "Refresh" in the "Choose a comm port" dialog box, and /dev/ttyACM0 should move to "Available ports". Choose /dev/ttyACM0.

Step 10: Attempt to browse the phone's filesystem. If you haven't already, choose "View Filesystem" under the "View" menu, then click "Filesystem" on the left where it appears. It should now work.

oot 04-29-2008 03:53 PM

OK, and here's a summary of the steps to just get it working, instead of the trial-and-error process used above:

1. Install BitPim. On Slackware, this can be done with:
Quote:

rpm -ivh --nodeps bitpim-1.0.5-0.i386.rpm
2. Plug in the phone. The wrong modules will load automatically. To correct this, run (as root):
Quote:

rmmod visor
rmmod cdc-acm
modprobe cdc-acm
3. Correct the permissions on /dev/ttyACM0. Run (as root):
Quote:

chmod 666 /dev/ttyACM0
4. Start BitPim. Skip attempting to auto-detect the phone, it isn't supported. Go to Edit->Settings. Set the phone type to "Other CDMA Phone" and the comm port to "/dev/ttyACM0".

5. Don't attempt to use the "Get Phone Data" and "Send Phone Data" features, they aren't supported for this model of phone. Instead, browse the phone's file system directly. To do this, enable filesystem view by going to "View" and making sure "View Filesystem" is checked, then find "Filesystem" in the left pane and click on it. A new pane will appear with a folder named "/", click the arrow next to "/" and wait for your phone's filesystem to load.

You will need to do steps 2, 3, and 5 every time you plug the phone in.

oot 04-29-2008 04:33 PM

Additional notes:

Ringtones are under /brew/ringer. (Do not put them in the nodrm subfolder). To upload one, navigate to this folder, right click, choose "New...", then choose the file you want to send to the phone. You will need to turn the phone off and back on before the ringtone will show up under the phone's menus. If the ringtone won't play, make sure the mp3 you are uploading is less than 100K and only has one channel. To turn a two channel mp3 into a one channel mp3, do "lame -m m originalfile.mp3 newfile.mp3".

I haven't figured out what's up with the images yet. There is a folder called /cam_data that contains files named photo001 photo002 etc., but they aren't in any format that the Gimp recognizes.

Note to Windows users who Google across this while trying to get your SCH-U340 or Alltel Snap to work with your computer: BitPim is available free for Windows too. You will need a Windows driver for your phone/cable (this should come on a disc with the cable when you buy it). I'm sorry I can't write you a detailed guide on how to use it, since I don't have Windows, but I can tell you that you'll need to set your phone type to "Other CDMA Phone" and you'll have to browse the filesystem (as described in step 5 of my second post) just like a Linux user would.

Uhm... that's all I can come up with for now. Hopefully this will save somebody else the trouble of having to figure all this out.

phisrow 08-12-2008 06:11 PM

Thanks
 
Thanks for writing that up. I was having some trouble with my SCH-U340 until I ran into your writeup, working fine now. I've confirmed that bitpim works in the same manner on a windows box, as well.

In my case, running the (awful) verizon firmware, pictures show up as ordinary .jpg files in /mm/pg/Default Album

Preloaded pictures, ringtones, and whatnot don't seem to appear anywhere. Not a huge problem; but I was hoping to delete some of the preloads.

Coppersmithe 09-30-2008 09:50 AM

Doing it in Windows
 
Quote:

Originally Posted by phisrow (Post 3245286)
Thanks for writing that up. I was having some trouble with my SCH-U340 until I ran into your writeup, working fine now. I've confirmed that bitpim works in the same manner on a windows box, as well.

In my case, running the (awful) verizon firmware, pictures show up as ordinary .jpg files in /mm/pg/Default Album

Preloaded pictures, ringtones, and whatnot don't seem to appear anywhere. Not a huge problem; but I was hoping to delete some of the preloads.

would you be willing to help me through the process in Windows? I'm not a total dummy on the computer, but this is slightly past my skill level. I feel like I've almost got it, and once I start a project like this I go crazy until I can figure it out.
Erin
coppersmithe@kohler.k12.wi.us

LP_NYC 06-03-2014 03:06 PM

OOT:

<<choose "View Filesystem" under the "View" menu, then click "Filesystem" on the left where it appears. >>

With this, I was able to retrieve irreplaceable photos from a friend's phone. They are very grateful.

Thank you very much.

Altatown123 01-25-2015 06:22 PM

Quote:

Originally Posted by oot (Post 3137061)

Note to Windows users who Google across this while trying to get your SCH-U340 or Alltel Snap to work with your computer: BitPim is available free for Windows too. You will need a Windows driver for your phone/cable (this should come on a disc with the cable when you buy it). I'm sorry I can't write you a detailed guide on how to use it, since I don't have Windows, but I can tell you that you'll need to set your phone type to "Other CDMA Phone" and you'll have to browse the filesystem (as described in step 5 of my second post) just like a Linux user would.

Thanks oot. I did come across this Googling how to get pics off of an old SCH-U340 (and SCH-U350) onto a Windows Vista PC and the tips helped steer me to success, so I thought I'd post what I did if it might help others.

This is not really "how to do it"; I don't have enough know-how to be sure what parts were essential related to the driver, this is just what I did.

One thing I have gotten from searches on this topic is that you need drivers and they aren't easily found. I had bought a used DataPilot Samsung kit with cables (U340 and U350 use different cables) and software. The disc wouldn't load and their website looks semi-abandoned, plus almost all reviews of that software I found looked bad. I would pay for software that works, but didn't want to pay first and then find out it wouldn't work.

I then tried BitPim. I couldn't get it to recognize the phones using the setting "Other CDMA" and "auto" for port. Tried some other combinations with no luck. Then I looked around and found a program named MobilEdit. It allows you to load it with partial functionality as a trial. Although my phones weren't listed, it loads a set of Samsung drivers (you choose which phone brand driver sets to download) and I hoped something in there might work.

Using MobilEdit "Connection Wizard", it would recognize my phones, but would not then list them as connected devices. I contacted MobilEdit and they responded quickly, saying because those weren't supported phones, they would not show up as connected. Again, I would have just paid them if it worked on my phones, but no go.

This was the first program that had recognized the phones, though, so I wondered if a compatible driver was now loaded so another program would work. I went back to BitPim and tried the U340 again with "Other CDMA" and "auto" for port. Bingo, it recognized the phone and I could view the file tree, find the jpg pic files, and copy them.

I'll include the U350 outcome while I'm at it. I tried the U350 using "Other CDMA" and "auto" for port. I got a message that port could not be found. There was a tip in another forum about finding COM number using Bluetooth, but I had never used BT so the phone had never been linked to anything and so it seemed I couldn't go that route. I tried a few different COM numbers but no luck, didn't know how many numbers exist in that range (could be long trial and error). Then I tried the U340 again to see if BitPim said what the COM number was; it did, it was COM 10. I tried that for U350 but still no luck (can't remember if still got port error at this stage, maybe it just wouldn't show file tree). Finally I remembered seeing a tip in another forum about using SCH-U750 Alias 2 as a substitute for U350. This then worked in combination with COM10, and I could find & copy the pics.

So to sum up:
Just for browsing for jpg files, no other data retrieval attempted
U340 "other CDMA", "auto" (auto found COM10)
U350 "SCH-U750 Alias 2", "COM10"
And not really sure about drivers, I only speculate they were necessary and were loaded by MobilEdit

ChrisPiker 01-07-2018 11:27 PM

Quote:

Originally Posted by oot (Post 3137061)
Additional notes:

I haven't figured out what's up with the images yet. There is a folder called /cam_data that contains files named photo001 photo002 etc., but they aren't in any format that the Gimp recognizes.

Opening the resulting pictures in a hex editor reveals that (on the U.S. Cellular version anyway) the phone prepends about 112 bytes of it's own data to the front of each image, rendering it an invalid jpg. It's not hard to remove the extra data with a small script. The script I used is posted below. Here's the usage steps:

  • Copy the contents of the code section into a file named fix_sch_u340.py in the the same directory with your photoXXX.jpg files.
  • chmod +x fix_sch_u340.py
  • ./fix_sch_u340.py photo*.jpg
If all works you should end up with a set of files with the name pattern: YYYYMMDD_HHMMSS.jpg, the filename is created using meta-data within the original *.jpg files. Note if any of your file were generated less that 1-second apart you will need to change the script. (That's not likely with this old phone)

Quote:

Originally Posted by oot (Post 3137061)
Uhm... that's all I can come up with for now. Hopefully this will save somebody else the trouble of having to figure all this out.

It did help, very much. Thank you. I've been saving that old phone for 9 years thinking I'd get the pictures off of it someday. Due to your help, that day was today. :cool:

Code:


#!/usr/bin/env python2

import sys
import os.path
from os.path import join as pjoin

pout = sys.stdout.write

for sPath in sys.argv[1:]:
    fIn = file(sPath, 'rb')
    sData = fIn.read()
    fIn.close()
           
    iSeg = sData.find('\xff')
    if iSeg == -1:
        pout("Can't find start of first JPEG segment, %s not converted\n"% sPath)
        continue

    # Find the start of the first valid JPEG
    iCD = sData.find("cam_data")
    sNew = sPath.replace('.jpg','_fixed.jpg')
    if iCD == -1:
        pout("Can't find photo creation time, using simple out name\n"% sNew)
    else:
        sNew = "%s_%s.jpg"%(sData[iCD+9:iCD+9+8], sData[iCD+9+8:iCD+9+8+6])
   
    sDir = os.path.dirname(sPath)
    if len(sDir) > 0:
        sOutPath = pjoin(sDir, sNew)
    else:
        sOutPath = sNew
   
    pout("Converting %s -> %s\n"% (sPath, sOutPath))
    fOut = file(sOutPath, 'wb')
    fOut.write(sData[iSeg:])
    fOut.close()


Vampyrr 03-15-2019 01:37 AM

Quote:

Quote:
Originally Posted by oot View Post
Additional notes:

I haven't figured out what's up with the images yet. There is a folder called /cam_data that contains files named photo001 photo002 etc., but they aren't in any format that the Gimp recognizes.
Opening the resulting pictures in a hex editor reveals that (on the U.S. Cellular version anyway) the phone prepends about 112 bytes of it's own data to the front of each image, rendering it an invalid jpg. It's not hard to remove the extra data with a small script. The script I used is posted below. Here's the usage steps:

Copy the contents of the code section into a file named fix_sch_u340.py in the the same directory with your photoXXX.jpg files.
chmod +x fix_sch_u340.py
./fix_sch_u340.py photo*.jpg

If all works you should end up with a set of files with the name pattern: YYYYMMDD_HHMMSS.jpg, the filename is created using meta-data within the original *.jpg files. Note if any of your file were generated less that 1-second apart you will need to change the script. (That's not likely with this old phone)
I hate to bump old but on this particular subject not enough is out there. How would one do these steps on a Windows device to restore the photo files?


All times are GMT -5. The time now is 05:17 AM.