Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lightware_lase_serial: fix pointer for enabling serial mode
const char *data = "www\r\n"; Defines a cstring of 6 bytes: 'w', 'w', 'w', '\r', '\n', '\0' type of data: char const* type of &data: char const** So when we call write(_fd, &data, strlen(data)); then strlen(data) == 5 and we send the 4 byte memory address of data + some additional random byte. Correct is write(_fd, data, strlen(data)); where char const* gets casted to const void * and we pass the pointer to the content of data. The fundamental problem here is write() not being typesafe.
- Loading branch information