Skip to content

Commit

Permalink
Upgrade Dart and Flutter target, fix Termiox and bumped sigrok libser…
Browse files Browse the repository at this point in the history
…ialport to latest main (#99)

* Update config.h

* merged 3.0 changes with branch

* Updated disabled termios support

* Changing the termiox definition as an experiment.

* Removed termiox support from android,

* resolved issue for android.

* Restored all .gitignore files which got removed during fork.

* feat: bumped serial port source code to latest master available on sigrok

---------

Co-authored-by: ajeeshklr <ajeeshklr@gmail.com>
  • Loading branch information
lucafabbri and ajeeshklr authored Feb 21, 2024
1 parent e9c1fd9 commit b23ff33
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.0

* Upgrade to Dart 2.17, Flutter 3.0, libserialport 0.3

## 0.2.3

* Fix linux builds for newer kernels (thanks @sitic)
Expand Down
2 changes: 1 addition & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
/.idea/libraries
.DS_Store
/build
/captures
/captures
2 changes: 1 addition & 1 deletion android/libserialport/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/* #undef HAVE_STRUCT_TERMIOS_C_OSPEED */

/* Define to 1 if the system has the type `struct termiox'. */
#define HAVE_STRUCT_TERMIOX 1
#undef HAVE_STRUCT_TERMIOX

/* sys/file.h is available. */
#define HAVE_SYS_FILE_H 1
Expand Down
2 changes: 1 addition & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ lib/generated_plugin_registrant.dart
app.*.symbols

# Obfuscation related
app.*.map.json
app.*.map.json
2 changes: 1 addition & 1 deletion example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ version:
revision: 707aa49e42db746a8f4528e4700fb9017c5969d8
channel: master

project_type: app
project_type: app
2 changes: 1 addition & 1 deletion example/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
key.properties
2 changes: 1 addition & 1 deletion example/linux/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
flutter/ephemeral
flutter/ephemeral
2 changes: 1 addition & 1 deletion example/macos/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
**/Pods/

# Xcode-related
**/xcuserdata/
**/xcuserdata/
2 changes: 1 addition & 1 deletion example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :osx, '10.11'
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
11 changes: 6 additions & 5 deletions example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -203,7 +203,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "The Flutter Authors";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down Expand Up @@ -256,6 +256,7 @@
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -407,7 +408,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -490,7 +491,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -537,7 +538,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion example/windows/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ x86/
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
!*.[Cc]ache/
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: flutter_libserialport
description: A simple wrapper around libserialport utilizing Flutter's
build system to build and deploy the C-library for the target platform.
version: 0.2.3
version: 0.4.0
homepage: https://github.com/jpnurmi/flutter_libserialport
repository: https://github.com/jpnurmi/flutter_libserialport
issue_tracker: https://github.com/jpnurmi/flutter_libserialport/issues

environment:
sdk: '>=2.12.0 <3.0.0'
flutter: '>=1.20.0'
sdk: ">=2.17.0 <4.0.0"
flutter: ">=3.0.0"

dependencies:
flutter:
sdk: flutter
libserialport: ^0.2.0+3
libserialport: ^0.3.0

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion third_party/libserialport/README
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Mailing list
IRC
===

You can find the developers in the #sigrok IRC channel on Freenode.
You can find the developers in the #sigrok IRC channel on Libera.Chat.

Website
=======
Expand Down
2 changes: 1 addition & 1 deletion third_party/libserialport/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ AC_SYS_LARGEFILE
AC_TYPE_SIZE_T

# Check for specific termios structures.
AC_CHECK_TYPES([struct termios2, struct termiox],,,
AC_CHECK_TYPES([struct termios2],,,
[[#include <linux/termios.h>]])
AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed,
struct termios2.c_ispeed, struct termios2.c_ospeed],,,
Expand Down
3 changes: 3 additions & 0 deletions third_party/libserialport/libserialport_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
#include <IOKit/serial/ioss.h>
#include <sys/syslimits.h>
#include <mach/mach_time.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000 /* Before macOS 12 */
#define kIOMainPortDefault kIOMasterPortDefault
#endif
#endif
#ifdef __linux__
#include <dirent.h>
Expand Down
4 changes: 2 additions & 2 deletions third_party/libserialport/macosx.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
if (!(classes = IOServiceMatching(kIOSerialBSDServiceValue)))
RETURN_FAIL("IOServiceMatching() failed");

if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
if (IOServiceGetMatchingServices(kIOMainPortDefault, classes,
&iter) != KERN_SUCCESS)
RETURN_FAIL("IOServiceGetMatchingServices() failed");

Expand Down Expand Up @@ -210,7 +210,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
}

DEBUG("Getting matching services");
if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
if (IOServiceGetMatchingServices(kIOMainPortDefault, classes,
&iter) != KERN_SUCCESS) {
SET_FAIL(ret, "IOServiceGetMatchingServices() failed");
goto out_done;
Expand Down
18 changes: 14 additions & 4 deletions third_party/libserialport/serialport.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,15 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
RETURN_CODEVAL(ret);
}

/*
* Assume a default baudrate if the OS does not provide one.
* Cannot assign -1 here since Windows holds the baudrate in
* the DCB and does not configure the rate individually.
*/
if (config.baudrate == 0) {
config.baudrate = 9600;
}

/* Set sane port settings. */
#ifdef _WIN32
data.dcb.fBinary = TRUE;
Expand Down Expand Up @@ -633,7 +642,8 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
data.term.c_cc[VTIME] = 0;

/* Ignore modem status lines; enable receiver; leave control lines alone on close. */
data.term.c_cflag |= (CLOCAL | CREAD | HUPCL);
data.term.c_cflag |= (CLOCAL | CREAD);
data.term.c_cflag &= ~(HUPCL);
#endif

#ifdef _WIN32
Expand Down Expand Up @@ -876,7 +886,7 @@ SP_API enum sp_return sp_blocking_write(struct sp_port *port, const void *buf,
unsigned char *ptr = (unsigned char *) buf;
struct timeout timeout;
fd_set fds;
int result;
ssize_t result;

timeout_start(&timeout, timeout_ms);

Expand Down Expand Up @@ -1081,7 +1091,7 @@ SP_API enum sp_return sp_blocking_read(struct sp_port *port, void *buf,
unsigned char *ptr = (unsigned char *) buf;
struct timeout timeout;
fd_set fds;
int result;
ssize_t result;

timeout_start(&timeout, timeout_ms);

Expand Down Expand Up @@ -1204,7 +1214,7 @@ SP_API enum sp_return sp_blocking_read_next(struct sp_port *port, void *buf,
size_t bytes_read = 0;
struct timeout timeout;
fd_set fds;
int result;
ssize_t result;

timeout_start(&timeout, timeout_ms);

Expand Down
2 changes: 1 addition & 1 deletion windows/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ x86/
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
!*.[Cc]ache/

0 comments on commit b23ff33

Please sign in to comment.