Equinox Geschrieben February 27, 2014 at 19:43 Geschrieben February 27, 2014 at 19:43 OK, thanks for the explanation. Now, I understand I didn't think of the stack being connected to the localhost as I'm not using that kind of setup. But nevertheless, yes, in these cases it is a problem . Zitieren
Equinox Geschrieben February 27, 2014 at 19:53 Geschrieben February 27, 2014 at 19:53 Regarding authentication: I think option 2 (For all communication) is the more basic and general approach. Having authentication not only for WebSockets but for the whole communication would increase security for the complete system. Zitieren
Loetkolben Geschrieben February 27, 2014 at 21:28 Geschrieben February 27, 2014 at 21:28 What if the stack is connected via e.g. WiFi-Extension and no brickd is running on the localhost? Then the attacker would indeed have to know the IP of the WiFi-Extension. There is no way for the browser to scan your network or similar. Shure? But the browser can determine the local IP and test, step by step, all local addresses via websockets to find the stack? Der Loetkolben. Zitieren
The_Real_Black Geschrieben February 27, 2014 at 22:18 Geschrieben February 27, 2014 at 22:18 http://www.tinkerunity.org/wiki/index.php/DE/Projekte/TheRealBlack_Web I played with the bindings and it is great. Switching LED Lights on a IO16 Bricklet by using only a website opens a lots ways to use it. Maybe i combine this with the nice LCARS Template i found before. Zitieren
borg Geschrieben February 28, 2014 at 08:31 Geschrieben February 28, 2014 at 08:31 Shure? But the browser can determine the local IP and test, step by step, all local addresses via websockets to find the stack? Der Loetkolben. I don't think that is practical. You can't determine what subnet the local network uses. But it doesn't matter, both options also protect the Ethernet and WIFI Extension . Zitieren
Gast Robin Geschrieben March 2, 2014 at 14:56 Geschrieben March 2, 2014 at 14:56 I tried the new BrickD on a raspberry pi. First of all I got the following error: (Reading database ... 72768 files and directories currently installed.) Preparing to replace brickd 2.0.10 (using brickd-2.1.0-rc1_armhf.deb) ... Stopping Brick Daemon: Stopped process in pidfile '/var/run/brickd.pid' (pid 2133). update-rc.d: using dependency based boot sequencing Unpacking replacement brickd ... dpkg: dependency problems prevent configuration of brickd: brickd depends on pm-utils; however: Package pm-utils is not installed. dpkg: error processing brickd (--install): dependency problems - leaving unconfigured Processing triggers for man-db ... Errors were encountered while processing: Trying to install pm-utils manually returned the following error: sudo apt-get install pm-utils Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: pm-utils : Depends: powermgmt-base but it is not going to be installed Recommends: vbetool but it is not installable Recommends: hdparm but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). I think the main problem is, that the raspberry pi can't use pm-utils since it hasn't got a powermanagement. Did anyone else solve this problem? Edit: I ran apt-get intall -f. hdparm pm-utils and powermgmt-base were installed an the installation of brickd continued. Edit 2: I got it running. But the problem should be solved to ensure a clean installation. Great work! Getting the temperature on a web inteface without using an additional php script is a much better and cleaner way. Zitieren
borg Geschrieben March 2, 2014 at 15:39 Geschrieben March 2, 2014 at 15:39 Thank you for the testing. I think we may remove pm-utils as a dependency and add documentation that indicates that you need pm-utils if you want the Bricks to always behave properly after suspend to disk/ram. If you don't use suspend to disk/ram (like on the RPi) you don't need pm-utils anyway... Zitieren
photron Geschrieben March 4, 2014 at 16:41 Geschrieben March 4, 2014 at 16:41 Robin, I tested this before posting here about RC1. I used a Raspberry Pi here running Raspbian and it worked without problems. The first problem you mentioned is expected if you don't have pm-utils already installed. This is because dpkg doesn't do any dependency handling for your, that's what apt-get is for. dpkg only tells you what dependencies are missing and you have to install them manually. The second error is unexpected and I didn't encounter it during testing. Also this dosen't look to me as dpkg is rejecting the installation because the hardware might not support suspend. pm-utils is just a bunch of scripts that allow to forward suspend/resume events. I think the pm-utils dependency will stay as it is, because your second problem looks like an apt-get hiccup to me and not like a general problem. Anyway, thanks for testing Zitieren
The_Real_Black Geschrieben March 8, 2014 at 12:41 Geschrieben March 8, 2014 at 12:41 I put the JS File into Eclipse (JS View) and got the following two Errors just for information if there is a problem or Bug in it. Version from "2014-02-26" - The left-hand side of an assignment must be a variable Tinkerforge.js function assert (test, message) { if (!test) throw new Error(message || 'Failed assertion') } },{"base64-js":55,"ieee754":56}],55:[function(require,module,exports){ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - Syntax error on token ",", ArrayLiteralHeader expected after this token Tinkerforge.js // TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; },{}],54:[function(require,module,exports){ var base64 = require('base64-js') var ieee754 = require('ieee754') ------- What IDE are you (all) using for JS development? Zitieren
borg Geschrieben March 9, 2014 at 16:40 Geschrieben March 9, 2014 at 16:40 I just tried it in Eclipse and i get the same two errors. But after formatting the js around that place a little better so it is human-readable i can't find a problem. I think the Eclipse parser is either not able to parse the relatively complex output of browserify or it has problems with ECMA 5. The eclipse i have only seems to be able to understand ECMA 3, while the code might need a ECMA 5 parser. The Javascript for Browser Bindings will only support the (currently) latest Browsers and versions up from here. The latest Firefox, Chrome, Safari and even IE are very standard compliant and compatible regarding JavaScript and Websockets. If you go only 2 or 3 versions down it suddenly becomes a minefield . Zitieren
borg Geschrieben March 13, 2014 at 16:08 Geschrieben March 13, 2014 at 16:08 I would like to introduce an early alpha version of the Web Brick Viewer: http://www.brickv.com It is our attempt to implement a Bick Viewer-like tool with web technologies and new JavaScript for browser bindings. The current version supports Ambient Light, Barometer, Humidity and Temperature Bricklet. If you open http://www.brickv.com your browser will download an index.html and lots of JavaScript. After that everything is done in your browser and on your local PC, there is no communication with the internet whatsoever. You can also find brickv.com on github: https://github.com/Tinkerforge/brickv.com if you download it from there you can just open the index.html with your browser, there is no webserver necessary! This is currently just a small side project to test and debug the JavaScript Bindings in combination with HTML5 and modern browsers. I tried it on the latest versions of Firefox, Chrome/Chromium and IE. In IE you need to allow access to local intranet sites, see last answer here: http://stackoverflow.com/questions/15114279/websocket-on-ie10-giving-a-securityerror. If you want to help us develop a Web Brick Viewer, this is a very easy to understand project! It should be easy to get into. We would appreciate any help. The version that is currently online is compatible to the Brick Daemon release candidate that we released in this thread. Before we make an official release we will add authentication to our protocol and the Brick Daemon, which will then also be added to the Web Brick Viewer. At the moment the Web Brick Viewer is just a side project but the trend seems to go more and more towards smart phones and tablets instead of PCs. This means that it might be necessary for us to create access and configuration possibilities directly from Android/iOS/Windows Phone. So in the future it might become a replacement or supplement for the Desktop Brick Viewer. brickv.com should adjust itself to the resolution of your device (smart phone vs tablet vs PC) and delivery a UI that is best suited for your device. Zitieren
Loetkolben Geschrieben March 13, 2014 at 17:15 Geschrieben March 13, 2014 at 17:15 Perfekt! (Running on FF 27) Just a remark: Using IE 8 seems not to work. The "About" and "Legal Info" Information are not viewable. Because i have no Stack at the IE 8 PC location i can not test the connection. BTW: Do you have a Beta Firmware for Masterbrick which support Web-Sockets? Der Loetkolben Zitieren
borg Geschrieben March 13, 2014 at 17:34 Geschrieben March 13, 2014 at 17:34 I only tested in IE11, it should work in IE10. IE9 and below won't work. We will probably release the JavaScript Bindings with all of the needed updates for brickd/brickv and the firmwares (authentification and so on) in the end of march. So you will have to wait until then . Zitieren
Gast Robin Geschrieben March 13, 2014 at 20:59 Geschrieben March 13, 2014 at 20:59 Great work, but I have problems... When I connect to my raspberry pi only one bricklet is detected. The others are shown but Unknown. I changed the UID of most of these bricklets because I couldn't use enumerate since I have two bricklets of the same type in my stack and I wanted the bricklets to be self evident. The only bricklet which is detected is the temperature bricklet (UID also changed.) I atached a screenshot of the problem. I'm using Firefox 27.0.1. The temperature bricklet is displayed and works as expected. Another thing (just an improvement) would be the connection dialog. It would be more useable if the connection would be open when you hit the Enter Key. Zitieren
borg Geschrieben March 13, 2014 at 21:19 Geschrieben March 13, 2014 at 21:19 @Robin: As i said, the current version only supports Ambient Light, Barometer, Humidity and Temperature Bricklet. It is a very early alpha, i just started the project 4 days ago . Connecting when pressing enter is a good idea. It is a project that you can get into really easy. You can just clone the git, add some small features and make a pull request. After we accept the pull request it will automatically be available on brickv.com. I was hoping to get some help from the community with this project after we officially release the JavaScript Bindings, we will see if it works out . Zitieren
Gast Robin Geschrieben March 14, 2014 at 15:50 Geschrieben March 14, 2014 at 15:50 Oh sorry, I dind't see it. Maybe because I read it on my mobile phone. Currently I have some trouble with my computer but I think I will try to add some bricklets. Edit: I added support for the hall effect bricklet. Currently I'm installing GitHub for Windows so it will take some time until I will upload the files. I attached a screenshot. On the top of the graph should be the value of edge count but I couldn't figure out how to display the value of the bricklet in the graph and show the edge count on the top of the graph. Anyway, it works and it is pretty easy after looking around a bit. Good code Edit2: Done. Zitieren
borg Geschrieben March 16, 2014 at 23:44 Geschrieben March 16, 2014 at 23:44 @Robin: Thanks! I added the edge count as well as options for edge type and debounce. I also pushed it already to brickv.com . Zitieren
Gast Robin Geschrieben March 17, 2014 at 17:05 Geschrieben March 17, 2014 at 17:05 I just made another pull request . . . Added support for Distance US, Distance IR and Linear Poti Bricklet. On the Distance IR tab might be displayed the analog value as well. Zitieren
borg Geschrieben March 17, 2014 at 23:18 Geschrieben March 17, 2014 at 23:18 Thanks again! I will try to add a visual element for the Rotary Poti Bricklet and the configuration functions for the Distance IR Bricklet . Zitieren
Gast Robin Geschrieben March 18, 2014 at 17:29 Geschrieben March 18, 2014 at 17:29 I think my last big pull request: added Analog In, Rotary Poti and Temperature IR Bricklet support. The Temperature IR Bricklet does not show the ambient temperature in the graph. Is it possible to display two lines in one graph? Edit: I think the Web Brick Viewer also should be able to detect updates. Of course it is not possible to flash a new firmware on a brick or blicklet with the Web Brick Viewer but it might display updates with a message such as "Updates available, use your Computers Brick Viewer". The main problem in this case would be that Web BrickV would lose its online independence. Maybe there should be an option in a .js file: search for updates. By default it could be false. Zitieren
Loetkolben Geschrieben March 18, 2014 at 18:23 Geschrieben March 18, 2014 at 18:23 Of course it is not possible to flash a new firmware on a brick or blicklet with the Web Brick Viewer ... Hello Robin, this could be possible if the web-brickv connects to a brickd running on PC. In this case the web-brickv could instruct the brickd to start the commandline-brick-flasher. Der Loetkolben. Zitieren
borg Geschrieben March 18, 2014 at 20:37 Geschrieben March 18, 2014 at 20:37 Bricklet flashing is definitely possible with the web brickv. For Brick flashing we need access to USB devices, which is not directly possible with the browser (It could be done as Loeti says). @Robin: I will add support for more then one graph in to the Graph-class tomorrow. Then it should be possible to display all the graphs that we also use in the normal brickv. Zitieren
Gast Robin Geschrieben March 18, 2014 at 20:50 Geschrieben March 18, 2014 at 20:50 But I think this solution is very unsecure. A crashing browser and nobody knows what happend... Or (again me) a hacker who modifies the software of the ethernet or wifi extension or (maybe in the future) the firmware of the RED Brick just with your webbrowser. There are also some driver issues when Bricks are in bootloader mode (such as being recognized as LEGO NXT) so I think the web browser would be very limited in debugging. The mess would be complete when you try to flash a brick from a remote client. Another problem are the root privileges. Under Ubuntu I have to run BrickV with root privileges to access the USB to Serial Converter in Bootloader mode to flash a Brick. But it would be absolutely inresponsible to run BrickD with root privileges to offer a platform independent flashing solution over the webbrowser. So I think this solution can't be available on every platform which would make such a solution very unstable. Flashing Bricklets might be possible, but I'm not shure if a Web Browser is the right choice to write directly on the hardware. Okay, theres the BrickD which could handle occuring errors but it feels wrong to use a webbrowser. It seems a bit like Scifi for me Zitieren
borg Geschrieben March 18, 2014 at 22:36 Geschrieben March 18, 2014 at 22:36 I think you are wrong in all cases . The possibility to flash Bricklets is always there with the JavaScript Bindings. It just uses our normal API. We will add authentication before we release the JavaScript Bindings to be save in that regard. Regarding the stability for flashing Bricklets: The web brickv can flash Bricklets exactly the same way as the normal brickv. There is really no difference, you can pick the file to flash from you local storage and flash it to the Bricklet without using the Internet in any way or form. If you want to fetch the current firmware from our server it can do that and then flash the Bricklet without internet access (exactly the same way that the normal brickv does it). I can't see why it would be worse in some way. I bet that all of the latest browsers are way more stable then our hacked together Brick Viewer . To flash the Bricks without using root you can add your user to the group "dialout". Zitieren
Gast Robin Geschrieben March 19, 2014 at 20:27 Geschrieben March 19, 2014 at 20:27 Okay, you got me. I'm currently adding Ananlog Out support to BrickV. But I have some trouble with the setMode function. When I set the mode, it seems that it isn't applied. Instead of setting the new mode the mode is resettet to normal mode. If I change the mode in the desktop BrickV the value is stored. I called: this.ao.setMode(1); which didn't work as well as this.ao.setMode(Tinkerforge.BrickletAnalogOut.MODE_1K_TO_GROUND); Is this an error in the binding or did I make some silly mistake? As I understood it is up to me if I use an integer or the constant because the constant just stores the integer and improves the readabilty of the code? Zitieren
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.