Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the ubuntu platform. #25

Merged
merged 1 commit into from
Feb 18, 2015

Conversation

hexluthor
Copy link
Contributor

No description provided.

}

static const QString fullID() {
return "org.stereolux.cordova.serial";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you change it to fr.drangies.cordova.serial?

@xseignard
Copy link
Owner

Hello,
That seems a great addition! Thanks!
But I don't have any ubuntu device, so I can't test :)

Anyway, if you tell me it works, it's ok to merge, since it will be a starting point for other to test!

Thanks again,

Regards

@hexluthor
Copy link
Contributor Author

Yes it does work, at least on my Ubuntu Desktop system. Thanks in advance for merging it!

xseignard added a commit that referenced this pull request Feb 18, 2015
Add support for the ubuntu platform.
@xseignard xseignard merged commit 9bfc431 into xseignard:master Feb 18, 2015
@xseignard
Copy link
Owner

Oh, I was thinking it was for ubuntu phones, if it's for desktop I will test it!

@hexluthor
Copy link
Contributor Author

My hope is that it will work on both Ubuntu Phone and Desktop, but so far I have tested it only on Desktop.

@ChoseKurosa
Copy link

@hexluthor Hello,
It is very nice extension for this plugin, but it doesn't work for me. Can u write small exmaple of requestPermision, open and write because exmaple from android version is not working. Should I pass vid and pid too ? I am using device which has two interfaces data and control, probably using ttyACM0 instead of ttyUSB0, is it this problem ? How can i see error messages from callback function? I would really appreciate help.

@hexluthor
Copy link
Contributor Author

Hi @ChoseKurosa. I don't think requestPermission() will really matter under Ubuntu Desktop. That's more of a smartphone thing. My plugin assumes that the Linux kernel has already enumerated the serial device as e.g. /dev/ttyUSB0 so specifying the VID/PID won't help. You have a different device name so you'll need to specify that: serial.open({device: "/dev/ttyACM0"});. Error messages should appear as the first parameter to your errorCallback().

Two interfaces will be tough, as I believe this library only supports one serial port.

I suspect you might be experiencing a permission problem. Under Ubuntu you probably need to be a member of the dialout group to access the serial devices. Confirm that your user account can access the device using, for example cutecom.

@ChoseKurosa
Copy link

var errorCallback = function (message) { alert('Error: '+message); }; var succCallback = function (message) { alert('succ: ' + message); };
serial.write('CONNECT\tREQ\n',succCallback, errorCallback);

For e.g. this implementation is working well on android, but nothing happens in ubuntu (using console.log()). In some cases message is undefined.
Cutecom can open device but device is not responding after sending command. I am member of the dialout. I have already specified in serial.cpp: serial.open({device: "/dev/ttyACM0"});.

serial.requestPermission( function(successMessage) { console.log("Opening port!"); $rootScope.serial.open( {baudRate: 9600}, function(successMessage) { }, errorCallback); }, errorCallback );

It is strange because even in this case console.log doesn't show. I think my implementation is bad but i don't know how it can work. Also cutecom should work as well.

@hexluthor
Copy link
Contributor Author

One thing to be aware of is that Linux allows multiple processes to open the same serial port simultaneously but only one will actually receive incoming data. Disconnecting and reconnecting the USB cable should close any other processes vying for the same port.

Try to figure out why cutecom isn't working. Check your wiring. If cutecom doesn't work, cordovarduino will never work.

@ChoseKurosa
Copy link

Encoding for sending data to my device should be windows 1250. Do you think that this can be the problem ?

@hexluthor
Copy link
Contributor Author

I doubt it. For plain text, Windows-1250 shouldn't be any different. If the device is expecting wide (16-bit) characters, that could be a problem.

You mentioned that you have it working on Android. Can you connect the transmit wire from the Android device to the receive pin on the Ubuntu desktop? Then you can confirm exactly what bytes are being transmitted by Android. cutecom has a handy "Hex output" mode.

If you have a spare UART, you can then repeat the same test under Ubuntu with one UART looped-back to the other and examine what bytes are being transmitted, if any. With proper wiring you should be able to run two cutecoms simultaneously and type messages between them.

@ChoseKurosa
Copy link

Cutecom is sending data in bad way. I think i have a problem with this plugin installation and implementing because even errorCallback are not calling. I think methods in serial.cpp is not call either. I did whole installation according to the instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants