s5vi's Motorola p2k phone page
February 09, 2012, 08:31:02 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Over 30000 member ! Under heavy spammer attack ! Cleaning in progress !
V-6.0.0 with CDMA support is available now.
To become VIP: you can do it via PayPal: http://www.el-co.hu/p2k05/paypal.html
 
   Home   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: First lines of code  (Read 4959 times)
0 Members and 1 Guest are viewing this topic.
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« on: June 13, 2007, 08:20:06 pm »

This is my first attempt with C and libusb, pls do not laugh.
Any help, cooperation and suggestion is appreciated.
I can compile the code under winxp and mandriva linux

My toughts:
Moto4lin uses Vid and pid to identify phone in p2kmode. With new phones these number may vary.
I plan to identify phones in p2kmode, to read tci if name . (as i do it in win32 with P2kCommander)
I plan to use code snippets from Moto4lin, and of course i plan to implement p2k05

This will be a command line core app, with named pipes. Man can write a gui app and communicate thru named pipes.
For now the code is quite useless, only a proof of concept.

Code here:
http://s5vi.vxxxstuff.com/linux/usb1.zip
unzip, run makeusb1, and "usb1 -l" (with -l argument (list devices))
this will enumerate usb devices , interface numbers and interface names
TCI if num and the name is important for us.
you can see interfaces in AT and p2kmode (i use moto4lin to switch p2kmode)
Good luck.....
« Last Edit: June 14, 2007, 07:14:15 am by s5vi » Logged

s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #1 on: June 26, 2007, 02:49:27 pm »

http://www.el-co.hu/dl/p2k-core.zip

Nothing useful yet, only device detection and switching to p2kmode

I detect device by its name not by VID/PID as moto4lin
PID may change with new phones, but if name remain the same (i hope)
On P2kc (win32) i also detect dev by name and has a lot of various phone confirmed to work

I send AT+mode=8 command directly to the usb dev. Not to the acm /modem.
This is also was a hurt on varios system (incl win32, example COM14)
usb bulk device is the same on all systems

I hope my method work on all system with all phones......

here is the screen:

[s5vi@localhost p2k-core]$ make clean
rm p2k-core.o
rm p2k-core
[s5vi@localhost p2k-core]$ make
make p2k-core
make[1]: Entering directory `/home/s5vi/projects/p2k-core'
gcc -g -c p2k-core.c
gcc -g -o p2k-core p2k-core.c -I/usr/include -L -lm -lc -L/usr/lib -lusb
make[1]: Leaving directory `/home/s5vi/projects/p2k-core'
[s5vi@localhost p2k-core]$ ./p2k-core
error: Motorola AT device not found!
[s5vi@localhost p2k-core]$ ./p2k-core
Found Interface: Motorola Data Interface
Interface 00 is claimed by kernel driver: cdc_acm
Interface 00 is detached from kernel driver: cdc_acm
Endpoints: 82 01
Switching to P2kmode (cca. 2-3 sec)
Received echo: AT+MODE=8

Found Interface: Motorola Test Command
Inteface number: 08, Endpoints: 00 00
This is P2k phone.
[s5vi@localhost p2k-core]$   



pls try it on your linux/mac box with your phone (p2k and p2k05) and report.....
Logged

s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #2 on: July 05, 2007, 07:30:53 am »

Now code has some useful function:  http://www.el-co.hu/dl/p2k-core.zip
It recognizes p2k phone (i hope p2k05 also)
and with "info" command read phone model,volume names,freespaces and file numbers.
I cannnot test it with p2k05 phone, pls do and report.
Also has trouble running on mac osx.

http://www.el-co.hu/dl/p2k-core.swf
« Last Edit: July 05, 2007, 07:33:43 am by s5vi » Logged

rasputin007
VIP
Jr. Member
*****
Offline Offline

Posts: 56


rasputin007@hotmail.co.uk
WWW Email
« Reply #3 on: July 25, 2007, 10:52:38 pm »

After failing to get p2k-core working on OpenSuSE 10.2-64 and Fedora Core 7, I finally have it working on Mandriva 2007. It works fine with V3x (P2K mobile), but not luck with Maxx (P2K05 mobile).

Logged

Nothing is impossible, only miracles take a bit longer!
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #4 on: July 30, 2007, 08:39:30 am »

i've found an interesting bug
some phones and OS es list endpoints in reversed order!
So your test with P2k05 phone fails due to bad endpoint order, and app try to write into read pipe's endpoint!
very strange if my and your p2k phone list endpoints good order.
anyway i will check endpoints, and next release will come........
Logged

rasputin007
VIP
Jr. Member
*****
Offline Offline

Posts: 56


rasputin007@hotmail.co.uk
WWW Email
« Reply #5 on: August 02, 2007, 12:25:32 am »

some phones and OS es list endpoints in reversed order!

I have heard that one before from Meiner Einer and Psycomorpher (both faq4mobiles.de). But that was more with the storage of the memory addresses in the codegroups, also some PC operating systems do the same.
I do not understand much about that (my programming stopped with batch file editing in DOS 3.3  Cry), but Meiner Einer certainly knows about that.
Logged

Nothing is impossible, only miracles take a bit longer!
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #6 on: August 02, 2007, 07:24:12 am »

Ya, i released fixed ersion here:
http://www.el-co.hu/smf/index.php?topic=203.msg1015;topicseen#msg1015

To decide which endpoint is in and out is easy:
below 0x80 are for output data, and above or equal 0x80 are for input data.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!

Bad Behavior has blocked 112 access attempts in the last 7 days.



Google visited last this page January 17, 2012, 01:31:11 pm