s5vi's Motorola p2k phone page
February 09, 2012, 08:41:06 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] 2   Go Down
  Print  
Author Topic: Connecting phones in Linux  (Read 9875 times)
0 Members and 1 Guest are viewing this topic.
duffydac
Newbie
*
Offline Offline

Posts: 6


« on: May 24, 2007, 12:02:59 am »

Hi all,

I'm a Linux user trying to connect my Rizr Z3.
The only program for my platform is moto4lin but unfortunately doesn't support p2k05 phones, so the only thing i can do is switching from at mode to p2k mode.
After that the usb connection with my phone get lost (i have a "broken pipe" error and the usb icon on the phone display disappears).

I wonder if you can share some documentation about the p2k05 protocol...
If so, i'll try to make moto4lin work also for p2k05 phones.
Here's my mailbox:

Thanks for any help!
DaC
Logged
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #1 on: May 24, 2007, 06:56:05 am »

Hi, DaC
I'm glad to hear that, I1m a linux fan also . My box is dual boot (xp, and mandriva2007.1)
I didnt try to compile Moto4lin yet.

At first RIRZ Z3 is NOT p2k05 phone.
Only its "test command" interface index != 8 as usual
Previous phones has Tci index ==8
Z3 and newer phones has tci index == various numbers
This index number can be retrieved from usb device list info

In moto4lin source you must search low level usb io
and introduce a variable tci_index, and use that instead of constant 8

It will be great if we can cooperate, because many linux (and osx users) ask me

P2k05 phones is other story
I dont know if libusb can manage "usb bulk tranfers" ?
P2k phones uses "usb control" transfers its ok
but p2k05 phones uses "usb bulk tranfers"

Good luck, and pls let me know if you have any questions or succes story.....
Logged

duffydac
Newbie
*
Offline Offline

Posts: 6


« Reply #2 on: May 24, 2007, 06:40:56 pm »

Hi!

If you were looking for questions I think you found them! ;-)

In fact I already modified moto4lin to match interface numbers.
In the original  source code there are three #defines:

// Intefaces for Motorola P2k phones
#define INTERFACE_ACCESSORIES 0x05
#define INTERFACE_DATA_LOGGING_MCU 0x06
#define INTERFACE_TEST_COMMAND 0x08

According to lsusb output I changed them to match my Z3 (switched to P2k sending "AT+MODE=8")

Bus 001 Device 007: ID 22b8:4901 Motorola PCS
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x22b8 Motorola PCS
  idProduct          0x4901
  bcdDevice            0.02
  iManufacturer           1 Motorola Inc.
  iProduct                2 Motorola Phone (Z3)
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           43
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration         23 MCU Logging+test cmd+accy
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      1
      bInterfaceProtocol    255
      iInterface             11 Motorola Accessory
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol    255
      iInterface             12 Motorola MCU Data Logger
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      3
      bInterfaceProtocol      0
      iInterface             13 Motorola Test Command
Device Status:     0x0000
  (Bus Powered)


#define INTERFACE_ACCESSORIES 0x0b
#define INTERFACE_DATA_LOGGING_MCU 0x0c
#define INTERFACE_TEST_COMMAND 0x0d

First question: in your opinion are these values correct?
I use the values on the row "iInterface", because its description sounds good :-)

See you soon!
DaC

Logged
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #3 on: May 24, 2007, 07:02:18 pm »

Hey, you has almost right!
This is from p2kc win32 log running with Z3:
P2kCommander launched.
Open Internet connection.
Check if update available.
Motorola Accessory
InterfaceNumber is: 00
Motorola MCU Data Logger
InterfaceNumber is: 01
Motorola Test Command
InterfaceNumber is: 02
Usb p2k device found, phone connected !

In your lsusb list you can see:

Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      1
      bInterfaceProtocol    255
      iInterface             11 Motorola Accessory
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol    255
      iInterface             12 Motorola MCU Data Logger
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      3
      bInterfaceProtocol      0
      iInterface             13 Motorola Test Command

You MUST use bInterfaceNumber instead of iInterface. And this must work....

Good luck....
Logged

duffydac
Newbie
*
Offline Offline

Posts: 6


« Reply #4 on: May 24, 2007, 08:27:47 pm »

You MUST use bInterfaceNumber instead of iInterface. And this must work....

Just
Like
A
Charm!

I can see drives /a /b and /c (I have a microsd memory card), upload and download files.
I can read the seem (i'll try to write when i'll understood what i'm doing...)

Now I try to fix it in a smarter way, having a loop through the usb devices and fetching the interface index at runtime.

I'll let you know when it's ready so you can give it a try on your Mandriva installation :-)
Thanks a lot! Grin
Logged
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #5 on: May 25, 2007, 06:41:34 am »

Would you pass your patch to the community?
If yes, pls send the patch, and which version of source did you use (svn,cvs)
I have a hot wire to some osx and linux users/developers (especially on modmymoto)
They are awaiting this thing long ago
Or i invite them here to read this topic.

Do you have any info about libusb and "usb bulk transfers" ? This need to p2k05.

ps: i have my old e398 , no Z3
Logged

duffydac
Newbie
*
Offline Offline

Posts: 6


« Reply #6 on: May 25, 2007, 10:41:11 am »

Of course I'll send the patch! :-)

For documentation about libusb, I read this
http://libusb.sourceforge.net/doc/

I don't know much about it, it's my first experience with usb devices :-)
Logged
duffydac
Newbie
*
Offline Offline

Posts: 6


« Reply #7 on: June 01, 2007, 09:43:21 pm »

Hi all,

take a look to sourceforge: I've added some note to make moto4lin work on the RIZR Z3
This is the link:

http://moto4lin.sourceforge.net/wiki/Feature_Requests#Support_for_RIZR_z3
Logged
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #8 on: June 02, 2007, 06:54:25 pm »

Thanks, it looks like you change these constant values.
Other phones will not work only these which has tci if number==2

changes in p2kproc.cpp:

// Intefaces for Motorola P2k phones
#define INTERFACE_ACCESSORIES 0x00
#define INTERFACE_DATA_LOGGING_MCU 0x01
#define INTERFACE_TEST_COMMAND 0x02
Logged

duffydac
Newbie
*
Offline Offline

Posts: 6


« Reply #9 on: June 04, 2007, 10:56:06 am »

If you do a "diff" you should see other changes..
In fact those #defines weren't used and some usb library calls had a 0x08 value as index parameter.
So I also changed the constant value with the approppriate #define.
Logged
tempo500
Newbie
*
Offline Offline

Posts: 1


« Reply #10 on: June 15, 2007, 06:26:50 pm »

hi,
im still trying hard to get my rizr3 working on ubuntu... didnt work last time i compiled it with the patch... but trying again now... lsusb gives me other numbers than duffyduck posted... does the patch on the wiki site apply to me? thanks, phil

Bus 001 Device 004: ID 22b8:4902 Motorola PCS E398 GSM Phone
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x22b8 Motorola PCS
  idProduct          0x4902 E398 GSM Phone
  bcdDevice            0.02
  iManufacturer           1 Motorola Inc.
  iProduct                2 Motorola Phone (Z3)
  iSerial                 3 35409101221060
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           67
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 Motorola Communication Class
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              5 Motorola Communication Interface
      CDC Header:
        bcdCDC               1.01
      CDC Call Management:
        bmCapabilities       0x03
          call management
          use DataInterface
        bDataInterface          1
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      CDC ACM:
        bmCapabilities       0x02
          line coding and serial state
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x89  EP 9 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface             16 Motorola Data Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
« Last Edit: June 15, 2007, 06:29:02 pm by tempo500 » Logged
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #11 on: June 15, 2007, 07:05:20 pm »

No, your usb device list is from BEFORE swithcing to p2kmode
These are AT devices (modem or ACM interface)

With original Moto4lin (from SVN repo) your linuxbox must detect phone as AT device (isnt it?)
Then you must try to make connect. (this is swithcing to p2k mode)
This operation also must be work, but further operation will fail.

On this stage you can run lsusb and must see p2k device (Motorola Test Command)
Rizr has if num==2 but old phones has if num==8
Duffydac's patch change all occureces of ifnum==8 to ifnum==2
Unfortunately the definition on the beginning is not used the code, he must hunt these constant over the code.....

In other words this patch (against SVN code) must work.
libusb and libusb-devel packages are needed (i tried on Mandriva)


Good luck and let me know.....
Logged

xtravar
Newbie
*
Offline Offline

Posts: 3


« Reply #12 on: August 09, 2007, 10:42:11 pm »

Hi, first I'd like to say thanks for all the work on p2k!

I had started a Linux project a couple years ago when I got my first Motorola phone (V551), and it was successful at doing basic P2K things, but now it won't work on my new RAZR V3xx.

Now, I'm pretty familiar with libusb and can do the basics, but I have no knowledge on how to get the RAZR V3xx into P2K mode.  It doesn't respond to AT+MODE=8

Could you give me some pointers on how to get the phone responding to basic p2k commands?
Logged
s5vi
Administrator
Hero Member
*****
Offline Offline

Posts: 769



WWW Email
« Reply #13 on: August 10, 2007, 07:34:27 am »

Hi, pls read here:
this is my libusb/p2k/p2k05 project (open source)
Works on linux and mac, but  i cannot manage to work under win.

Swithcing to p2kmode is NOT p2k operation.
You're right: this command (AT+MODE=8) must be send to the proper target.
basically this is an usb modem.
Under linux this is an ACM device managed by a kernel driver.
Two ways:

1: use the ACM device (just like a TTY device)
set comm parameters (baud...etc) to configure communication, and send the command
Dosent matter if the phone is p2k or p2k05 (V3xx is p2k05 !)
This way which is Moto4lin does.

2: I use (in p2k-core) the native usb bulk device
I must detach kernel driver (there is a proper function in libusb) to free device
and i directly send the command with libusb's usb_bulk_write

So i think your problem is : your command targeted to the bad device

regards....
Logged

xtravar
Newbie
*
Offline Offline

Posts: 3


« Reply #14 on: August 10, 2007, 11:30:33 pm »

First of all, my cdc_acm driver was getting in the way of a lot of things.  The way to fix this is to log in as root and type rmmod cdc_acm.  Apparently the usb driver detaching code doesn't do that very well?

A good way to debug p2k apps is to run dmesg as root.  It'll tell you why your interface isn't being claimed and whatnot.

I'm still investigating why p2k-core.c won't work, though.  It works with my V551 but not V3xx.
Logged
Pages: [1] 2   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 27, 2012, 02:36:40 am