jlaitine commented on issue #16004:
URL: https://github.com/apache/nuttx/issues/16004#issuecomment-2747582742

   This doesn't work at all. I tried with a slightly modified test app as well. 
See the comments in the snippet below. Also, the device still crashes when 
exiting the test app.
   
   
[0001-Replace-helloworld-with-ttyACM-test-app.txt](https://github.com/user-attachments/files/19427462/0001-Replace-helloworld-with-ttyACM-test-app.txt)
   
   ```
             int bytes_available = 0;
             int retval = ioctl(ttyacm_fd, FIONREAD, &bytes_available);
   
             /* Collect 2 characters at a time to the buffer and
              * print them out
              */
   
             int bytes_to_read = 2;
   
             if (retval == 0 && bytes_available >= bytes_to_read)
               {
                 memset(buffer, 0, sizeof(buffer));
   
                 /* The following should read as many characters as there are, 
up to sizeof(buffer) bytes.
                  * since we only end up here, if FIONREAD above returns >= 2, 
there should be at least 2 characters
                  * /
             
                 nread = read(ttyacm_fd, buffer, sizeof(buffer));
   
                 /* But here nread is just 1, and printing out the "buffer" we 
find out that we received only 1 character! */
   
                 if (nread)
                   {
                     printf("got %d bytes: %s\n", nread, buffer);
                   }
               }
   
   ```
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to