After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660276 - BSD port
BSD port
Status: RESOLVED OBSOLETE
Product: moserial
Classification: Other
Component: general
3.0.x
Other All
: Normal normal
: ---
Assigned To: moserial-maint
moserial-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-27 18:31 UTC by Jasper Lievisse Adriaanse
Modified: 2020-11-25 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add some bsd device files (836 bytes, patch)
2011-09-27 18:43 UTC, Jasper Lievisse Adriaanse
reviewed Details | Review

Description Jasper Lievisse Adriaanse 2011-09-27 18:31:00 UTC
Currently moserial has hardcoded values for what reasonable names are for serial ports...on Linux. Would patches be accepted to allow for BSD device names too?

Currently my patches are for the generated C files using #ifndef __linux__, how would one use something like that in vala, or can I just use the same construct and let the C compiler figure out what to do?
Comment 1 Michael Chudobiak 2011-09-27 18:39:26 UTC
Please patch SettingsDialog.vala.

You just need to expand this section:

        private void populateDevices(){
                List<string> deviceTypes = new List<string> ();
                deviceTypes.append ("/dev/ttyS");
                deviceTypes.append ("/dev/ttyUSB");
                deviceTypes.append ("/dev/rfcomm");
                ... add your BSD stuff here ...


You shouldn't need ifdefs - nonexistent ports are ignored, so the BSD-specific stuff shouldn't show up when running on Linux, and vice versa.

- Mike
Comment 2 Jasper Lievisse Adriaanse 2011-09-27 18:43:32 UTC
Created attachment 197595 [details] [review]
Add some bsd device files
Comment 3 Jasper Lievisse Adriaanse 2011-09-27 18:44:30 UTC
Also, patching Settings.vala to change DEFAULT_DEVICEFILE isn't needed either with these changes?
Comment 4 Michael Chudobiak 2011-09-27 18:50:53 UTC
I think

deviceTypes.append ("/dev/cua0");

should be

deviceTypes.append ("/dev/cua");

because moserial appends and tests 0..31 automatically. Your code would start testing at "/dev/cua00" (two zeroes). Right?

I have to check into the DEFAULT_DEVICEFILE issue.

- Mike
Comment 5 Jasper Lievisse Adriaanse 2011-09-27 18:52:55 UTC
Right, that should indeed be /dev/cua, Ill update it before pushing, ok?
Comment 6 Michael Chudobiak 2011-09-27 18:56:25 UTC
If you have commit access, go ahead and push those two lines.

- Mike
Comment 7 Jasper Lievisse Adriaanse 2011-09-27 19:02:16 UTC
Done ;-)
Comment 8 Michael Chudobiak 2011-09-27 19:06:29 UTC
Thanks for the patch!

Regarding DEFAULT_DEVICEFILE: it is OK to leave it as-is. That will result in a non-existent-port setting the first time the user runs moserial on BSD, but moserial will remember the last-used port on later runs, so it should be OK.

If you really wanted to, you might be able to add BSD-specific #ifdefs to the vala code (https://live.gnome.org/Vala/ConditionalCompilationSample), so that "/dev/cua0" was the BSD default. I haven't tried that.

- Mike
Comment 9 Jasper Lievisse Adriaanse 2011-09-27 19:11:10 UTC
I think it's ok to leave that as is for now, especially since it's only an "issue" at the first start.

Finally, moserial supports several non-standard baud rates, which only seem to be defined on Linux. Right now I have a block like this in the C code:

/* Add defines for various non-standard speeds. */
#ifndef B460800
#define B460800 460800
#endif

Is there a similar construct that can be used in the src/SerialConnection.vala source?
Comment 10 Michael Chudobiak 2011-09-27 19:25:43 UTC
I'm not sure how that should be handled.

It MIGHT be possible to add a check for BSD in configure.ac, and then use conditional compilation in the vala code. Something like

#if ! IS_BSD
                case 1000000:
                        baudRate=Linux.Termios.B1000000;
                        break;
#endif

where IS_BSD is from a test in configure.ac. But I've never tried that...

Does Linux.Termios.CRTSCTS work in BSD? That flag enables hardware handshaking. It would be a major annoyance if that didn't work in BSD.

- Mike
Comment 11 Jasper Lievisse Adriaanse 2011-09-27 19:27:46 UTC
Yep, that works as it's standard. The baudrates that were added were non-standard and as such not supported in our termios.h.