darrylring opened a new pull request, #20936:
URL: https://github.com/apache/nuttx/pull/20936

   ## Summary
   
   Not all capture lower-half drivers currently implement `getedges` which 
causes the `CAPIOC_EDGES` to assert and `CAPIOC_ALL` to dereference a null 
pointer.
   
   For `CAPIOC_EDGES` this will now return `ENOTTY` instead of asserting. For 
`CAPIOC_ALL` this will fill in the duty cycle and frequency and leave the edges 
value at 0.
   
   Next steps:
   
   1. Patch `nuttx-apps/examples/capture` to not error out if `CAPIOC_EDGES` 
returns `ENOTTY`
   2. Decide if `getedges` is truly optional and ensure each capture driver 
implements it if not.
   
   ## Impact
   
   This will prevents crashes/assertions but otherwise have no impact.
   
   ## Testing
   
   Before
   
   ```
   nsh> cap
   cap_main: Hardware initialized. Opening the capture device: 
/ddump_assert_info: Current Version: NuttX  13.1.0 82cb5d0cf9 Oct 23 2026 
10:46:12 arm
   dump_assert_info: Assertion failed : at file: timers/capture.c:397 task: 
<noname> process: <noname> 0x80334e5
   up_dump_register: R0: 20001460 R1: 0800513f R2: 20004cec  R3: 00000000
   up_dump_register: R4: 0800e6e5 R5: 0802122f R6: 00000000  FP: 00000000
   up_dump_register: R8: 00000000 SB: 00000000 SL: 20004800 R11: 00000000
   up_dump_register: IP: 00000000 SP: 20004df8 LR: 08005163  PC: 08005163
   up_dump_register: xPSR: 60000000 BASEPRI: 00000080 CONTROL: 00000006
   up_dump_register: EXC_RETURN: 00000000
   dump_stackinfo: User Stack:
   dump_stackinfo:   base: 0x200047e8
   dump_stackinfo:   size: 00002008
   dump_stackinfo:     sp: 0x20004df8
   stack_dump: 0x20004dd8: 20000000 0800dcf7 08037028 00000001 00000000 
200038f8 0800e6e5 080051bf
   stack_dump: 0x20004df8: 20001460 00000000 20001460 00000000 0000018d 
08036ff4 7ffffffe 200038f8
   stack_dump: 0x20004e18: 20001460 00000000 08036ff4 0000018d 00010000 
200038f8 00000000 0800e6e5
   stack_dump: 0x20004e38: 0802122f 00000000 0000018d 08036ff4 0802122f 
0800e209 00000000 20004f5c
   stack_dump: 0x20004e58: 00001303 200050e8 00000000 00000000 00000000 
20004f5c 00000000 20003bc0
   stack_dump: 0x20004e78: 20003ba8 20003bc8 0002146d 00000000 20000000 
00000000 0802146d 0802122f
   stack_dump: 0x20004e98: 080201b9 20004f4c 00001303 200050e8 0802140f 
0801feb7 20004f0c 0800b249
   stack_dump: 0x20004eb8: 20004f0c 20004f10 0802140f 08020195 20000000 
00000000 080214f7 080201c5
   stack_dump: 0x20004ed8: 0803547d 20003bc8 20004f5c ffffffe7 20000000 
00000000 080214f7 0802146d
   stack_dump: 0x20004ef8: 0803a47c 20004f48 00001303 00000003 080360d9 
2000377c 200050e8 00000000
   stack_dump: 0x20004f18: 20000000 00000000 080335e5 080214f7 20004f44 
00000003 20004f48 00000000
   stack_dump: 0x20004f38: 00000000 0800f537 080335e5 00001303 20004f5c 
20004f5c 200047d8 00000001
   stack_dump: 0x20004f58: 08009705 080096c1 0000003b 38011ab5 00000000 
00000003 00000000 00000000
   stack_dump: 0x20004f78: 20000000 00000000 00000000 0800f537 00000000 
200047d8 00000001 080334e5
   stack_dump: 0x20004f98: 00000000 08006e7b 00000000 200047d8 00000000 
200038f8 00000001 00000001
   stack_dump: 0x20004fb8: 00040000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000
   ev/cap0
   cap_main: Number of samples: 0
   pwm duty cycle: 0 % 
   pwm frequency: 0 Hz
   ```
   
   After
   
   ```
   nsh> cap
   cap_main: Hardware initialized. Opening the capture device: /dev/cap0
   cap_main: Number of samples: 0
   pwm duty cycle: 0 % 
   pwm frequency: 0 Hz 
   cap_main: ioctl(CAPIOC_EDGES) failed: 25
   Terminating!
   ```
   
   After (with 
[capture.patch](https://github.com/user-attachments/files/33886338/capture.patch)
 applied to `nuttx-apps`):
   
   ```
   nsh> cap
   cap_main: Hardware initialized. Opening the capture device: /dev/cap0
   cap_main: Number of samples: 0
   pwm duty cycle: 0 % 
   pwm frequency: 0 Hz 
   pwm duty cycle: 0 % 
   pwm frequency: 0 Hz 
   pwm duty cycle: 0 % 
   pwm frequency: 0 Hz
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to