Jump to content

Welcome, Guest!

Tripitaka

Advice on approaching a project

Recommended Posts

Hi,

I'm not new to RPi and I've done a little batch scripting and VBA over the years. I use Ubuntu frequently and I'm comfortable at command prompts and batch scripts etc. However, I've never scripted Linux and I have a little project to complete in fairly short order, so all help would be very welcome to get me on the right tracks.

 

I volunteer as a firefighter and we are currently rolling out the iamresponding.com system in my department. I want to build an RPi for the simple task of hooking up to our WiFi network so it will boot, start a browser and log us in to our iamresponding.com account to display our portal page.

 

I haven't yet started to look at the script required and have no idea where the difficulty lies between "Oh, thats real easy...just do X,Y and Z!" to "Ain't gonna happen, son! No way to achieve that through a script - you'll have to do it all manually!"

 

Any guidance on direction, approach, resources etc would be very, very welcome. Once I have it down, I'd like to submit the method to the community so it can be used by other fire departments and emergency organisations, even going as far as feeding it back to the developers of iamresponding to provide through their website and materials.

 

Thanks in advance for any help,

 

Mark.

Share this post


Link to post
Share on other sites

Hi

 

If you haven't already, I would suggest you use the latest Raspbian (or distribution of your choice) and test out the web browser compatibility with the iamresponding service. Once you have a browser that works, I think are a few of us around that can help with the project.

Share this post


Link to post
Share on other sites

as for your project, I think it is achievable. the X system can be started automatically, as can an application - basically you want to set up the system in a "kiosk" mode .... now the only part I'm a little uneasy on is the auto-login of the system to the iamresonding system - if the system does an autologin, there could be security problems if the unit is stolen, or compromised

 

Is this for a display panel in the firehall ?

 

Will it be view only ? Or will you need to interact with the system ?

 

If its a view only display panel, Is there a readonly imaresponding account that could be used? Or do you only get the one admin style account ?

Share this post


Link to post
Share on other sites

Thanks scbenoit!

 

Yes, the unit will be used in a very simple form, to drive a kiosk-style display at the firehall. I'm not too worried about the security aspect because there are a few ways around it and I'd almost certainly create a view-only account in any event. It can easily be shut down if compromised and we have way more valuable stuff in the firehall than this, but I understand and appreciate your point.

 

I'll read the links, get to browser level and report back here.

 

Thanks again!

Share this post


Link to post
Share on other sites

Some really interesting stuff in those links!

 

I've got the system up and running, using matchbox and Midori but I think that the difficulty will be in the backend iamresponding system. I can feed a URL from the script to Midori but then IAR cannot decide if I want a desktop or mobile site so I get a prompt page that asks me. Once past that, I get the login screen which opens in a new tab and then even if I manually enter my details, it doesn't switch pack to the main screen.

 

Much of the site is java-based so I have emailed the site developers to determine if I can pass the requirement for a desktop site (rather than mobile) AND the login credentials via a URL. If not, I suspect that it might be possible through a java script but I have zero experience with java programming.

 

I'm further along than I thought I would be so many thanks for the help so far!

 

Mark.

Share this post


Link to post
Share on other sites

Well, I managed to get quite good progress on the back of the info that you shared here. I can get what I deem to be as far as possible using Midori but I cannot seem to get Chrome to run as an alternative without running the window manager. I've some more testing to do but I've not had lots of time. I can get Raspbian to boot and load Midori to a URL without intervention but some of what I need is reliant on some work the devs are doing on the back-end of the iamresponding.com site to permit auto-login and kiosk applications which will apparently take a month or so. I'm looking forward to seeing it in action - the screens are up in the equipment bays at the station and I ordered the Pi's today. Will be very cool and a big step forward for us as a volunteer department.

Share this post


Link to post
Share on other sites

I'm at my wits end trying to get Chromium to run from a command line.

 

I've installed via sudo apt-get install chromium-browser and the install went OK. What I now want to do is run the browser from the command line without starting the default desktop manager. I can do it with Midori by using the lightweight 'matchbox' manager but typing 'chromium -kiosk' just gives me a GTK+ error.

 

The problem that I'm trying to solve is that the back-end site I'm accessing cannot tell whether Midori is a desktop or mobile client from the User Agent report; I'm hoping that Chrome might address that issue.

 

In a nutshell, can anyone suggest how I would go from the command prompt to a web browser with a defined URL using Chrome via script?

Share this post


Link to post
Share on other sites

Regarding Midori, here are some details on how to change the user agent string

 

in your users home directory should be a dir called .config and yep, the dot is there in front of the config ( the dot hides the dir from regular directory listing)

 

in the user' s ./config dir should be another called midori for the browser settings etc

 

in this dir ( usershomedir/.config/midori , ig /home/pi/.config/midori ) is a file called config

 

open the file named config in your favourite text file editor, and there is likely only a [settings] section in it, check the [settings] section and add/change the lines for identify-as and user-agent

 

[settings]

...various lines ...

identify-as=MIDORI_IDENT_CUSTOM

user-agent=Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-gb) AppleWebKit/535+ (KHTML, like Gecko) Version/5.0 Safari/535.22+ Midori/0.4

Share this post


Link to post
Share on other sites

Thanks for the tip! I tried the lines you gave me but I still get the same screen. I think that the key will lie with the back-end guys but they aren't the most communicative bunch. If I'm honest, the whole site setup is like something from the late '90's on Netscape Navigator, I don't think the concepts of HTML5 have reached them yet.

 

I've got the screens up and running at the stations so it is doing it's job but there are a lot of improvements to be made in the interface.

 

I do really appreciate the help so far though.

Share this post


Link to post
Share on other sites

no problem, glad to help , perhaps you should try a couple of different user-agent strings - these are settable from within the browser itself, in the preferences setting

 

you could try having it send a user-agent string from an Explorer browser for example.

 

I'll have a peak at Chromium and your autostart over the next couple of days - did you try to list it as an autostart item in your window manager and then just start your window manager from the cmd line ?

Share this post


Link to post
Share on other sites

I followed some of the other links you gave earlier and run a script from the prompt which starts matchbox window manager and just Midori in fullscreen on top of that. Once I get the autologin working, I'll add a loop in there to restart the browser if it crashes and autorun the script so if anything goes south, all that will be required is to unplug the Pi and plug it back in again.

 

I'll dig out a user agent string from IE on a Windows box I use for work. It's the only one in the house! ;-)

Share this post


Link to post
Share on other sites

umm - you mentioned typing in 'chromium -kisok' and getting a gtk error - was that at the cmd prompt ?

 

did you try creating a file called testfile.txt that contains

#!/bin/sh

matchbox-window-manager &

chromium -kiosk

 

and then issue the commend

xinit testfile.txt

 

or

 

sudo xinit testfile.txt

 

Share this post


Link to post
Share on other sites

hi again

 

how about this, power on pi, and from the command lien with no window manager running

 

startx /usr/bin/chromium -kiosk http://some.url.here/

 

on my test jig here it fires up the full window manager with Chromium as the main and only app and opens the URL specified

 

ALT-F4 closes the browser (and window manger) dumping you back to cmd line

 

does that work on yours ?

Share this post


Link to post
Share on other sites

so I tried your target website and it comes up with a select platform screen - ie mobile vs desktop

 

have you had chrome running on your setup and it worked ? I'm going to try a user-agent string option and see if we can get past that, or have you already worked this out with chrome

Share this post


Link to post
Share on other sites

Chrome on any platform other than the Pi doesn't get that screen so I'm wondering if there is something else they are grabbing at the back end of the site to define the platform other than the UserAgent string. The devs aren't very forthcoming. My alternative approach is to see if they will give me a string for the URL that will bypass this page and define the device as desktop via the URL.

I'll try and do something on it over the weekend and let you know.

On another issue - what would I need to do to assign an IP during boot on Wheezy rather than using DHCP? I think I'm having an issue with DHCP leases timing out and I want to head that one off at the pass. I've got the networks configured using the WiFi Config utility in the GIU which in turn has written to the wpa_configuration file rather than /etc/network/interfaces

I'll admit I haven't researched yet through lack of time.

Share this post


Link to post
Share on other sites

well, a little progress here - use startx to fire up the regular window manager

 

then open a command prompt , the LXTerminal

 

at the terminal prompt try this command as it is

 

 

chromium --user-agent="Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17"

 

this allowed me to view the website with out the select platform issue

 

I tried to add this to /etc/chromium/default but am having problems with the syntax trying to escape the special characters in the string

Share this post


Link to post
Share on other sites

So, it looks like it is the user-agent string - I just can not find a way to set it in the cfg file or a script where it doesn't get mangled up - I'll look at it more over the weekend (we're getting a snow storm so won't be going far)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

About Us

Bringing you the latest Raspberry Pi news, tutorials and user forum.

The Fruity Computer

×