Open kexin-open opened 7 years ago
The following code works under mips and arm CPU, it should work on other linux too.
env GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w" -o server-arm server.go env GOOS=linux GOARCH=mips go build -ldflags "-s -w" mem.go
PC linux is not tested yet. Referenced different headers made this works.
#if defined(__mips__)
# define NCCS 23
#elif defined(__sparc__)
# define NCCS 17
#else
# define NCCS 19
#endif
The change to the file serial/open_linux.go
Please reference https://github.com/philipgreat/go-serial/blob/master/serial/open_linux.go
func nccs() int {
if runtime.GOARCH == "mips" {
return 23
}
if runtime.GOARCH == "mipsle" {
return 23
}
if runtime.GOARCH == "spark" {
return 17
}
if runtime.GOARCH == "sparc64" {
return 17
}
return 19
}
const (
kTCSETS2 = unix.TCSETS2 //0x8030542B
kBOTHER = unix.BOTHER//0x00001000
kNCCS = nccs()
)
code:
env: GOOS=linux GOARCH=mipsle go1.8.3 cpu:mt7688
error: serial.Open: SYS_IOCTL: inappropriate ioctl for device
thanks