-
Notifications
You must be signed in to change notification settings - Fork 23
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
Unable read from port in Mac M1 #43
Comments
@sahilpaudel What data (what bytes exactly) you expected to read from the port by this code? |
for now I am sending this |
Why are you writing to port /dev/cu.Bluetooth-Incoming-Port ? |
When I list the port this is the port I am seeing. |
Well, if we believe the text in the name of the port, it says it is Bluetooth incoming port, So I don't think you could write to this port. Do you have any specific reason to write to this port? |
No I was trying out the library and how it works. Do I have to install some drivers to get a proper port because all I could see is when I run Get All Port List |
OK. First of all you you should not use those ports. They are system related. If you want to work with serial communication you have to have a device that works with serial port. For example, you have GSM modem that works via UART and you control it via AT commands. For that you need FTDI/CP2102/(any other USB to serial converter) to connect to that device. Then you will use that port for controlling GSM modem. Or you have Micro controller (MCU) that has USB port and when you connect it to PC it creates virtual serial port and then you can open that port and send commands using this library. That is how you should use serial port. |
Thank you so much for this great insight is there a way I can mimic this using any library or commands in mac? |
I don't think you can mimic serial port opening/writing/reading/closing. If you want to test the library, then you have to have some real serial port device. What do you want to do with this library that you need to mimic serial port? |
I have a device that sends data stream and I need to write an application to consume that and process that. |
And also I am getting `func main() {
}` I tried the https://github.com/tarm/serial it was working with that. |
Does this serial port exist? Can you list serial ports with this library? |
Hey there,
go version go1.21.6 darwin/arm64
`
import (
"fmt"
"github.com/albenik/go-serial/v2"
"log"
)
func main() {
ports, err := serial.GetPortsList()
if err != nil {
log.Fatal(err)
}
if len(ports) == 0 {
log.Fatal("No serial ports found!")
}
}
`
The output of above code is
Found port: /dev/cu.Bluetooth-Incoming-Port Found port: /dev/cu.wlan-debug Found port: /dev/tty.Bluetooth-Incoming-Port Found port: /dev/tty.wlan-debug Sent 54 bytes Length <nil>Length 0 EOF
No matter what I send it gives length of read bytes as 0.
Can you please suggest what am I missing here.
The text was updated successfully, but these errors were encountered: