nicolaiev / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 0 forks source link

Serial Monitor Input Field not updating - solution included #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Continuously sending from the Gertboard's Atmel to the Raspberry
2. Opening http://.../app/serial-monitor
3. The input of the serial port does not show up though sending works (i.e. the 
config file has ttyAMA0 enabled and webiopi was called with the -c <configfile> 
switch)

WebIOPi version used?
=> Latest git read-only checkout version as of 09/05/2013

Python version used?
=> Python 2.7.3 (default, Jan 13 2013, 11:20:46) 
[GCC 4.6.3] on linux2

Distro used? (WebIOPi has only been tested on Raspbian Wheezy)
=> 2013-02-09-wheezy-raspbian.zip

Raspberry Pi board revision? (1 or 2)
=> 2

For Javascript side bugs, Browser?
=> firefox, linux

Please provide any additional information below.

The response type for GET in the read function has not been defined, therefore 
the function returned an XML Document instead of a file. 
Adding

from webiopi.decorators.rest import request, response

and the @response line in:

    @request("GET", "")
    @response("%s") 
    def read(self):

Solves the problem. Attached, the changed file.

Thanks for your great work on webiopi!

Original issue reported on code.google.com by Marcus.B...@gmail.com on 9 May 2013 at 6:55

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
First of all, thank you very much for your great product. 

Second : even after making this change, I still can't get my Serial-Monitor to 
show me the serial data that comes in.

Any ideas on what I would need to check ?

Thx.

Original comment by dt.photo...@gmail.com on 29 Aug 2013 at 1:08

GoogleCodeExporter commented 8 years ago
Hi,

it is difficult to judge your progress in debugging from your question. So, 
unfortunately, I can only explain how I tackled the problem.

Before trying with webiopi, I made sure that my serial communication worked 
flawlessly with the terminal program "minicom" and that I was also able to 
read/write with simple "cat" commands after the serial interface was configured 
(baudrate, parity, etc.). It's some time ago, so I do not remember whether I 
changed something in the /etc/webiopi/config configuration file (I definitely 
activated the serial0 line) and/or changed the permissions on the /dev/ttyAMA0 
(I started by launching the project as root anyway). For further debugging, I 
launched webiopi as foreground process and started debugging by adding 
logger.info("message") lines in the python code to see where the problem might 
be located.

Best regards,
Marcus

Original comment by Marcus.B...@gmail.com on 29 Aug 2013 at 8:19

GoogleCodeExporter commented 8 years ago
Hi Marcus,

Thx for your input. I already double checked the serial communication and have 
even built code for 2 status-leds that react differently, depending on which 
command the RPi receives back via serial-connection. All of this works 
perfectly.

Yesterday, I was testing my interface on my smartphone, which uses 
Dolphin-browser and by coincidence I noticed that the Serial-monitor field, 
which I adapted a bit to my own interface (just formatting and size) was 
working just fine. It nicely displayed all information, I expected to be there.
Went back to my PC and laptop, opened FireFox, but it still didn't work. Opened 
up IE on both and it worked just nicely. I've been a FireFox user since the 
first moment, and this is one of the first times that I run into a problem, 
where something doesn't work on FF but it works on IE.
Will have to look into that.

Best regards,

David

Original comment by dt.photo...@gmail.com on 31 Aug 2013 at 6:27

GoogleCodeExporter commented 8 years ago
Hi David,
I experienced the same problem with ttyUSB0. In my environment, IE uses the so 
called compatibility mode by default. FF interprets the first line of an html 
file very strictly – at least I didn't find any compatibility settings, 
because it was too late at night or in the morning or so. Hence, I decided to 
have a closer look at the jquery environment. Looking at the distributed 
jquery.js I found out it is a rather outdated version 1.8.2 (for some pretty 
good reasons I think). May be it's a good idea to apply some updates …
I used sudo nano /etc/webiopi/config to make some changes to use my private 
test environment:
#------------------------------------------------------------------------#
[HTTP]
# HTTP Server configuration
enabled = true
port = 8000
# File containing sha256(base64("user:password"))
# Use webiopi-passwd command to generate it
# passwd-file = /etc/webiopi/passwd

# Use doc-root to change default HTML and resource files location
doc-root = /home/pi/WebIOPi-0.6.0/htdocs
# Use welcome-file to change the default "Welcome" file
welcome-file = index.html
#------------------------------------------------------------------------#
# :
# :
# :
#------------------------------------------------------------------------#
[DEVICES]
# :
# :
# :
# USB serial adapters
usb0 = Serial device:ttyUSB0 baudrate:9600
#usb1 = Serial device:ttyACM0 baudrate:9600
# :
# :
# :
#------------------------------------------------------------------------#
end of /etc/webiopi/config changes

The following files were downloaded from http://code.jquery.com/jquery/ 
sections jQueryCore and jQueryMobile, copied to /home/pi/WebIOPi-0.6.0/htdocs 
on the PI and renamed accordingly later.
The original files were deleted - you may want to backup them before deletion 
:-) for any purpose
jquery.mobile-1.3.2.min.css => jquery-mobile.css
jquery.mobile-1.3.2.min.js => jquery-mobile.js
jquery-2.0.3.min.js => jquery.js

Now I stopped and restarted the WebIOpi service
sudo /etc/init.d/webiopi stop
sudo /etc/init.d/webiopi start

The serial monitor works now fine with IE 10.0.9200.16660 and FF 23.0.1 both 
under Win7. However, there are some more back-compatibility drawbacks and 
issues according to http://jquery.com/browser-support/. Watch this carefully!
I didn't test more because it does the job in my environment :-) so it's up to 
you to do more ...
May be this helps to solve the other serial issues too

Best regards

Karl-Heinz

Original comment by DC4PC...@gmail.com on 5 Sep 2013 at 2:37

GoogleCodeExporter commented 8 years ago
I admit I tested the Serial Monitor only with Chrome.

Original comment by tro...@trouch.com on 27 Nov 2013 at 9:37

GoogleCodeExporter commented 8 years ago

Original comment by tro...@trouch.com on 4 Jan 2014 at 9:00

GoogleCodeExporter commented 8 years ago

Original comment by tro...@trouch.com on 4 Jan 2014 at 9:01

GoogleCodeExporter commented 8 years ago
Issue 79 has been merged into this issue.

Original comment by tro...@trouch.com on 28 Jan 2014 at 9:10

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1412.

Original comment by tro...@trouch.com on 28 Jan 2014 at 11:13