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

   ## Summary
   
   rpmsgdev_ioctl_arglen() omits BATIOC_CAPACITY and BATIOC_CHIPID, so
   forwarding them through rpmsgdev fails with -ENOTTY at the client; add
   both to the sizeof(int) group (BATIOC_CAPACITY takes `int *`,
   BATIOC_CHIPID takes `unsigned int *`) so the ioctls reach the remote
   battery driver.
   
   ## Impact
   
   BATIOC_CAPACITY/BATIOC_CHIPID issued on an rpmsgdev node now reach the
   remote battery driver instead of failing with -ENOTTY; no ABI or build
   impact.
   
   ## Testing
   
   * Host: x86_64 Ubuntu 22.04.
   * Build: `./tools/configure.sh sim:rpproxy` (CONFIG_DEV_RPMSG=y) +
     `make -j` passes; `libdrivers.a` contains `rpmsgdev.o`.
   * Style: `tools/checkpatch.sh -c -u -m -g <base>..HEAD` and
     `tools/checkpatch.sh -f drivers/misc/rpmsgdev.c` both report
     "All checks pass".
   * Runtime (two NuttX sim instances over rpmsg/rptun: a server with
     CONFIG_DEV_RPMSG_SERVER exporting a battery fakegauge via
     rpmsgdev_export(), a client with CONFIG_DEV_RPMSG mapping it via
     rpmsgdev_register()):
     - BATIOC_CAPACITY through the rpmsgdev node returns the remote
       gauge value (e.g. 81; fakegauge cycles 60..100); without this patch
       the same call fails with -ENOTTY at the client and is never
       forwarded.
     - BATIOC_CHIPID reaches the remote (verified in a server-side log of
       forwarded requests) and returns -ENOTTY from the battery
       upper-half because no in-tree lower-half implements the optional
       chipid op; the caller's buffer is left untouched.
     - BATIOC_ONLINE (not part of this patch) still fails with -ENOTTY at
       the client, confirming the change is limited to the two commands.
   * Not run: physical dual-core hardware with a battery lower-half that
     implements chipid; the argument sizes were checked against
     battery_gauge.c (int */unsigned int *) instead.
   


-- 
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