Device Trees: Difference between labels and aliases?
Aliases are for use by the Linux kernel, but can't be used within the device tree source (DTS) configuration.
Meanwhile, labels can be used in your DTS files to extend or modify the node later.
e.g. You could have a custom DTS file like:
#include "imx6qdl.dtsi"
&gpio2 {
[your modifications here]
}
Note, again, this would apply to the gpio2
label, not the alias.
Cf. https://elinux.org/Device_Tree_Mysteries#Label_vs_aliases_node_property
Related videos on Youtube
gdvander
Updated on September 18, 2022Comments
-
gdvander over 1 year
I am trying to create a PHP API for my Android application to use. I am trying to use Volley to handle my HTTP requests. I am returning a JSON string in my PHP script, but Volley only receives a 'status=ok' response.
Here is the portion using Volley from my Android application.
//Make json string request StringRequest strReq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { txtDisplay.setText(response); System.out.println(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error){ System.out.println(error); } });
Here is my PHP script.
<?php require($_SERVER["DOCUMENT_ROOT"] . "/resources/connection.php"); header('Content-type: application/json'); $response["success"] = 1; $response["message"] = "Hello World! Database connection has been established!"; die(json_encode($response)); ?>
I do not understand why the only response I am getting is 'status=ok'. I am assuming it has to do with the HTTP Response Header Code 200 OK, but I do not know. What am I doing wrong?
-
VinceStyling almost 10 yearswhat did you get in return, empty's response body? error ? please tell.
-
gdvander almost 10 years@VinceStyling I do not get an error. When I print out the response, all I get is 'status=ok' in a string.
-
VinceStyling almost 10 yearsVolley won't generate any response like 'status=ok', I suppose that was something wrong in your server-side.
-
gdvander almost 10 years@VinceStyling Hmm... Well, when I test the PHP script using Fiddler, the JSON is successfully returned. Do you think the server is returning the 'status=ok' message? Perhaps somewhere in my connection script? I am currently just using MySQL Workbench running locally on my machine for testing.
-
gdvander almost 10 years@VinceStyling I figured it out. Thanks for your help!
-
-
gdvander almost 10 yearsThis did not work. I only received 'status=ok' in the response again. This is frustrating. I have no idea why this is not working. Am I not properly passing the JSON from my PHP script? Or is Volley just not grabbing the JSON for some reason?
-
Anderson K almost 10 years@gdvander, see this link Volley
-
gdvander almost 10 yearsI saw this earlier. He wants to be able to POST JSON and only receive a 200 status code back. He doesn't want any JSON returned. I am just trying to get a simple 'Hello, World' JSON response back from my PHP script, but all I am getting is 'status=ok'.
-
Anderson K almost 10 years@gdvander, Have you ever tried using JsonObjectRequest?
-
Anderson K almost 10 years@gdvander, try this in your php: echo json_encode($data);
-
gdvander almost 10 yearsYes. I have tried JsonObjectRequest, StringRequest, and JsonArrayRequest. The StringRequest is the only one that returns anything. The others give an error because a string is what's being returned.
-
gdvander almost 10 yearsI've tried that too. I know the PHP script is outputting JSON. I am using Fiddler to test it.
-
Anderson K almost 10 years@gdvander,Send and Receive JSON between Android and PHP Web Service, see the end of the post Points of Interest
-
gdvander almost 10 yearsIn that scenario, he is posting JSON to his PHP API and is trying to read it in the PHP script. Thanks for your help, but I think I am going to take a break now. I will come back to it later. The issue must be bigger than I had expected. Thanks!
-
Anderson K almost 10 years@gdvander, For nothing friend, I confess that php is not half strong, I use java side serves, and for communication between a server is an app where, I use a service like Restfull Jersey, and you are thinking about the future do something beyond helloworld and want to use php, I suggest a framework like PhPSlim!
-
gdvander almost 10 yearsThank you for your help! I will take PHPSlim into consideration!
-
Noah almost 10 yearsFor reference: No machine can communication with another machine's "localhost". localhost ALWAYS refers to the device itself
-
gdvander almost 10 yearsThanks, I know that now! I'm new to web and networking stuff.
-
happyMOOyear over 8 yearsI still have not found a good answer to my question so thanks for your input. In case of the label gpio0 I think it is clear that I refer to gpio1@0209c000. But which gpio am I refereing to when I use the label gpio1? gpio1@0209c000 or gpio2@020a0000?
-
Daniel over 8 yearsif you use gpio1, that is the alias. if you wish to access gpio1@0209c000 you must either use the gpio0 alias, or the full gpio1@0209c000 label.