This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch modules/convertible
in repository enlightenment.

View the commit online.

commit 42123b66ccb72b63758ba6a652926bc29f957d9e
Author: rafspiny <rafsp...@gmail.com>
AuthorDate: Tue Dec 19 13:30:23 2023 +0100

    Remove logs and improve error handling.
    Remove **
---
 src/modules/convertible/dbus_acceleration.c | 33 +++++++++--------------------
 src/modules/convertible/e_mod_main.c        | 16 ++++----------
 2 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/src/modules/convertible/dbus_acceleration.c b/src/modules/convertible/dbus_acceleration.c
index c2e234b3c..b0aade120 100644
--- a/src/modules/convertible/dbus_acceleration.c
+++ b/src/modules/convertible/dbus_acceleration.c
@@ -143,34 +143,27 @@ enum screen_rotation access_string_property(const Eldbus_Message *msg, Eina_Bool
       *result = EINA_FALSE;
    }
 
-   DBG("Before assign");
-   DBG("variant: %s", variant);
-   DBG("msg: %s", msg);
-   const char **string_property_value = calloc(PATH_MAX, sizeof(char));
-   if (!eldbus_message_iter_arguments_get(variant, "s", string_property_value))
+   const char *string_property_value;
+   if (!eldbus_message_iter_arguments_get(variant, "s", &string_property_value))
    {
       WARN("error in eldbus_message_iter_arguments_get()");
       *result = EINA_FALSE;
    }
-   DBG("After assign");
-   DBG("Value of assign %s", *string_property_value);
-   DBG("FINE");
 
    enum screen_rotation rotation = undefined;
-   if (strcmp(ACCELEROMETER_ORIENTATION_RIGHT, *string_property_value) == 0)
+   if (strcmp(ACCELEROMETER_ORIENTATION_RIGHT, string_property_value) == 0)
       rotation = right_up;
-   if (strcmp(ACCELEROMETER_ORIENTATION_LEFT, *string_property_value) == 0)
+   if (strcmp(ACCELEROMETER_ORIENTATION_LEFT, string_property_value) == 0)
       rotation = left_up;
-   if (strcmp(ACCELEROMETER_ORIENTATION_BOTTOM, *string_property_value) == 0)
+   if (strcmp(ACCELEROMETER_ORIENTATION_BOTTOM, string_property_value) == 0)
       rotation = flipped;
-   if (strcmp(ACCELEROMETER_ORIENTATION_NORMAL, *string_property_value) == 0)
+   if (strcmp(ACCELEROMETER_ORIENTATION_NORMAL, string_property_value) == 0)
       rotation = normal;
 
-   if (strcmp(ACCELEROMETER_ORIENTATION_UNDEFINED, *string_property_value) == 0)
+   if (strcmp(ACCELEROMETER_ORIENTATION_UNDEFINED, string_property_value) == 0)
        *result = EINA_FALSE;
 
    free((void *) type);
-   free(string_property_value);
    return rotation;
 }
 
@@ -283,7 +276,6 @@ on_accelerometer_orientation(void *data, const Eldbus_Message *msg, Eldbus_Pendi
 
 int _convertible_rotation_get(const enum screen_rotation orientation)
 {
-   DBG("Inside _convertible_rotation_get with orientation %d", orientation);
    switch (orientation)
    {
       case normal: return 0;
@@ -370,7 +362,7 @@ int _is_device_a_touch_pointer(int dev_counter, int num_properties, char **itera
          }
          DBG("Looks like I found a device with calibration capabilities");
          is_correct_device = EINA_TRUE;
-	 free(result);
+	     free(result);
       }
       iterator++;
    }
@@ -378,7 +370,6 @@ int _is_device_a_touch_pointer(int dev_counter, int num_properties, char **itera
 }
 
 void _fetch_and_rotate_screen(const char* randr_id, enum screen_rotation orientation) {
-   DBG("Passed Orientation: %d", orientation);
    DBG("Working on screen %s", randr_id);
    E_Randr2_Screen *rotatable_screen = e_randr2_screen_id_find(randr_id);
    if (rotatable_screen == NULL)
@@ -386,17 +377,13 @@ void _fetch_and_rotate_screen(const char* randr_id, enum screen_rotation orienta
        DBG("Failed to load screen for id %s", randr_id);
        return;
    }
-   DBG("Obtained screen obj for %s", randr_id);
-   DBG("Screen obj %s", rotatable_screen->id);
 
-   E_Config_Randr2_Screen *screen_randr_cfg = e_randr2_config_screen_find(rotatable_screen, e_randr2_cfg);
+    E_Config_Randr2_Screen *screen_randr_cfg = e_randr2_config_screen_find(rotatable_screen, e_randr2_cfg);
     if (screen_randr_cfg == NULL)
     {
         DBG("Failed to load screen configuration for id %s", randr_id);
         return;
-    }
-   DBG("Obtained Randr2_screen cfg for %s", randr_id);
-   DBG("Screen configuration obj %s is enalbed %d", screen_randr_cfg->id, screen_randr_cfg->enabled);
+   }
    int rotation = _convertible_rotation_get(orientation);
    DBG("Screen %s is going to be rotated to %d", randr_id, rotation);
 
diff --git a/src/modules/convertible/e_mod_main.c b/src/modules/convertible/e_mod_main.c
index daec2914f..adf54f689 100644
--- a/src/modules/convertible/e_mod_main.c
+++ b/src/modules/convertible/e_mod_main.c
@@ -303,28 +303,20 @@ e_modapi_init(E_Module *m)
       DBG("name randr2 id %s", zone->randr2_id);
       DBG("rot_90 %i", screen->info.can_rot_90);
 
-      FILE* filePointer;
-      filePointer = fopen("/home/raffaele/screens.txt", "a");
-      if (filePointer == NULL) {
-          printf("GfgTest.c file failed to open.");
-      }
-      else {
-          fprintf(filePointer,"randr2 id %s\n", zone->randr2_id);
-          fprintf(filePointer,"randr2 rot_90 capacity %d\n", screen->info.can_rot_90);
-          fclose(filePointer);
-      }
       // Arbitrarily chosen a condition to check that rotation is enabled
       if (screen->info.can_rot_90 == EINA_TRUE)
          {
          int max_screen_length = 700;
          char *randr2_id =  malloc(sizeof(char) * max_screen_length);
          int copied_chars = eina_strlcpy(randr2_id, zone->randr2_id, max_screen_length);
+
          if (copied_chars > max_screen_length)
             ERR("Screen name %s has been truncated. Cannot handle screens.", randr2_id);
-         if (copied_chars < 0)
+         else if (copied_chars < 0)
             ERR("Can't copy the screen name");
+         else
+            inst->randr2_ids = eina_list_append(inst->randr2_ids, randr2_id);
 
-         inst->randr2_ids = eina_list_append(inst->randr2_ids, randr2_id);
          if (eina_error_get())
             ERR("Memory is low. List allocation failed.");
          }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to