Find the answer to your Linux question:
Results 1 to 5 of 5
I Have been using linux for eight years or so, and have been teaching myself C++ for one. I picked C++ after researching which language to begin learning. I choose ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Location
    E. St. Louis, IL
    Posts
    2

    C++ and hardware configure


    I Have been using linux for eight years or so, and have been teaching myself C++ for one. I picked C++ after researching which language to begin learning. I choose it because linux is written in it and it is powerful enough to write hardware drivers. Will learning C++ make it to where eventually I understand hardware at a kernel level and can configure it without needing to constantly read docs? Right now I can think of lsusb command, but when the list of usb devices scrolls across the screen it might as well be displayed in Greek. Running commands like "firefox" from xfce console displays that "do not have permission, display0 is already running". Does that mean if I had another display I could type "firefox display1" (or something) and it will come up on the other display? In other words I am more interested in hardware config than development, how can I learn machine talk for devices?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,533
    Quote Originally Posted by rossrogue View Post
    I Have been using linux for eight years or so, and have been teaching myself C++ for one. I picked C++ after researching which language to begin learning. I choose it because linux is written in it and it is powerful enough to write hardware drivers.
    Actually, this is incorrect. The Linux kernel is written in C and assembler. Many applications and GUI window managers are written in C++. Device drivers MUST be written in C and NOT C++ at the present time.

    Will learning C++ make it to where eventually I understand hardware at a kernel level and can configure it without needing to constantly read docs?
    No. C++ is a programming language, and has very little to do with kernel-level hardware control. If you want to control hardware, you need to communicate with the kernel hardware drivers, and that is usually done either with system calls, or with ioctl calls, and those are in C, though you can call them from C++ just like you can any C function.

    Right now I can think of lsusb command, but when the list of usb devices scrolls across the screen it might as well be displayed in Greek. Running commands like "firefox" from xfce console displays that "do not have permission, display0 is already running". Does that mean if I had another display I could type "firefox display1" (or something) and it will come up on the other display? In other words I am more interested in hardware config than development, how can I learn machine talk for devices?
    Show in detail how you are trying to run firefox - all command arguments and environment variables such as DISPLAY please.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Dec 2012
    Location
    E. St. Louis, IL
    Posts
    2
    Thank you for the reply. Linux is C, I will take a class on C before diving into C++. A the hits I got on google are exactly what I needed when I searched "ioctl calls". I haven't spent with it yet, but it is a new tool along with, xorg and randr. With C and those tools I should be able to solve my own project, thank you. Solved

  4. #4
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    129
    C++ grew as a extension of C with some noted differences such as added overhead a larger standard template library and an object oriented approach to things. However in terms of syntax and semantics C and C++ (and virtually all C derived or inspired languages) are ease. So any time you spend learning C++ was still working towards your goal of learning to be able to program for the linux kernel.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,533
    I use C for kernel work, and C++ for just about everything else. Compared with other object-oriented languages, it is a lean, mean machine. It also has the capabilities of supporting VERY complex systems that can run into millions of lines of code over many discrete applications. I also write Java, bash, perl, and python code - when you hold a gun to my head... I'm an old-school programmer. If I need a quick-and-dirty utility that is fundamentally simple, I use bash + sed + awk + grep, etc. If it needs to do things that are a bit more complicated than reading and filtering well-formed text files and other output, then I go to the big hammer, C++.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •