View Single Post
Old 05-27-2012, 02:07   #1 (permalink)
McManiek
Insane Poster
 
Join Date: May 2008
Location: Poland ;)
Age: 38
Posts: 69
Member: 776944
Status: Offline
Thanks Meter: 26
Strange problem with connecting to S5230 via USB...

Hi. I'm starting to deal with USB port so i decided to start with some basics. I choosed S5230, target = get access to modem via AT Commands, butI have a little problem with this...

I sniffed a lot of packets from New PC Studio for beginning, & i see there is few packets to Set Communication mode To AT. So i wrote a lil program to switch to AT Mode, basing on sniffed packets, later few AT queries to test it (GET MODEL, GET IMEI, GET PRODUCT CODE, GET SW VERSION etc) and everything is OK - program works great but... and there's a problem : Communication works properly ONLY When PC Studio is launched! O.o

I checked Sniff log few times (sniffed packets from PC Studio), and i dont see any packet i missed. Interesting thing: When I close PC Studio & run sniffer to sniff my program vs. phone, it shows that phone send response packets for my AT Commands properly, but my program didnt show any packet @ Memo. If I run PC Suite, program works great. Someone can tell me whats goin on?



Here's a part of source (becouse I developed it only for educational purposes, the code looks ugly)


Here's a chain of Initial packets... Packets starting from 0x41 are AT commands...

Code:
const ATPacket: Array[0..11] of String = ('00C20100000008', '00C20100000008','7E00A072557E', '810003', '41545A0D0A', '41542B474D4D0D', '41542B4347534E0D', '41542B53575645523F0D', '41542B50524F44554354434F44453F0D0A', '41542B435042533F0D', '41542B435042533D22534D220D', '41542B435042523D');
Here's a part of procedure to send each packet from chain, and display received stuff as string in memo...

Code:
var Str: String;
    i: byte;
    F: String;
begin
if USB.USBOpenDriver then //yea, I'm using oOXTCOo's unit to deal with USB :P
  begin
  Memo1.Lines.Add('Successfully Opened');

  Memo1.Lines.Add('Switching to AT-Mode...');
  Pb.Max:=High(ATPacket); //thats only Progress Bar :D

  for i:=Low(ATPacket) to High(ATPacket) do
      begin
        PB.Position:=i; //increase progress bar position

        Str:=USB.RWUSB(ATPacket[i], 255, 200, 'STRING');
        if Length(Str)>0 then // if got some stuff from phone then...
          Memo1.Lines.Add('#:'+Str);
      end;
  Memo1.Lines.Add('Finished');
  Reply With Quote
The Following User Says Thank You to McManiek For This Useful Post:
 
Page generated in 0.12280 seconds with 7 queries