Git Product home page Git Product logo

Comments (10)

lvsecoto avatar lvsecoto commented on August 19, 2024 2

The example code in this repo doesn't use serialPort.open. I tried putting serialPort.configure after final port = SerialPort(address); but still ran into the same issue. What's weird is refreshing the app made it sometimes work, but most of the time threw the same error. I'll keep playing around on my end though.

Try this

final port = SerialPort(address);
port.open(...);
port.configure =...

from flutter_libserialport.

ehagerty avatar ehagerty commented on August 19, 2024 1

Hi, thanks so much for this package and the example!

Forgive me for being thick:

port.open(...);
port.configure =...

Can someone point me at a tutorial to help me learn what the obvious replacement is here for the '...' ellipsis?

Stay safe out there :-)

from flutter_libserialport.

lvsecoto avatar lvsecoto commented on August 19, 2024

I got the same issues. Failed to open port,and it return –2.

from flutter_libserialport.

lvsecoto avatar lvsecoto commented on August 19, 2024

I have found the solution, set serialPort.configure after serialPort.open

from flutter_libserialport.

jpnurmi avatar jpnurmi commented on August 19, 2024

@lvsecoto Thanks for spending the time to figure it out! Sounds like that an assertion could help to catch the problem.

from flutter_libserialport.

 avatar commented on August 19, 2024

The example code in this repo doesn't use serialPort.open. I tried putting serialPort.configure after final port = SerialPort(address); but still ran into the same issue. What's weird is refreshing the app made it sometimes work, but most of the time threw the same error. I'll keep playing around on my end though.

from flutter_libserialport.

LiveRock avatar LiveRock commented on August 19, 2024
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following SerialPortError was thrown while handling a gesture:
Invalid argument, errno = 22

When the exception was thrown, this was the stack:
#0      Util.call (package:libserialport/src/util.dart:39:7)
#1      Util.toInt (package:libserialport/src/util.dart:77:16)
#2      _SerialPortImpl.busNumber (package:libserialport/src/port.dart:284:17)
#3      new SerialPortDataSource.<anonymous closure> (package:vt_meter_app/sections/meters/meters.dart:301:40)
#4      MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#5      ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#6      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#7      new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#8      new List.of (dart:core-patch/array_patch.dart:50:28)
#9      ListIterable.toList (dart:_internal/iterable.dart:212:44)
#10     new SerialPortDataSource (package:vt_meter_app/sections/meters/meters.dart:303:10)
#11     masterPaneMeters.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:vt_meter_app/sections/meters/meters.dart:166:60)
#12     State.setState (package:flutter/src/widgets/framework.dart:1088:30)
#13     masterPaneMeters.<anonymous closure>.<anonymous closure> (package:vt_meter_app/sections/meters/meters.dart:161:53)
#14     _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
#15     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#16     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607:11)
#17     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
#18     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7)
#19     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
#20     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:443:20)
#21     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#22     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:287:11)
#23     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#24     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#25     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#26     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#30     _invoke1 (dart:ui/hooks.dart:182:10)
#31     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7)
#32     _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
(elided 3 frames from dart:async)

I am still getting this error. What I want to do is just tor refresh the serial port list with
availablePorts = SerialPort.availablePorts;

from flutter_libserialport.

SerendipityMatthew avatar SerendipityMatthew commented on August 19, 2024

The example code in this repo doesn't use serialPort.open. I tried putting serialPort.configure after final port = SerialPort(address); but still ran into the same issue. What's weird is refreshing the app made it sometimes work, but most of the time threw the same error. I'll keep playing around on my end though.

Try this

final port = SerialPort(address);
port.open(...);
port.configure =...

thanks a lot, it works for me. I try it on MacOS, 11.4

from flutter_libserialport.

jiangchunyu avatar jiangchunyu commented on August 19, 2024

SerialPortConfig? config=_serialPort?.config;
config?.baudRate=hdevice.baudRate;//波特率
config?.stopBits = 1;//停止位
config?.bits=8;//数据位
config?.parity=0;//校验位
config?.parity=0;
if(config!=null){
LogUtil.d(" config ${config}", tag: TAG);
_serialPort?.config=config;
}
这个方式可以。不报错

from flutter_libserialport.

ehagerty avatar ehagerty commented on August 19, 2024

@jiangchunyu
谢谢你。您能否分享您的代码,以便我看看我的代码有什么不同?

from flutter_libserialport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.