]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Fix STEMlab discovery without hostname resolution
authorMarkus Großer <markus.grosser2+git@gmail.com>
Tue, 5 Dec 2017 13:53:29 +0000 (14:53 +0100)
committerMarkus Großer <markus.grosser2+git@gmail.com>
Tue, 5 Dec 2017 13:53:29 +0000 (14:53 +0100)
Before, the web request to start the SDR application was sent to the
STEMlab identified by the hostname (rp-xxxxxx). Unfortunately, there are
cases where the STEMlab can be found via IP address, but not via
hostname.

This should have really been in with the original commit for STEMlab
discovery already, but seems to have slipped under my radar - listing
the installed HPSDR applications already uses the IP address, but
actually starting it was still left with using hostname resolution.

stemlab_discovery.c

index bb8b532fc8ee57ea9088dbe76f2f3bc78958dd8f..4581bd13680eb0d35881f60d7b1687838b70fa2b 100644 (file)
@@ -289,11 +289,9 @@ static size_t app_start_callback(void *buffer, size_t size, size_t nmemb, void *
 
 void stemlab_start_app(const char * const app_id) {
   // Dummy string, using the longest possible app id
-  char app_start_url[] = "http://rp-ff00ff/bazaar?start=stemlab_sdr_transceiver_hpsdr";
-  sprintf(app_start_url, "http://rp-%02hhx%02hhx%02hhx/bazaar?start=%s",
-          radio->info.network.mac_address[3],
-          radio->info.network.mac_address[4],
-          radio->info.network.mac_address[5],
+  char app_start_url[] = "http://123.123.123.123/bazaar?start=stemlab_sdr_transceiver_hpsdr";
+  sprintf(app_start_url, "http://%s/bazaar?start=%s",
+          inet_ntoa(radio->info.network.address.sin_addr),
           app_id);
   CURL *curl_handle = curl_easy_init();
   if (curl_handle == NULL) {