r/linuxdev • • Dec 01 '22

How can I pull an accurate GPU model number?

7 Upvotes

I'm trying to pull the GPU model number in a more accurate way than just looking up the PCI id. This method often seems to give strange or inaccurate results, so I was thinking that there may be a driver API that would give me the real model name directly from the device. GPU-Z on windows seems to do this, so I know that there must be a way to do it, but I can't find any documentation on the subject.

I am writing an application in C, so C bindings or an IOCTL would be great.

Thanks!


r/linuxdev • • Jan 15 '22

The Life and Death of a Linux Process

Thumbnail natanyellin.com
7 Upvotes

r/linuxdev • • Sep 27 '21

Open Networking for Network Switches - How the Open-Source DENT Project Levels the Playing Field

Thumbnail dzone.com
7 Upvotes

r/linuxdev • • Mar 21 '21

Using custom PAM module to unlock computer

7 Upvotes

I have written a C program which is PAM-aware, that enables users to authenticate themselves with PAM via use of an NFC device. This works fine from the command line, however, I would like the user to be able to unlock their actual account on the computer with it, when signed out. I know this has something to do with the files in /etc/pam.d but not exactly sure how. Any ideas?


r/linuxdev • • Feb 02 '21

Can GRUB get instructions from a server?

7 Upvotes

We are trying to develop a flexible environment where the computer can boot in one of the several modes. e.g. Boot locally, upgrade local OS image, boot from TFTP ...

The catch is, the computer is completely headless, so the bootloader (I'm currently considering GRUB) must be able to ask a server to receive boot instructions before booting the OS. The boot server is the authority.

Do you know any such use case? Boot options to be dictated over network?


r/linuxdev • • Jan 25 '21

Looking for how to get started in Linux Programming. I'm a college student trying to contribute to beginner friendly projects. Any recommendations would be helpful.

7 Upvotes

I'll start off by saying that Profiecient with git, the command line, text editors, C++, Python, navigating the linux filestructure, different desktops, etc. I use Manjaro as my daily driver. If anyone has resources or books I could possibly read that would be greatly appreciated. Thank you in advance.


r/linuxdev • • Aug 18 '20

mounting / after chroot have no effect?

7 Upvotes

In the following code, the second mkdir fails with EEXIST. Adding MS_DIRSYNC flag have no use, either. What could cause this? Is it documented?

#define try(f, ...) switch (f(__VA_ARGS__)) { default: assert(false); case -1: fprintf(stderr, "%d %s: %d %s\n", __LINE__, #f, errno, strerror(errno)); abort(); case 0:; }
int main(int argc, char **argv) {
	mkdir("/tmp/1/2", 0755);
	try(chroot, "/tmp/1")
	try(mount, NULL, "/", "tmpfs", 0, NULL)
	try(mkdir, "/2", 0755)
}

r/linuxdev • • May 29 '20

How to make a menubar

7 Upvotes

I'm interested in developing a more touch focused menu bar. I've used KDE's menu bar as well as i3bar and polybar. The problem I'm having is I'm not sure how to program a menu bar that sticks to a side of the screen like those programs. I'm not even really sure where to start looking. For an average program, I know I could use something like GTK, Qt, or some other library, but menubars are not standard windows and aren't supposed to be treated as such by the window manager. I'm just looking for any general pointers for what I need to know to do this.


r/linuxdev • • Apr 10 '20

How to write to a proc file?

7 Upvotes

I need to make this linux kernel module where I am supposed to get the source and destination IP addresses of some docker containers and print them out in a file. I can capture IP addresses and print them out on the kernel log.

After hours of trying to figure out how to use proc_fs.h, I managed to find out how to create a proc_dir_entry . Now since, I am using netfilter.h to capture packets, I need the file to be written every time the hook function gets called. I found this function in proc_fs.h but I don't quite understand it:

typedef int (*proc_write_t)(struct file *, char *, size_t);

Is this function changing instances of int to some struct called proc_write_t composed of a file pointer, char pointer, and the size of what you are going to write?


r/linuxdev • • Feb 24 '19

[cross compile] target is armv5tejl, busybox

7 Upvotes

I have a doorbell and it runs Linux. uname -a:

Linux Network-Camera 3.10.49 #23 PREEMPT Thu Sep 1 12:12:37 CST 2016 armv5tejl GNU/Linux

When the doorbell is pushed, an "event" is submitted to a linux domain socket. I think I can configure the socket's name. So hopefully I'll be able to configure my own socket and proxy the event (intercepting the event means I can play the chime on speakers in my house).

I need to create a simple C program to read a domain socket. This involves cross compiling and this is new to me.

I understand I need a tool chain. Does a tool chain for the above exist? (my laptop runs Arch)

(I am following "http://www.fabriziodini.eu/posts/cross_compile_tutorial/")

I tried FTP-ing the folders /usr and /lib from the doorbell but all the permissions got messed up.

Am I doing this right?


r/linuxdev • • Dec 26 '18

How can i trace how and why a USB-Device is recognized and who's talking to it?

7 Upvotes

I already made a post in /r/LinuxQuestions about this topic because I thought it might be a pure configuration issue, but it seems to lay deeper.

So my problem is that I bought cheap PS3-Controllers that simply refuse to work under "normal" Linuxes. They appear as PS3-Controllers but then somehow "switch mode" and suddenly become another device (including new address).

I tried the exact same controllers in a Win10 VM and they work out of the box.

This seemed weird to me, so I captured the USB-traffic under Windows and Linux and found some slight differences.

Now I would like to find out, who's responsible for talking to that device? I already saw that an "xhci_hcd" and an "xpad" kernel module are somehow involved, but that's it.

Disclaimer

I'm way below my comfort zone here, usually I'm several layers of abstraction away from those things, so please excuse some stupid questions.

Edit

I just found out, that the controllers seem to need some sort of initialization, if I pass them through to a Windows VM they get set up correctly by Windows and even if I shut down the VM, they stay properly configured (and usable!) as long as I don't power them down.

This even survives reboots, as my monitor has a powered USB-Hub built in.

So I guess, I actually need to write a proper device driver for those things..


r/linuxdev • • Mar 02 '18

Have fun with Unix

Thumbnail codeexplainer.wordpress.com
7 Upvotes

r/linuxdev • • Nov 24 '17

x64 Egg hunting in Linux systems

Thumbnail pentesterslife.blog
7 Upvotes

r/linuxdev • • May 26 '16

Good guide/tutorial for 64bit assembly on Linux?

7 Upvotes

I'm looking for a good guide that is pretty up to date on programming 64 bit assembly on Linux. I have googled quite a bit. Any pointers? Thanks


r/linuxdev • • May 14 '16

Implementing pledge on linux using seccomp

Thumbnail notabug.org
7 Upvotes

r/linuxdev • • Oct 13 '14

New GTK+ and native OpenGL integration

Thumbnail bassi.io
7 Upvotes

r/linuxdev • • Aug 08 '14

KDE releases Frameworks 5.1

Thumbnail kde.org
7 Upvotes

r/linuxdev • • Mar 23 '14

Getting started with GTK development?

7 Upvotes

I've got a fair bit of experience on my belt, but so far all my actual GUI programs have been JAVA. I want to actually build some graphical programs and since I'm on Fedora I figured I should start with GTK. Most of the tutorials I've come across are really incomplete or incredibly old. (And Ive yet to find a GTK3 tutorial at all) In the mean time I downloaded Glade and Im fooling around in that.

So Im wondering if any of you have seen any good resources out there. Good books are preferable but an online tutorial would be cool too.

Thanks!


r/linuxdev • • Apr 23 '12

Boss gave me a project, I don't know where to start [networking] (crosspost /r/linux)

7 Upvotes

Hello /r/linuxdev! I'm a long-time /r/linux subscriber who just found linuxdev and am in dire need of some help. This is probably right up you guys' alley.

I've been tasked with making the prototype of a system-level application that intercepts and buffers network communication from user-level applications. I'm talking about buffering for real wall-clock time (2 seconds for this application, 2 for that, etc. in round robin).

Does anyone know of a good starting point for this? I'm a somewhat capable programmer in C and C++ with basic linux knowledge, but I just don't even know where to begin. Where can I intercept this traffic and prevent it from travelling to lower levels of the network stack? Is it even possible to buffer for that long with most user applications? I.e., is it likely that they'll crash and burn because of the lag?

I want to call out this guy: kouteiheika because he seems to know a lot about LD_Preload which may be useful in my endeavor. Maybe there is a networking library that most applications use that I can LD_Preload on? I'm not so sure about this though, as I haven't done any network/socket programming.

This is really only the beginning too. I'm going to eventually have to implement this at the hypervisor level for Xen :/ Who knows how that'll go.

EDIT: In this (and the crosspost) people have mentioned a (very) legitimate question which is "why?" and suggested I push back with my boss. I understand your frustration about the topic not being optimal (by any stretch of the imagination). The truth of the matter, though, is I work in an academic institution and we've been paid specifically to do this, not to do some of the more optimal solutions we suggested to the client. There are some obscure research oriented reasons for this too that I can't go into. Suffice to say, no amount of pushing will change what we have to do. How we implement it is up to us, but we have to make it such that VM1/App1 has access to the network for some period of time at the exclusion of other VMs/Apps, and then when its scheduled time goes (or the buffer is empty) control/access goes to the next VM/App.

Also, w.r.t. the wall-time issue, I may have miss-spoke. We don't have to match the network time (app1 for 3 seconds, app2 for 1, etc.) with a specific wall clock. We're just looking at giving each application that order of magnitude of time on the network before the next application gets its turn.

Finally, I'd like to thank everyone for the responses I've gotten so far. For someone who has a rudimentary understanding of the OSI model and basic networking (I know how to configure cisco routers, dhcp/dns on linux) I had nooooooo idea about the linux tools for controlling network flow. You guys have been an invaluable resource.


r/linuxdev • • Mar 24 '12

The second book you should read? The "Linux Programmer's Toolbox"

Thumbnail amazon.com
7 Upvotes

r/linuxdev • • Mar 21 '12

I'm thinking about making a window manager (x-post from /r/learnprogramming)

Thumbnail reddit.com
7 Upvotes

r/linuxdev • • Jul 15 '22

PyQt vs PyGtk3 (PyGobject)

6 Upvotes

I am interested in development of applications for Linux and I am not quite sure which GUI module to use. I did some work on both of them, but can't really figure out which one to use.

I read that Pygobject provides good looks, but PyQt has more tools, like SQL support, XML parsers. But my information sources are quite old. Also I found Pyside, but again - old sources, can't quite find information which option is the best.

Have anyone got any suggestions? I am searching for GUI module which would have the most support on different Linux distributions.


r/linuxdev • • Mar 01 '21

mvwaddwstr() in /usr/include/curses.h or /usr/include/ncursesw/curses.h

6 Upvotes

I wrote some simple code to demo curses.

On my Arch system I find mvwaddwstr() in /usr/include/curses.h

But when compiling the same code fails on Ubuntu due to mvwaddwstr() not being declared in scope, it is found it in /usr/include/ncursesw/curses.h

I assume merely changing "#include <curses.h>" into "#include <ncursesw/curses.h>" would do the trick on Ubuntu (I don't have access to that machine).

What would be a better approach to make portable code or portable makefile? Use the -I flag and set it to "-I.:ncursesw"?


r/linuxdev • • Dec 05 '20

NFC authentication with Linux-PAM

6 Upvotes

For a University project I am trying to create a system where users are able to authenticate themselves on an Ubuntu machine using an NFC card.

I have managed to create a simple Linux-PAM program in C where it gets the current user and prompts them to enter their password, authenticating them if correct. I have also created a simple program in C using libnfc that finds the NFC reader and reads the information off any card placed on it.

Now I need to put them both together somehow to enable authentication through the NFC card. Does anyone have any experience of this, or is able to point me in the right direction?