Announcement

Collapse
No announcement yet.

PHPoC Debugger screenshot for help (Thank's Khanh)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Khanh
    replied
    I am happy to hear these.

    You're welcome!

    I think that solving this problem helped us understand project in depth.

    Thank you for inviting me.
    I hope I have chance to visit your beautiful country some day,and see you .

    Have a nice day/night and stay safe!

    Best regards,

    Leave a comment:


  • Stéphane Mancini
    replied
    Hello Khanh,

    I have done everything you told me and unfortunately, we will no longer be able to discuss this subject because THE PROJECT IS WORKING now after changing buffer size

    THANK YOU very much for taking the time to answer me. I will be able to finalize my project using this one.

    Sincerely, Stéphane.

    PS : if one day you go through the south of France, don't hesitate to write to me and I will show you my project : BUGGY full options
    and soon photographer .


    Cliquez sur l'image pour la voir en taille réelle   Nom : 		Buggy rear.jpg  Affichages :	3  Taille :		4,47 Mo  ID : 			1807Cliquez sur l'image pour la voir en taille réelle   Nom : 		image_906.jpg  Affichages :	6  Taille :		4,44 Mo  ID : 			1803
    Attached Files
    Last edited by Stéphane Mancini; 08-13-2020, 04:54 AM.

    Leave a comment:


  • Khanh
    replied
    Dear Stéphane Mancini

    Please do the following:
    • In Arduino code, change all HTTP/1.1 to HTTP/1.0
    • In Arduino code, find all Serial.println(response_hearder); and Serial.println(response_body);, uncomment them to see the response from Google.
    • In PHPoC Shield (via PHPoC Debugger), find file phpoc.ini -> in the line 28: ssl0_rxbuf_size = 6144 ; SSL recv buffer, change this line to: ssl0_rxbuf_size = 10024 ; SSL recv buffer
    • Reset Arduino and PHPoC Shield
    I hope it work

    Leave a comment:


  • Stéphane Mancini
    replied
    Dear Khanh,

    here is the PHPoC Debugger Firm Log when I access to login.php page :

    [0108:22:17:06.805] pdb: VCP connected
    [0108:22:17:06.805] pdb: 'admin' login (02 00000000)
    [0108:22:17:14.922] php start init.php RUN
    [0108:22:17:14.926] php start task1.php RUN
    [0108:22:17:14.926] php: run next task0.php
    [0108:22:17:27.398] php start login.php RUN
    [0108:22:17:27.805] http_ws: http14 80 192.168.0.16 /login text.phpoc
    [0108:22:17:27.813] http: file not found favicon.ico
    [0108:22:17:27.813] php start missing.php RUN
    [0108:22:17:27.895] ssl: session 0 open
    [0108:22:17:27.965] ssl: accept first cert 1464 in cert_chain 2572
    [0108:22:17:28.059] ssl: enter to cipher state
    [0108:22:17:28.063] uart0: framing error 1524
    [0108:22:17:28.262] ssl: session 0 closed
    [0108:22:17:28.539] ssl: session 0 open
    [0108:22:17:28.609] ssl_recv_record: record too long: 8085 > 6144
    [0108:22:17:28.609] ssl: session 0 closed
    [0108:22:17:29.063] uart0: framing error 1536
    [0108:22:17:42.063] uart0: framing error 1540
    [0108:22:17:47.066] uart0: framing error 1543
    [0108:22:17:52.063] uart0: framing error 1547
    Last edited by Stéphane Mancini; 08-12-2020, 02:48 AM.

    Leave a comment:


  • Khanh
    replied
    Could you please show firmware log on PHPoC when this happen?

    Leave a comment:


  • Stéphane Mancini
    replied
    Hi Khanh,
    effectively it's almost almost good.

    Another little problem I need your help for. After changing HTTP/1.1 to HTTP/1.0, now I have the login.php page with the CODE display and I can connect my device to google. But, after connecting the device and come back to the login.php page, I don't have the : " Success, You are now logged in from Arduino via PHPoC Shield" .

    On the IDE Serial Monitor, I have first a : "
    phpoc_client: connectSSL 0 >> failed" and after : "phpoc_client: SSL socket not available"

    thank's again.


    Here is the complete Serial Monitor display :


    log> sppc_begin: phpoc shield, firmware 1.5.0
    log> sppc_begin: package 1.5.0
    log> sppc_begin: WiFi INFRA pacsou ch1
    log> command: head wait timeout
    log> sppc_begin: IPv4 192.168.0.29 255.255.255.0 192.168.0.254 212.27.40.241
    log> phpoc_server : listen 2/80
    WebSocket server address : 192.168.0.29

    log> dns: query A accounts.google.com >> 216.58.204.141
    log> phpoc_client: connectSSL 0 >> success
    Connected to server
    log> phpoc_client: close 0 >> closed
    HTTP/1.0 200 OK
    Pragma: no-cache
    Expires: Mon, 01 Jan 1990 00:00:date: Mon, 10 Aug 2020 16:16:12 Cache-Control: no-cache, no-storContent-Type: application/json; Vary: X-Origin
    Vary: Referer
    Server: ESF
    X-XSS-Protection: 0
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff Alt-Svc: h3-29=":443"; ma=259200Accept-Ranges: none
    Vary: Origin,Accept-Encoding

    {
    "device_code": "AH-1Ng0S2oew11rGTcFKab9pOP1B22Ah5jg8brv7ooJtbU58qfdLv 2OohjQDFyvlX9C0Wgg9aY4nvTXZ76UnkvMr0KKZMxtIdA",
    "user_code": "JNZL-GFFM",
    "expires_in": 1800,
    "interval": 5,
    "verification_url": "https://www.google.com/device"
    }
    Next, visit https://www.google.com/device on your desktop or smartphone and enter this code: JNZL-GFFM
    log> phpoc_server: connected 2
    log> phpoc_server : listen 3/80
    log> dns: query A www.googleapis.com >> 216.58.201.234
    log> phpoc_client: connectSSL 0 >> failed
    log> dns: query A www.googleapis.com >> 216.58.213.74
    log> phpoc_client: SSL socket not available
    log> dns: query A www.googleapis.com >> 216.58.206.234
    log> phpoc_client: SSL socket not available
    log> dns: query A www.googleapis.com >> 216.58.201.234
    log> phpoc_client: SSL socket not available

    Leave a comment:


  • Khanh
    replied
    Hello,
    It almost works.
    That error is because Google changed to return data encoded in chunk. Please try changing client.println(F("POST /o/oauth2/device/code HTTP/1.1")); to client.println(F("POST /o/oauth2/device/code HTTP/1.0"));

    If it still does not work, you can modify the code to manually remove some unnecessary characters before parsing

    Leave a comment:


  • Stéphane Mancini
    replied
    Hello Khanh, after selecting TVs and Limited Input devices, now in the Serial Monitor, I have a Parsing input failed!.

    However there is better because I receive a CODE that works if I log it (https://www.google.com/device). Device is connected to my google account.


    Unfortunately, if I press the button to take picture, "access_token is invalid, please login again" appers in the IDE Serial Monitor.

    Any ideas ?

    Thank's



    log> sppc_begin: phpoc shield, firmware 1.5.0
    log> sppc_begin: package 1.5.0
    log> sppc_begin: WiFi INFRA pacsou ch1
    log> sppc_begin: IPv4 192.168.0.29 255.255.255.0 192.168.0.254 212.27.40.241
    log> phpoc_server : listen 2/80
    WebSocket server address : 192.168.0.29

    log> phpoc_server: connected 2
    log> phpoc_server : listen 3/80
    log> dns: query A accounts.google.com >> 216.58.209.237
    log> phpoc_client: connectSSL 0 >> success
    Connected to server
    log> phpoc_client: close 0 >> closed
    HTTP/1.1 200 OK
    Expires: Mon, 01 Jan 1990 00:00:Pragma: no-cache
    Cache-Control: no-cache, no-storDate: Fri, 07 Aug 2020 11:17:16 Content-Type: application/json; Vary: X-Origin
    Vary: Referer
    Server: ESF
    X-XSS-Protection: 0
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff Alt-Svc: h3-29=":443"; ma=259200Accept-Ranges: none
    Vary: Origin,Accept-Encoding
    Connection: close
    Transfer-Encoding: chunked

    f5
    {
    "device_code": "AH-1Ng2KiOkZGXD6WVqgpuXH95gAfU-rrzIJFe4ooOHykhd9l4sloX206wPbHTI0IYSdV_Xv7Yuupmd_g fmEgE7FYlmXzHp04g",
    "user_code": "FGC-BWQ-PJJ",
    "expires_in": 1800,
    "interval": 5,
    "verification_url": "https://www.google.com/device"
    }
    0


    Parsing input failed!
    log> phpoc_client: close 2 >> closed

    Leave a comment:


  • Khanh
    replied
    Hello,
    When creating Oauth Client ID, please do NOT choose "Web Application", choose "TVs and Limited Input Device" instead. See the below image:

    Click image for larger version

Name:	google.png
Views:	32
Size:	169.2 KB
ID:	1790
    Last edited by Khanh; 08-07-2020, 08:18 AM.

    Leave a comment:


  • Stéphane Mancini
    replied
    Hi Khanh,
    I would have liked to tell you that it works but not yet. First of all, in order to debug, if I uncomment lines 163 and 164 in the orignal Arduino code, there is nothing more displayed in the Serial Monitor IDE. However, if I uncomment lines 82 and 83 (http_resp_hearder(client) and http_resp_body(client)) , here is what the Serial Monitor displays:

    log> sppc_begin: phpoc shield, firmware 1.5.0
    log> sppc_begin: package 1.5.0
    log> sppc_begin: WiFi INFRA pacsou ch1
    log> sppc_begin: IPv4 192.168.0.29 255.255.255.0 192.168.0.254 212.27.40.241
    log> phpoc_server : listen 2/80
    WebSocket server address : 192.168.0.29

    log> dns: query A accounts.google.com >> 172.217.19.237
    log> phpoc_client: connectSSL 0 >> success
    Connected to server
    log> phpoc_client: close 0 >> closed
    HTTP/1.1 401 Unauthorized
    Cache-Control: no-cache, no-storPragma: no-cache
    Expires: Mon, 01 Jan 1990 00:00:date: Thu, 06 Aug 2020 21:14:06 Content-Type: application/json; Vary: X-Origin
    Vary: Referer
    Server: ESF
    X-XSS-Protection: 0
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff Alt-Svc: h3-29=":443"; ma=259200Accept-Ranges: none
    Vary: Origin,Accept-Encoding
    Connection: close
    Transfer-Encoding: chunked

    4e
    {
    "error": "invalid_client",
    "error_description": "Invalid client type."
    }
    0

    Invalid resonse from Google
    log> phpoc_server: connected 2
    log> phpoc_server : listen 3/80
    log> phpoc_client: close 2 >> closed



    Here is how I proceeded to create a Google access : First, I create a new project. Then, I open the API Library and I active Google Drive API. Then, in the credentials page, I create an OAuth client ID (application WEB selected) and download the Client ID and Client Secret. Put them in the Arduino sketch and download to the Arduino Mega Board. That's it. Perhaps I forgot something.

    Thank's
    Last edited by Stéphane Mancini; 08-07-2020, 06:53 AM.

    Leave a comment:


  • Khanh
    replied
    That's great!

    Now problem is on google login.

    To find out the reason and solution, please read the following tutorials:These above article described how it work and how to do it. The first article does not use Arduino, but working principle is the same.

    And for debugging. In original Arduino code, lines 163 and 164 look like below
    Code:
    //Serial.println(response_hearder);
    //Serial.println(response_body);
    Uncomment these line to see the response from Google. You can know the reason why Google reject it, and then we can fix it.

    Leave a comment:


  • Stéphane Mancini
    replied
    Hello Khanh, "debug point" appears in the IDE Serial Monitor if Serial.println("debug point") is added right after cameraInit(CT_JPEG, PR_160x120, JR_640x480). So Camera library seems good, no infinitive loop. But, quietly, I started all over again including the connections and a miracle begins to happen. When I reload the login.php page, now, Arduino board responds. Here is the IDE Serial Monitor display :

    log> sppc_begin: phpoc shield, firmware 1.5.0
    log> sppc_begin: package 1.5.0
    log> sppc_begin: WiFi INFRA pacsou ch1
    log> sppc_begin: IPv4 192.168.0.29 255.255.255.0 192.168.0.254 212.27.40.241
    log> phpoc_server : listen 2/80
    WebSocket server address : 192.168.0.29

    log> phpoc_server: connected 2
    log> phpoc_server : listen 3/80
    log> dns: query A accounts.google.com >> 216.58.215.45
    log> phpoc_client: connectSSL 0 >> success
    Connected to server
    log> phpoc_client: close 0 >> closed
    Invalid resonse from Google
    log> phpoc_client: close 2 >> closed
    log> phpoc_server: connected 3
    log> phpoc_server : listen 2/80
    log> dns: query A accounts.google.com >> 216.58.215.45
    log> phpoc_client: connectSSL 0 >> success
    Connected to server
    log> phpoc_client: close 0 >> closed
    Invalid resonse from Google


    And if i press the button to take a photo : "access_token is invalid, please login again" is displayed.

    What do you think about that ?

    Thank's Khanh
    Last edited by Stéphane Mancini; 08-06-2020, 05:52 AM.

    Leave a comment:


  • Khanh
    replied
    If so, there is no problem with network.
    Problem might be on Camera.
    In the original code, please add a Serial.println("debug point"); right after cameraInit(CT_JPEG, PR_160x120, JR_640x480); to check if this function block other operation or not?

    PS: I made this project not for commercial, therefore, the camera library may contain bugs that blocks operation in infinitive loop

    Leave a comment:


  • Stéphane Mancini
    replied
    Hi, yes I can access login.php but always the same page where it is written Google, Login for Arduino with a rotating icon. However, I don't have a message asking me to reload the page.

    Leave a comment:


  • Khanh
    commented on 's reply
    did you access login.php on PHPoC Shield before geting the above log ?
Working...
X