billhsu / jUART

Cross platform browser plugin for serial port communication from JavaScript
202 stars 76 forks source link

ReferenceError: plugin is not defined #45

Open oshihirii opened 8 years ago

oshihirii commented 8 years ago

Environment:

Firefox 48 for Ubuntu

I've followed these steps in README.md:

//Get a Serial object
var ser = plugin().Serial;

// Open a port
ser.open("/dev/ttyACM0");

// Set port options
var baud = 9600;
var parity = 0;
var csize = 8;
var flow = 0;
var stop = 0;

ser.set_option(baud, parity, csize, flow, stop);

// Send a byte to serial port
char = "";

ser.send(char);

Did I need to take any other steps?

Do I have to "build it"?

When I run the HTML file, Firebug says:

ReferenceError: plugin is not defined

billhsu commented 8 years ago

@oshihirii can you try copying the plugin into other folders where they mentioned in this post http://askubuntu.com/questions/383960/where-is-firefoxs-plugins-directory? If still not working, you may recompile the binary on your machine.

oshihirii commented 8 years ago

Thank you for your reply!

I thought the project might be dead!

As per the accepted answer in your link:

~/.mozilla/plugins - does not exist in Ubuntu 16.04 xenial (x86-64).

The only directories that are in ~/.mozilla/ are:

extensions
firefox

Bu I followed a user comment and saw this exists, so I put /usr/lib/mozilla/plugins/npjUART.so in there:

/usr/lib/mozilla/plugins

And I get the same error after restarting Firefox and opening the HTML page:

ReferenceError: plugin is not defined

I have never "compiled a binary".

Can you please give me exact steps (as much detail as possible appreciated, as I have zero knowledge about it so I may miss some important steps if I'm not shown how to do it exactly). Thank You!

billhsu commented 8 years ago

@oshihirii There's no active development on this plugin currently because NPAPI-Plugins are not supported by chrome from version 45.0.

For compilation of the plugin, please follow the steps in README.md.

    1. Install FireBreath
    2. Run python fbgen.py in firebreath-dev, please set "Plugin Name" to jUART
    3. Goto firebreath-dev/projects, delete the jUART directory
    4. Same in firebreath-dev/projects, run git clone git@github.com:billhsu/jUART.git
    5. Linux: ./prepmake.sh Mac: ./prepmac.sh
    6. Linux:cd build/ then make
oshihirii commented 8 years ago

Thank you for the information.

Do you know anything else that does the same job?

I need to communicate from web page to local serial port.

I was using pyserial (mine is a python based web application) but that only works locally - not from a "live" website.

I looked at:

http://www.firebreath.org/display/documentation/Download

and downloaded the zip file.

How do I do Step 1 of the steps in your README.md ie "Install FireBreath"?