Haiku is not compiling!

One of my GSoC task which is to set the mouse configurations for each mouse separately is now working on my mentor’s side but not on my side.

The code gets merged to master. On my side, I think some old files are still running on the back end of the new code. So, to make sure this I deleted the files and checked out the all-new code of haiku using “git pull origin master”.

After pulling the code, I needed to compile the haiku code, to get the latest updates using the command: “jam -q -j2 @nightly-raw/anyboot”
And getting the error as shown in the picture.

This image has an empty alt attribute; its file name is errors.png


I also drop a mail regarding this issue in the community mailing list but didn’t find any solution for it.
The second way I was tried because the issue is regarding the packages installed. I removed all the packages and replace the partition packages with the default packages which was present in the “/boot/system”
Restart the haiku, configured it, and install the necessary packages like jam, nasm, bison, flex again. But still when I tried to compile it, getting the same error.

Yesterday I found the issue on the haiku trac which is to set a button named as Disable Touchpad, by which the user can manually stop the touchpad when the mouse is attached with the laptop. At the time of outreachy I did this thing but in that, I just disable the touchpad settings when it is not connected. Now, I have to stop the working of the touchpad. So working on that.
In the meanwhile, I am also doing the C++programs on the HackerRank to polish my C++ skill. When I get bored from these two works I use flutter to make an app. 🙂

GSoC 2020 Final Report

This is the final report of the GSoC 2020 project

The proposal is available here:

Work Done:
  • Added the icons for each connected device in the input preferences application.
  • Removed the unwanted devices from the device list when they are not connected to the computer.
  • Improved the look of 4th and 5th button of the mouse and added the 6th button of the mouse and its working.
  • Made the Joystick GUI.
  • Made the Wacom tablet GUI.
  • Implemented the input preferences to hold settings for each mouse separately.
Commits:

https://review.haiku-os.org/q/owner:preetpalok123%2540gmail.com

Weekly Blogs:

https://preetpalk.wordpress.com/

Work TO DO:
  • Implement the settings of Joystick.
  • Implement the working of a Wacom tablet.
  • Implement the settings of each mouse from the back end.
Struggles:

During the implementation of icons in the device list, I got the example from the media application and added the icons.

To add the 6th button of the mouse, I got the example from the other mouse buttons.

Implementation of mouse settings separately takes the time and it’s still in process. There is no example where I can get the idea. It is the research work for me.

I used the mapping concept to store the settings for each mouse with its name and is working fine on the GUI basis. Back end implementation is time-consuming. I am one step behind to the solution because I am unable to get the names of the mice in the input server. If I get the names some how it’s in the binary format!

While trying to solve this issue, if there is something happens wrong in the code the mouse and the keyboard stops working. To test the code each time I have to made the package and reboot the haiku. With that, the old packages also stops working due to the fault in the kernel.

Each time I have to need to re-install the haiku from the CD. It’s not enough while booting the haiku from CD, it shows the debugger window because of kernel fault and unable to install it.

For the above issue, If I access the haiku from Linux, the Linux does not know how to write on haiku!

The last option is to use qemu. I accessed the haiku partition from the haiku installed in the qemu and replaced the packages from /system/packages with /boot/system/packages. After doing this, the haiku runs successfully. I need to re-build it and installed the packages, again the time-consuming task.

While trying to resolve the issue, I don’t know whether the debugger window opens or not due to the changes added by me. Till now, I have to repeat the above steps about 5 times.

At the time of the timeline, I did not expected these type of issues. 😦

I have learnt so many new things in these three months about haiku and git.

I am also working with haiku after GSoC as a part of my 6 months of industrial training. And also try to complete my project. 🙂

Thankyou 🙂

Did not get the mouse names!

Still the mouse names are not getting printed in the logs. Even, I tried to print the age as a variable and assigned value 4 to it. Then, I tried to print it in the logs but , the garbage value is coming in both MouseSettings and Input Server files in the server side. InterfaceDefs connects the MouseSettings and the InputServer. The names are getting printed on the interface defs but not on the other side.

Now, I have no clue how to print the names. It is not possible to resolve the bug until I get the names printed.

With the hep of logs I came to know there was just one object of MouseSettings in the server side. Suppose if we connect the two mices, the settings get stored only for one because, the control runs the once. At the time of the second mouse it just find its name and stop. The control did not goes to the settings to save the current settings so , it becomes defaults.

Need help!! 😦

Set up Haiku again!

So, in my last blog, I write about nothing is working in haiku even Haiku is not started.

Yesterday I set up the Haiku again finally! 🙂

I was trying to install it again from the DVD, but when I booted haiku from it the debugger window comes again, which is due to the errors in the kernel.

I got frustrated at that time because there is no progress in the work due to these type of things happening and I don’t know any solution for that. Then, I access the haiku partition from the haiku which is running in the qemu by following the command:

“qemu-system-x86_64 -hda haiku-nightly-anyboot.iso -accel kvm -m 512M -usbdevice mouse -hdb /dev/sda4”

where “/dev/sda4” refers to the name of the partition and “-usbdevice mouse” refers to the usb device which will be shown in the haiku also in the input preferences application.

photo_2020-08-09_20-37-52

I mount the haiku partition in qemu but I did not get the code and other things that were in the haiku before! After taking help from PulkoMandy I found the Haiku icons were placed on each other. :p

When I accessed the partition I resolve the issue in the input server due to which the debugger window comes. I made the package again and run that. But still, the debugger window was coming.

Then, Pulkomandy told me to replace the  ” /Haiku1/system/packages” with ” /boot/system/packages” in its place. After replacing, the haiku comes to the real state and starts without a debugger. 🙂

But, I removed the packages from the haiku. So, when I tried to jam the code. I was getting the error “jam command was not found!”

To resolve that I need to build the haiku again and for that, I used this link below:

https://www.haiku-os.org/guides/building/

Then, again I was getting the errors, “jam was not found, nasm was not found”

photo_2020-08-10_14-00-06

To resolve that I used “pkgman install cmd:gcc”, “pkgman install jam”  and “pkgman install nasm”.

Before I jam the whole haiku once, also face one more error.

Screenshot from 2020-08-11 23-27-06

I need to install more packages, which were installed by using these commands:

“rm -rf /system/packages/administrative/transaction-*”
“pkgman full-sync”
“pkgman install haiku_devel”
“reboot”

Finally, it starts without any error and I jam the whole haiku once again. 🙂

Today the guest arrived at our home, So will start work tomorrow.

Nothing is working :(

In the past days, I was trying to print the names of the mouses in the Syslog by writing the Syslog statement in the input server-side. But, I was getting the names in the binary format. Which means the code was storing the names of the mouses with its settings.

binary_format

binary_conversion

In the input preferences side, the names and the settings were getting stored and printed as shown below:

interface_Defs

The settings were stored for each mouse and get retrieved also.

To make sure the server code was working I was trying to print the names. Then, I send the commit to Gerrit to review and find the reason why I was getting the binary format.

My mentor told me to split the commit into small parts. To do this, I first checked out the code into the branch, then I made the branches inside from each and split the code, send the commit. So, others can easily review it.

My mentor made a few changes in the code, I checked out that from Gerrit. According to him now the settings should be work! But, he forgets to take a USB mouse with him at his parent’s place.

He made the comments in the code, I was dealing with that. I made changes to solve those comments. When I made a package to test the settings the debugger window comes again. I know where is the error now. But, have no way to solve it. The debugger window comes the keyboard, mouse both are not working now. Also, the old packages are not working due to kernel.

pckage_stooped

Pulko suggests me to install the haiku again. I have a graphic card problem with my laptop and not easy for me to install it. Then, he told me to solve this issue which is to enable failsafe graphics drive in the haiku bootloader and edit the kernel settings to make it permanent.

Yesterday night, when I was trying to install the haiku form DVD. I saw the DVD tray is not coming out. I tried it manually and with the command “eject” also. But, nothing is working now.

The second option I have was to mount the haiku partition in ubuntu and to test the code use qemu. I mount the partition but, it is the read-only mode and the ubuntu does not know how to write to the haiku filesystem. I take the backup in the ubuntu.

error

Today is Sunday, the shop is closed. 😦

I split the code into the branches, then checked out the latest changes made by Pulko. I saw the code in the first branch does not show in the second branch. I searched on the internet and find I have to keep rebase each branch with its parent branch.

Like I have made the branches like A -> B -> C…

To get the branch A code in the B I need to rebase it like go to branch B, using “git checkout B” and run the command “git rebase A”. Now, we are rebasing the code of A into B and vice-versa.

After that, when I was sending the commit to Gerrit, I face an error due to multiple commits have the same commit id. To solve this, I need to squash the commit which has the same commit id.

Eg: the commits are in the form A -> B -> C ->D…

I need to squash A and D. To do this I run the following commands:

“git -i HEAD~N where N = 4”

Now the commit are like:

pick A

pick B

pick C

pick D

we need to squash A and D, for that we change the sequence of the commits like:

pick A

squash D

pick B

pick C

Now, using squash the A and D will be squashed and the B and C will remain as it is. 🙂

Then, the terminal window open in which we have to select which commit message we have to take commit 1 or commit 2 and the change id also.

 

 

 

 

Debugger window opens!

From yesterday I was trying to figure out my work but, didn’t get any output. The package was not installed, I was getting the error shown in the picture.

error

Then, I find out this error is because I didn’t update the code from the origin master.

By the following commands, the problem gets solved.

  • git fetch –prune

git fetch –prune is the best utility for cleaning outdated branches. It will connect to a shared remote repository remote and fetch all remote branch refs. It will then delete remote refs that are no longer in use on the remote repository

  • git rebase origin master

This command is used to rebase the current branch with the master to get the latest commit from the master.

While rebase I got the conflicts in the file /src/preferences/input/MouseSettings.cpp

I solved those conflicts manually and then, add it which tells the git the particular conflicts are resolved now.

Basically, the conflicts occur when we try to overwrite the file, like to overwrite the data on data. At that time the git confuses which data has to take and which not.

Then, I build the package again, install it when I run the input preferences and try to change the mouse type, the debugger window opens, after killing it. The mouse hangs and stops working. I didn’t know why it’s coming!

I also tried to save the report using “save-report” command in the debugger and little bit find out the error is in input_server files. I tried to hit and trial method to get rid of debugger but it’s not. 😦

Today, first I changed all the logs in all the files means I write the log which makes some sense and easy to find using the “grep” command.

I send the commit to Gerrit today and now waiting for replies. I tried every logic that comes to my mind but still unable to resolve this mouse configuration issue.

I have also learnt new commands in git.

  • git show <branch-name>: path/to/file

This command is used when the user wants to read the file from another branch from the current branch.

  • git checkout <branch-name> path/to/file

This command is used when the user wants  to copy the file from another branch to the current branch.

  • git rebase ~iHEADN

The above command is used when the user wants to squash the several commits to one commit. Where N means the number of commits the user wants to commit.

After applying the command the editor open, where all the commits are written with the word “pick”. Replace the “pick” with squash for those commits which we want to squash.

Well, I explained the squash concept in just a small sentence. But, when I was dealing with it I made three new branches because I was using it for the first time. First and the second try was not successful. Finally, in the third try, I squash my commits in one.

Also, its advice to keep the latest code in your branch to get rid of silly errors. 🙂

 

 

 

 

Tracer crashed!

While working, when I changed the code to solve the bug, I made a package to compile all the changes. Made the package, install it and then, restart the laptop to check the new haiku. Suddenly, the tracer crashed, nothing is working in the new haiku.

First I understand the flow of code by writing it on the copy.

2020-07-23

GUI -> InputWindow.h ->InputMouse.h -> InterfaceDefs.h -> InputServer.h

This is the complete workflow of code. I have printed so many logs in the code to check the flow of each file like when the particular function called. But, I was unable to test it because the tracer crashed, nothing was working in the new package.

I send the patch to the Gerrit for review, PulkoMandy reviewed it and he was gettings the error while compiling the code.

photo_2020-07-23_11-15-16

One error was removed by replacing the %d with the B_PRIdint32 while printing the integer value. And the second one is because I have two files with the name MouseSettings.h on two different paths. The server is confusing while file it has to take. So, to resolve this I keep the one file in the headers/private/input and remove the MoseSettings.h from src/preferences/input. And give its path to the Jamfile of the input preferences code.

The error resolved. PulkoMandy tests the output on another haiku, but I do not have another haiku installed on my system. Logs were printed in his side.

He suggests me other ways to test the output using ‘ssh’, qmeu, download haiku in the pen drive for testing.

What I did I have a very old laptop of my brother, its screen, keyboard, mouse nothing was working on that laptop. I attached the TV screen, USB mouse, keyboard to use it and to see the output logs.

Current setup:

WhatsApp Image 2020-07-21 at 5.49.42 PM

So, what I have done in the code was, currently, the code is just for one mouse, when the setting of another mouse comes, it gets overwritten.

I made a tow different functions in the InputfaceDefs.h get_multiple_mouse_type and set_multiple_mouse_type. In which they will get the mouse_name with the mouse type value. Each mouse has a type value which gets stored in it with its name to keep them unique.

I replaced get_mouse_type and set_mouse_type with get_multiple_mouse_type and set_multiple_mouse_type in the MouseSettings.cpp. Because we were storing the types of different mouses.

In the InputServer.h file, I have made a function which will return the MouseSettings.

MouseSettings*

InputServer:: GetMouseSettings(BString mouse_name)

This function will check if the name of the mouse is stored previously in the data then, it will retrieved its settings otherwise it will point to new. I made an object of MultipleMouseSettings class which is present in the MouseSettings.cpp. Using this class I checking the stored and retrieve back the settings.

To test this I have printed some logs inside the functions but they are not getting printed!!!

At night I was sending the code to the Gerrit but, it’s not uploaded. SO, today I will send the commit again so, others can also view what I did.

I got the reply to why the tracer is crashed:

The main problem is that reusing MouseSettings.cpp in input_server, it’s trying to get the current values from itself. So the part of the code that talks to input_server (using get_mouse_map and the other functions from InterfaceDefs) must be used only in Input preferences.

Now, I don’t know how to remove these functions So, today I have fixed a video col meeting with my mentor to come out of this.

Hope so, will complete this work soon!!!

I attended the meeting with PulkoMandy from 9:00 pm to 11:00 pm.  In which first I explain the changes what I have made briefly the logic which I have used. He pulls the code in his system and build it and run it before the meeting start.

On my side when the tracer crashed nothing is working, but on his side, the mouse is working because he is using the table mouse. So, it is easy to debug the code using the debugger. We find the error in the get_mouse_map status. It is calling itself, again and again, to get the value that’s why the haiku becomes slow and crashed.

To resolve this error, he made the changes in the src/add-ons/input_server/filters/shortcut_catcher/KeyInfos.cpp. Basically, to add the NULL check to take it out from the code. Because get_mouse_map() is returning the NULL. To take this out from the code NULL check is necessary.

Now, the tracer error is not more. But, he comments the _RetrieveSettings code for sometimes, by this now the mouse is moving but not working. Like not function is now called/working.  While trying to solve the error, his mouse is also stopped working. He is using haiku in qmeu (QEMU is a hosted virtual machine monitor: it emulates the machine’s processor through dynamic binary translation and provides a set of different hardware and device models for the machine, enabling it to run a variety of guest operating systems.) and able to see the logs, From where he came to know, that the logs that I have printed in the functions to debug are not written which means those functions are not be called.

One thing I didn’t understand and also forget to ask him like we are making the two objects of MouseSettings, in the InputMouse.cpp and in the InputServer and in between there is an InterfaceDefs.h to make a sing between the two objects. Where the code flow after reaching to the InputServer.h?

After keep on trying we thought to continue the meeting tomorrow, till then, both will try to solve the error above.

 

 

 

 

Progress report till now

Still working on the mouse configuration work!!

Now, the user can change the settings of the mouses. The settings are retrieved also when the application is run again.

The GUI changes and loads back but, the still the settings are working same for the different mouses.

Because the BMessage stores the settings of the mouse. Suppose we changed the mouse 1 to 2 button mouse and it gets stored in the BMessage and again we set the mouse 2 to 4 button mouse. Now, the settings of mouse 1 that are stored in the BMessage are overwritten by the setting of the mouse 2. To make this correct I have to do changes in the input server code which is the heart of the application!

The server files are written only for one mouse. To debug it I used the ‘LOG_CRIT()’ to get the output in the log file. Then, I was able to understand the flow of code.

But now I find I have to make more changes in the src/servers/input/InputServer.h file and this file will be compiled and have to make a package to check it which takes time. Also, didn’t know to get the output in the console logs.

To solve this bug, I have to map the name of the device and its settings in the server files.

There is a file named as “InterfaceDefs.h” which has the two functions “get_mouse_type”, which takes the mouse type of the mouse by the user and “set_mouse_type” which sets the value. These both files taking ‘int32 ‘ as an argument. What I did, I pass the argument like this:
“get_mouse_type(int32* type)”

“set_mouse_type(int32 type)”

“const char* mouse_name” as the name of the device and the type of the mouse. Later when I send this to the commit. I get the comment by my mentor to make the different functions for that as these are the public functions and are also used by the other application. Then I made the different functions by changing the name:

“get_multiple_mouse_type(const char* mouse_name, int32* type)”

“set_multiple_mouse_type(const char* mouse_name, int32 type)”

Now, the problem is the “src/preferences/input/MouseSettings .h” file links with the “src/servers/input/InputServer.h”. This file is also now written for one mouse only. It takes the empty object of the MouseSettings.h file which is now terrible. There are so many files inside one another.

Waiting for other reviews on my commit as now, didn’t have any clue to resolve it.

Scott told me to make a test program and solve the same problem in the small program, if I get the output as expected then, apply it in this code.

The work I have done till now, if I unable to configure how to write the code for a specific work then, first I made a small c++ program and apply the logic. If I get the output as expected I apply in haiku.

For eg. I have done mapping and used the concept of pointers for the first time. I implement the small program first and then, try it in the haiku. 🙂

By this way, we become sure that we will get the output as we want.

First Evaluation completed :)

Hello Everyone! Hope so you all are well in the ongoing situation.

First of all thanks to my mentor to pass the first evaluation of the GSoC2020.

Before discussing the current workflow, here is the picture of the icons work, I forgot to put it in the previous post.

icons

I have tested the DPI option also with the six-button mouse and the with button mouse in haiku. The DPI is working well.

Now, I am working on the mouse configurations for different mouses. This work takes a lot of time as compare to the other tasks because it needs a complete understanding of how the input_server works. While working on this issue I learn new things which are good!

1.) Mapping in C++

I heard about the mapping and know little about it, but never used this before. In this issue, I used this concept for the first time to map the settings of the mouse with its name. I think there is no other way to resolve this issue except mapping.

To make it worked I tried to use the map in small C++ programs and then, apply the same concept in my work. To make the workflow easier I used ‘printf’ statements to ensure whether the code was running or not.

Mapping is working fine now.

2.) Debugger window open while testing the code

The debugger windows open due to the bug in the code. I am not familiar with that so, I planned a meeting with PulkoMandy. In which he guided me to use the BArchivable(), flatten the data into the file so the settings are saved into the disk. By using the BArchivable(), the debugger window did not come again.

3.) Package installation takes so much time:

Before I was made the changes in the server files of the Mouse ‘/src/servers/input/MouseSettings.h, .cpp. To test those changes I need to make a package using the command jam -q haiku.hpkg this command takes a lot of time, then to install that package and finally to reboot the haiku. There is no other way possible! 😦

But still, I was not able to see the output. So, my mentor told me to made changes in the input preferences code first. So, I can get the output rather than, made changes into the server files.

4.) Abled to store the settings of multiple mouses  in the single file:

By changing the code in the input preferences files, I was able able to store the settings.

mousesettings

But, not able to retrieve them.

5.) Trying to get retrieve the settings:

I was trying to retrieve the settings that are stored in the file. To test whether the RetriveSettings() code was working or not. I changed the type of the mouse_name form const char* to BSring (BString can be compared with == and does a lot of the work (no need for strcpy, strcmp, …)).

I replaced map<const char* mouse_name, MouseSettings* settings> to map<BString mouse_name, MouseSettings* settings>

I copy-pasted the code of this function in the SaveSettings() function and commenting from the RetrieveSettings(). When I tested it I got the output shown below:settings

I used the ‘printf’ statements and ‘DEBUG’ and test the output. Here, clearly, the settings are saved and retrieved. In this picture, there was just a mouse type that I was printing and comparing the output.

Then, I tried to print the other settings also like clicking speed, acceleration, mouse mapping buttons. Below is the output that I have used to compare the settings before and after. The settings are stored and retrieved also.

settings_1

After shifted this code to the right place at RetrievedSettings(). Here was the problem, I get the garbage value for each setting. Maybe! there was the pointer issue. I send the code to the Gerrit so, I came to know about the exact issue of why I am getting this output wrong.

If I find where I am doing wrong, I will come very close to the exact solution for this issue.

https://paste.ubuntu.com/p/bF6Vz4mHVz/

 

 

 

 

Gettings the garbage value as output

Yesterday, I was trying to retrieve the settings that are stored in the file.  To test whether the RetriveSettings() code was working or not. I changed the type of the mouse_name form const char* to BSring (BString can be compared with == and does a lot of the work  (no need for strcpy, strcmp, …)).

I replaced   map<const char* mouse_name, MouseSettings* settings> to map<BString mouse_name, MouseSettings* settings>

I copy-pasted the code of this function in the SaveSettings() function and commenting from the RetrieveSettings().  When I tested it I got the output shown below:

settings

I used the ‘printf’ statements and ‘DEBUG’ to test the output. Here, clearly, the settings are save and retrieved. In this picture, there was just a mouse type that I was printing and comparing the output.

Then, I tried to print the other settings also like clicking speed, acceleration, mouse mapping buttons. Below is the output that I have used to compare the settings before and after. The settings are stored and retrieved  also.

settings_1

After that, I shifted this code to the right place at RetrievedSettings(). Here is the problem, I get the garbage value of each setting. Maybe! there is the pointer issue. I send the commit to the Gerrit so, I came to know about the exact issue why I am getting this output wrong.

Commit link: https://review.haiku-os.org/c/haiku/+/2953

Getting the garbage value while saving the settings. Retrieve stores the correct settings but save not.

Steps to produce the code:

– Go to the directory (haiku/src/preferences/input)

– run jam

remove the file (rm ~/config/settings/Mouse_settings)

– run ../../../generated/objects/haiku/x86_64/release/preferences/input/Input

– close the preferences from GUI

– run it again using the above command.

First, you see when you open the input preferences the retrieve logs not present because there is no Mouse_settings present. Now, after running the input preferences again you see the earlier save settings and the new retrieved mouse settings are same. But, when input preferences saved the file Mouse_settings, it prints the garbage values. I also check, in RetrieveSettings() and the SaveSettings() methods, MouseSettings objects have same address.

Here are the logs: https://paste.ubuntu.com/p/bF6Vz4mHVz/

If this problem will be solved my task will be completed!! 🙂

 

Blog at WordPress.com.

Up ↑