Skip to content

Commit

Permalink
fix: at command execution issue
Browse files Browse the repository at this point in the history
  • Loading branch information
damonto committed Jun 14, 2024
1 parent c6a5749 commit 7fdd7fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion internal/app/handler/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func (h *ProfileHandler) enter(b *gotgbot.Bot, ctx *ext.Context) error {
}
timeoutCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
fmt.Println(usbDevice)
profiles, err := lpac.NewCmd(timeoutCtx, usbDevice).ProfileList()
if err != nil {
return err
Expand Down
7 changes: 6 additions & 1 deletion internal/pkg/modem/modem.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ func (m *Modem) RunATCommand(command string) (string, error) {
return "", err
}

t, err := term.Open(usbDevice, term.Speed(115200), term.RawMode)
// Seriously, this is a hack.
// I don't know what happened, but If I run the AT command at the first port, it may cause the "lpac profile list" command to hang.
// So I just increase the port number by 1 and it works.
// Maybe it's a bug of Quectel EC20 modem.
usbDevice = usbDevice[:len(usbDevice)-1] + fmt.Sprint(int(usbDevice[len(usbDevice)-1]-'0')+1)
t, err := term.Open(usbDevice, term.Speed(9600), term.RawMode)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 7fdd7fe

Please sign in to comment.