Skip to content
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

Runtime Device OS logging configuration #481

Closed
wants to merge 9 commits into from
Closed

Conversation

sergeuz
Copy link
Member

@sergeuz sergeuz commented Apr 16, 2019

Note: The feature implemented in this PR relies on a new Device OS functionality that has not been released yet: device-os/#1748.

This PR implements a new command called log that allows configuring Device OS logging at runtime. The detailed description of the command can be found in the PRD.

Usage:

  • Enabling logging on the default Serial interface:
particle log my_device
  • Enabling logging on the Serial1 interface:
particle log my_device Serial1
  • Showing only application messages and system errors:
particle log my_device -l error -f app:all

Example output:

pretty

@sergeuz
Copy link
Member Author

sergeuz commented Apr 16, 2019

[ch30129]

@monkbroc
Copy link
Member

From a product perspective here's what I see when I test:

When pressing reset or pulling the USB port I get a red message saying bad file descriptor. It would be nicer to see "connection closed" or something.

I cannot get the feature to work on a Photon, when compiling Device OS from particle-iot/device-os#1748

@monkbroc
Copy link
Member

I can't figure out how to use Serial1. It just says Serial port is not found.

@monkbroc
Copy link
Member

Ah, for the serial not found I see the problem. I use a Photon with this serial echo program as my UART -> USB converter:

SYSTEM_MODE(MANUAL);

void setup() {
  Serial1.begin(115200);
}

void loop() {
  while(Serial1.available()) {
    char c = Serial1.read();
    Serial.write(c);
  }
}

Maybe just adding another example for Serial1 to show how to select a custom USB port in case the auto-detection doesn't find the right one would be enough?

@monkbroc
Copy link
Member

I'm also not able to get any logs from USBSerial1. When I do

$ particle log my_device USBSerial1
Opening serial port: /dev/ttyACM0

I get no logs.

It opens the same serial port as doing

$ particle log my_device Serial
Opening serial port: /dev/ttyACM0

Copy link
Member

@monkbroc monkbroc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to the technical approach on implementing the command. I'll let you work on the improvements based on our conversation earlier and the comments in the PR.

@busticated
Copy link
Contributor

@sergeuz i rebased this branch against latest master. if you have work in-fligth, be sure to git checkout -b feature/log_config_bkup before pulling.

@sergeuz
Copy link
Member Author

sergeuz commented May 21, 2019

@monkbroc I fixed the code according to your suggestions and rebased this branch. I had to disable USBSerial1 for now, as it turned out that calling USBSerial1.begin() in the Device OS causes the device to be detached from the system (or otherwise invalidates the libusb handle opened by particle-usb), which in turn causes the logging request to fail

@sergeuz
Copy link
Member Author

sergeuz commented May 21, 2019

I cannot get the feature to work on a Photon

I accidentally enabled the new logging requests only on mesh platforms. This is now fixed in particle-iot/device-os#1748

@sergeuz sergeuz force-pushed the feature/log_config branch from de69249 to 15164da Compare May 30, 2019 15:56
@busticated
Copy link
Contributor

@sergeuz what's the status of this work? are we still waiting for Device OS side updates?

@busticated
Copy link
Contributor

this appears to be orphaned - closing. feel free to re-open when it's actionable 👍

@busticated busticated closed this Mar 3, 2020
@WakfuYT
Copy link

WakfuYT commented Oct 25, 2024

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants