KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've recently inherited some code at work, this is old 2.4.X linux kernel drivers and I've been tasked with getting them working on a newer kernel 2.6 or greater. I'm running on OpenSUSE 12.1 with a 3.1.10 kernel. I've updated the original code from register_chrdev() to use class_create()/device_create() calls and I can see my devices show up in /dev correctly. My current issue is that the permissions for my device are being set to r/w for user only: crw------- 1 root root 244, 0 Aug 7 07:57 gcanain I know I can "chmod" the file via command line, and or I can set up udev permissions... but is there anyway to do this programmatically, such that when I issue the insmod command, the dev will be mounted with the correct rules in place already? Are there any APIs that might exist that I can call to do this, any options I'm missing in one of these creation APIs? Just to clarify, part of the reason I don't want to use udev rules is that I don't know the names of the device drivers ahead of time. The device drivers are spawned in a loop and so the names are appended with a digit, nNumDevs can be pretty much anything: for (i = 0; i < nNumDevs; i++) { strcpy(Modname,GC_ANAIN_MODULE_NAME); strcat(Modname,"%d"); device_create(c1, NULL, MKDEV(nMajor, GC_ANAIN_MINOR_VERSION+i), NULL, Modname, i); }
Tags (comma-separated)
Save Edits
Cancel