8000 m2k: update index.html page to (hopefully) make it easier for end users · analogdevicesinc/buildroot@f4472a1 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit f4472a1

Browse files
committed
m2k: update index.html page to (hopefully) make it easier for end users
This provides pointers to scopy in the html, as well as some of the other libraries/frameworks that the M2k works with. Signed-off-by: Robin Getz <robin.getz@analog.com>
1 parent e2a165c commit f4472a1

File tree

7 files changed

+204
-49
lines changed

7 files changed

+204
-49
lines changed

board/m2k/msd/img/GNURadio_logo.png

11.1 KB
Loading

board/m2k/msd/img/labview_logo.png

22.1 KB
Loading

board/m2k/msd/img/libm2k.png

7.96 KB
Loading

board/m2k/msd/img/scopy.png

4.91 KB
Loading

board/m2k/msd/img/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ header img{
3434
}
3535
nav{
3636
margin-bottom: 20px;
37+
text-align: center;
3738
}
3839
ul{
3940
padding-left: 20px;

board/m2k/msd/img/version.js

Lines changed: 113 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function versionCompare(v1, v2) {
2929
}
3030

3131
var latest_libiio;
32+
var latest_scopy;
3233
var mac = false;
3334

3435
function GetDriverurl() {
@@ -52,9 +53,10 @@ function GetDriverurl() {
5253
} else
5354
document.getElementById('hidedriver').style.display = "none";
5455
var linux = navigator.platform.indexOf('Linux') > -1 ? true : false;
55-
if (mac || win || linux)
56+
if (mac || win || linux) {
5657
document.getElementById('hidelib').style.display = "inline";
57-
else {
58+
document.getElementById('hidescopy').style.display = "inline";
59+
} else {
5860
if (navigator.platform.match(/(Linux|iPhone|iPod|iPad|Android)/i)) {
5961
document.getElementById('libtest').innerHTML = "Sorry, we don't support " + navigator.platform + " yet. Please ask.";
6062
jQuery('#libtest').attr ('href', "https://ez.analog.com/university-program");
@@ -68,32 +70,64 @@ function GetDriverurl() {
6870
var req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/libiio/releases/latest");
6971
req.fail(function() {
7072
document.getElementById('hidelib').style.display = "none";
73+
document.getElementById('hidescopy').style.display = "none";
7174
latest_libiio = null;
7275
});
7376
req.done(function(response) {
7477
latest_libiio = response;
75-
var select = document.getElementById("os-select");
78+
var libiio_os = document.getElementById("libiio-os");
79+
var scopy_os = document.getElementById("scopy-os");
7680
var suffix = "";
7781
for (i = 0; i < latest_libiio.assets.length; i++) {
7882
os = latest_libiio.assets[i].name.split('-')[2];
7983
suffix = os.slice(-4);
8084
if (suffix == ".zip" ) {
8185
os = os.slice(0, os.length-4);
8286
}
83-
for (j = 0; j < select.length; j++) {
84-
if (os.match(select[j].value))
87+
for (j = 0; j < libiio_os.length; j++) {
88+
if (os.match(libiio_os[j].value))
8589
break;
8690
}
87-
if (j == select.length) {
88-
select.options[select.options.length] = new Option(os);
91+
if (j == libiio_os.length) {
92+
libiio_os.options[libiio_os.options.length] = new Option(os);
8993
if ((win && os == "Windows") || (mac && os == "darwin") || (linux && os == "ubuntu")) {
90-
select.value = os;
94+
libiio_os.value = os;
9195
libiio_type();
9296
}
9397
}
9498
}
9599
if (latest_libiio.hasOwnProperty('tarball_url') || latest_libiio.hasOwnProperty('zipball_url'))
96-
select.options[select.options.length] = new Option("source");
100+
libiio_os.options[libiio_os.options.length] = new Option("source");
101+
});
102+
103+
var req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/scopy/releases/latest");
104+
req.fail(function() {
105+
document.getElementById('hidescopy').style.display = "none";
106+
latest_scopy = null;
107+
});
108+
req.done(function(response) {
109+
latest_scopy = response;
110+
var scopy_os = document.getElementById("scopy-os");
111+
var suffix = "";
112+
for (i = 0; i < latest_scopy.assets.length; i++) {
113+
var os = latest_scopy.assets[i].name.split('-')[2];
114+
if (os.length == 0)
115+
os = latest_scopy.assets[i].name.split(' ')[0];
116+
os = os.split('_')[0];
117+
for (j = 0; j < scopy_os.length; j++) {
118+
if (os.match(scopy_os[j].value))
119+
break;
120+
}
121+
if (j == scopy_os.length) {
122+
scopy_os.options[scopy_os.options.length] = new Option(os);
123+
if ((win && os == "Windows") || (mac && os == "osx") || (linux && os == "Linux")) {
124+
scopy_os.value = os;
125+
scopy_type();
126+
}
127+
}
128+
}
129+
if (latest_scopy.hasOwnProperty('tarball_url') || latest_scopy.hasOwnProperty('zipball_url'))
130+
scopy_os.options[scopy_os.options.length] = new Option("source");
97131
});
98132
if (win) {
99133
req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/plutosdr-m2k-drivers-win/releases/latest");
@@ -123,8 +157,8 @@ function GetDriverurl() {
123157
}
124158

125159
function libiio_type() {
126-
var select = document.getElementById("type-select");
127-
var os = document.getElementById("os-select").value;
160+
var select = document.getElementById("libiio-type");
161+
var os = document.getElementById("libiio-os").value;
128162
select.onchange = null;
129163
var i;
130164
for (i = select.options.length - 1 ; i >= 0 ; i--) {
@@ -159,10 +193,51 @@ function libiio_type() {
159193
libiio_ver();
160194
}
161195

196+
function scopy_type() {
197+
var type = select = document.getElementById("scopy-type");
198+
var os = document.getElementById("scopy-os").value;
199+
select.onchange = null;
200+
var i;
201+
for (i = select.options.length - 1 ; i >= 0 ; i--) {
202+
type.remove(i);
203+
}
204+
var suffix = "";
205+
for (i = 0; i < latest_scopy.assets.length; i++) {
206+
if (latest_scopy.assets[i].browser_download_url.match(os)) {
207+
suffix = latest_scopy.assets[i].browser_download_url.slice(-4);
208+
if (suffix == "r.gz" ) {
209+
suffix = ".tar.gz";
210+
}
211+
for (j = 0; j < type.length; j++) {
212+
if (suffix.match(select[j].value))
213+
break;
214+
}
215+
if (j == type.length) {
216+
type.options[select.options.length] = new Option(suffix);
217+
}
218+
}
219+
}
220+
if (os.match('source')) {
221+
if (latest_scopy.hasOwnProperty('tarball_url'))
222+
type.options[select.options.length] = new Option('.tar');
223+
if (latest_scopy.hasOwnProperty('zipball_url'))
224+
type.options[select.options.length] = new Option('.zip');
225+
}
226+
227+
if (type.length == 1)
228+
document.getElementById('hidescopytype').style.display = "none";
229+
else
230+
document.getElementById('hidescopytype').style.display = "inline";
231+
232+
type.onchange = scopy_url;
233+
scopy_url();
234+
}
235+
236+
162237
function libiio_ver() {
163238
var select = document.getElementById("ver-select");
164-
var os = document.getElementById("os-select").value;
165-
var suffix = document.getElementById("type-select").value;
239+
var os = document.getElementById("libiio-os").value;
240+
var suffix = document.getElementById("libiio-type").value;
166241
select.onchange = null;
167242
var i;
168243
for (i = select.options.length - 1 ; i >= 0 ; i--) {
@@ -188,8 +263,8 @@ function libiio_ver() {
188263
}
189264

190265
function libiio_url() {
191-
var os = document.getElementById("os-select").value;
192-
var suffix = document.getElementById("type-select").value;
266+
var os = document.getElementById("libiio-os").value;
267+
var suffix = document.getElementById("libiio-type").value;
193268
var ver = document.getElementById("ver-select").value;
194269
var i, url;
195270
for (i = 0; i < latest_libiio.assets.length; i++) {
@@ -212,6 +287,29 @@ function libiio_url() {
212287
}
213288
}
214289

290+
function scopy_url() {
291+
var os = document.getElementById("scopy-os").value;
292+
var suffix = document.getElementById("scopy-type").value;
293+
var i, url;
294+
for (i = 0; i < latest_scopy.assets.length; i++) {
295+
url = latest_scopy.assets[i].browser_download_url;
296+
if (url.match(os) && url.match(suffix)) {
297+
jQuery('#scopytest').attr ('href', url);
298+
document.getElementById('scopytest').innerHTML = latest_scopy.assets[i].name;
299+
}
300+
}
301+
if (os.match('source')) {
302+
if (suffix.match('.tar')) {
303+
document.getElementById('scopytest').innerHTML = "Source code (tar)";
304+
jQuery('#scopytest').attr ('href', latest_scopy.tarball_url);
305+
}
306+
if (suffix.match('.zip')) {
307+
document.getElementById('scopytest').innerHTML = "Source code (zip)";
308+
jQuery('#scopytest').attr ('href', latest_scopy.zipball_url);
309+
}
310+
}
311+
}
312+
215313
function CheckFrmVersion() {
216314
GetDriverurl();
217315
var req = jQuery.getJSON("https://api.github.com/repos/analogdevicesinc/m2k-fw/releases/latest");

0 commit comments

Comments
 (0)
0