zdebanos commented on code in PR #3170:
URL: https://github.com/apache/nuttx-apps/pull/3170#discussion_r2316135282


##########
examples/shv-nxboot-updater/shv_nxboot_updater.c:
##########
@@ -0,0 +1,424 @@
+/****************************************************************************
+ * apps/examples/shv-nxboot-updater/shv_nxboot_updater.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <shv/tree/shv_tree.h>
+#include <shv/tree/shv_file_node.h>
+#include <shv/tree/shv_connection.h>
+#include <shv/tree/shv_methods.h>
+#include <shv/tree/shv_clayer_posix.h>
+#include <shv/tree/shv_dotdevice_node.h>
+
+#include <stdio.h>
+#include <signal.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <semaphore.h>
+
+#ifdef __NuttX__
+#include <nxboot.h>
+#include <nuttx/mtd/mtd.h>
+#include <sys/boardctl.h>
+#endif
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int shv_nxboot_opener(shv_file_node_t *item);
+static int shv_root_device_type(shv_con_ctx_t * shv_ctx, shv_node_t *item,
+                                int rid);
+static int shv_dotapp_vmajor(shv_con_ctx_t *shv_ctx, shv_node_t *item,
+                             int rid);
+static int shv_dotapp_vminor(shv_con_ctx_t *shv_ctx, shv_node_t *item,
+                             int rid);
+static int shv_dotapp_name(shv_con_ctx_t *shv_ctx, shv_node_t *item,
+                           int rid);
+static int shv_dotapp_ping(shv_con_ctx_t *shv_ctx, shv_node_t *item,
+                           int rid);
+static int shv_fwstable_confirm(shv_con_ctx_t *shv_ctx, shv_node_t *item,
+                                int rid);
+static void quit_handler(int signum);
+static void print_help(char *name);
+
+static shv_node_t *shv_tree_create(void);
+static void attention_cb(shv_con_ctx_t *shv_ctx,
+                         enum shv_attention_reason r);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* An execution barrier */
+
+static sem_t running;
+
+/* ------------------------- ROOT METHODS --------------------------------- */
+
+static const shv_method_des_t shv_dev_root_dmap_item_device_type =
+{
+  .name = "deviceType",
+  .method = shv_root_device_type
+};
+
+static const shv_method_des_t * const shv_dev_root_dmap_items[] =
+{
+  &shv_dev_root_dmap_item_device_type,
+  &shv_dmap_item_dir,
+  &shv_dmap_item_ls,
+};
+
+static const shv_dmap_t shv_dev_root_dmap =
+  SHV_CREATE_NODE_DMAP(root, shv_dev_root_dmap_items);
+
+/* ------------------------- .app METHODS ---------------------------- */
+
+static const shv_method_des_t shv_dev_dotapp_dmap_item_vmajor =
+{
+  .name = "shvVersionMajor",
+  .method = shv_dotapp_vmajor
+};
+
+static const shv_method_des_t shv_dev_dotapp_dmap_item_vminor =
+{
+  .name = "shvVersionMinor",
+  .method = shv_dotapp_vminor
+};
+
+static const shv_method_des_t shv_dev_dotapp_dmap_item_name =
+{
+  .name = "name",
+  .method = shv_dotapp_name
+};
+
+static const shv_method_des_t shv_dev_dotapp_dmap_item_ping =
+{
+  .name = "ping",
+  .method = shv_dotapp_ping
+};
+
+static const shv_method_des_t * const shv_dev_dotapp_dmap_items[] =
+{
+  &shv_dmap_item_dir,
+  &shv_dmap_item_ls,
+  &shv_dev_dotapp_dmap_item_name,
+  &shv_dev_dotapp_dmap_item_ping,
+  &shv_dev_dotapp_dmap_item_vmajor,
+  &shv_dev_dotapp_dmap_item_vminor,
+};
+
+static const shv_dmap_t shv_dev_dotapp_dmap =
+  SHV_CREATE_NODE_DMAP(dotapp, shv_dev_dotapp_dmap_items);
+
+/* ------------------------- fwstable METHODS ---------------------------- */
+
+static const shv_method_des_t shv_dev_fwstable_dmap_item_confirm =
+{
+  .name = "confirm",
+  .method = shv_fwstable_confirm
+};
+
+static const shv_method_des_t * const shv_dev_fwstable_dmap_items[] =

Review Comment:
   As i'm reading the NXBoot API 
(https://nuttx.apache.org/docs/latest/applications/boot/nxboot/index.html), 
`nxboot_get_confirm()` also "marks its copy in update partition as recovery", 
as I'm reading into the source code, it does not mark anything - which is the 
right behaviour, it should just be a getter. 
   
   I am only concerned about the docstring of `nxboot_get_confirm`. But if 
`nxboot_get_confirm` is the correct function, then I mark this as fixed.



##########
examples/shv-nxboot-updater/update-script/gui.py:
##########
@@ -0,0 +1,221 @@
+#!/usr/bin/env python3
+
+############################################################################
+# apps/examples/shv-nxboot-updater/update-script/gui.py
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+import argparse
+import asyncio
+import logging
+import sys
+from typing import Any
+
+from PyQt6.QtCore import Qt, QThread
+from PyQt6.QtWidgets import (
+    QApplication,
+    QComboBox,
+    QDialog,
+    QGridLayout,
+    QLabel,
+    QLineEdit,
+    QProgressBar,
+    QPushButton,
+)
+
+from shvconfirm import shv_confirm
+from shvflasher import shv_flasher
+
+log_levels = (
+    logging.DEBUG,
+    logging.INFO,
+    logging.WARNING,
+    logging.ERROR,
+    logging.CRITICAL,
+)
+
+PROGRESS_STYLE = """
+QProgressBar{
+    border: 2px solid grey;
+    border-radius: 5px;
+    text-align: center
+}
+
+QProgressBar::chunk {
+    background-color: green;
+}
+"""
+
+
+def parse_args() -> argparse.Namespace:
+    """Parse passed arguments and return result."""
+    parser = argparse.ArgumentParser(
+        description="GUI application for NuttX firmware flash over SHV"
+    )
+    parser.add_argument(
+        "-v",
+        action="count",
+        default=0,
+        help="Increase verbosity level of logging",
+    )
+    parser.add_argument(
+        "-q",
+        action="count",
+        default=0,
+        help="Decrease verbosity level of logging",
+    )
+    parser.add_argument(
+        '-i', '--image',
+        dest='image',
+        type=str,
+        default='update.img',

Review Comment:
   Fixed.



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