You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/07/11 07:21:37 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6596: vncserver enhancement

xiaoxiang781216 commented on code in PR #6596:
URL: https://github.com/apache/incubator-nuttx/pull/6596#discussion_r917614844


##########
drivers/video/vnc/vnc_fbdev.c:
##########
@@ -631,6 +631,27 @@ int up_fbinitialize(int display)
 
   session->mouseout = vnc_touch_event;
 #endif
+
+#ifdef CONFIG_VNCSERVER_KBD
+  ret = snprintf(devname, NAME_MAX, CONFIG_VNCSERVER_KBD_DEVNAME "%d",
+                 display);
+  if (ret < 0)
+    {
+      gerr("ERROR: Format vnc keyboard driver path failed.\n");
+      return ret;
+    }
+
+  ret = vnc_kbd_register(devname, session);
+
+  if (ret < 0)
+    {
+      gerr("ERROR: Initial vnc keyboard driver failed.\n");
+      return ret;
+    }
+
+  session->kbdout = vnc_kbd_event;
+#endif
+

Review Comment:
   need unregister keyboard after line 644



##########
drivers/video/vnc/vnc_fbdev.c:
##########
@@ -631,6 +631,27 @@ int up_fbinitialize(int display)
 
   session->mouseout = vnc_touch_event;
 #endif
+
+#ifdef CONFIG_VNCSERVER_KBD
+  ret = snprintf(devname, NAME_MAX, CONFIG_VNCSERVER_KBD_DEVNAME "%d",
+                 display);
+  if (ret < 0)
+    {
+      gerr("ERROR: Format vnc keyboard driver path failed.\n");
+      return ret;
+    }
+
+  ret = vnc_kbd_register(devname, session);
+
+  if (ret < 0)
+    {
+      gerr("ERROR: Initial vnc keyboard driver failed.\n");

Review Comment:
   unregister touch



##########
drivers/video/vnc/vnc_kbd.c:
##########
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * drivers/video/vnc/vnc_kbd.c
+ *
+ * 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 "vnc_server.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: vnc_kbd_register
+ ****************************************************************************/
+
+int vnc_kbd_register(FAR const char *devpath,
+                     FAR struct vnc_session_s *session)
+{
+  return keyboard_register(&session->kbd, devpath, 1);
+}
+
+/****************************************************************************
+ * Name: vnc_kbd_register
+ ****************************************************************************/
+
+void vnc_kbd_unregister(FAR struct vnc_session_s *session,
+                        FAR const char *devpath)
+{
+  keyboard_unregister(&session->kbd, devpath);
+}
+
+/****************************************************************************
+ * Name: vnc_kbd_event
+ ****************************************************************************/
+
+int vnc_kbd_event(FAR void *arg, uint8_t nch, FAR const uint8_t *ch)
+{
+  int i = 0;
+  FAR struct vnc_session_s *session = arg;
+  for (i = 0; i < nch; i++)
+    {
+      keyboard_event(&session->kbd, ch[i], KEYBOARD_PRESS);

Review Comment:
   need convert to uin32_t and send once



-- 
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-unsubscribe@nuttx.apache.org

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