itctl panics on nil pointer #14
Labels
No Label
Bug
Cantfix
Duplicate
Enhancement
External
Help Wanted
In Progress
Invalid
Question
Waiting
Waiting For Info
Waiting for Upstream
Wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Elara6331/itd#14
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After pulling (v0.0.4-54-g23e9195) itctl throws:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6a6769]
goroutine 1 [running]:
go.arsenm.dev/itd/api.(*Client).Close(...)
/home/tony/github/itd/api/client.go:57
main.main.func2(0xc000076500, 0x731354, 0xc000063710)
/home/tony/github/itd/cmd/itctl/main.go:187 +0x29
github.com/urfave/cli/v2.(*App).RunContext.func1(0xc00010eea0, 0xc000076500, 0xc00016bb78)
/home/tony/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:289 +0x3b
github.com/urfave/cli/v2.(*App).RunContext(0xc00010eea0, 0x78b430, 0xc000016110, 0xc000012040, 0x2, 0x2, 0x787820, 0xc000100320)
/home/tony/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:304 +0x948
github.com/urfave/cli/v2.(*App).Run(...)
/home/tony/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
/home/tony/github/itd/cmd/itctl/main.go:191 +0x147d
I also noticed go get -u complaining
blefs.transferChar.Properties.MTU undefined (type *gatt.GattCharacteristic1Properties has no field or method MTU)
go version go1.16.14 linux/amd64
bluez 5.55-3.1
Ok,it's bad error/exception handling which might need some fixing.
Important: https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gatt "keep in mind with GATT and connections is that connections are exclusive"
Playing and researching lead to short HOWTO:
(or you get errors like "src/device.c:load_gatt_db() No cache for XXX"
(watch should show a code to enter on bluetoothctl prompt)
(undocumented feature :)
You cannot supply the device id (MAC Address) to itctl. It will notify whatever is connected to itd, and cannot do it to any other device. The first argument to
itctl notify
acts as the title of the notification, the second as the body.The reason for the error you're seeing appears to be that your BlueZ version is too old. I believe at least 5.62 is required for the MTU field.
The itctl error is because it's trying to close a client that was never opened because itd was never running. Without that MTU field, itd cannot compile. I do need to find a solution to this, but unfortunately, the library I am using for bluetooth (the only one available), stops working when a feature is added or removed. That's just because the entire library is auto generated.
I will fix the itctl error handling, but there isn't much I can currently do about the BlueZ version issue.