ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have written a simple char module. Sometimes it loads and sometimes not. 2 problems are present and do not always show up.
Problem 1:
My register_chrdev(MY_MAJOR, "My Mod", &fsOps), with MY_MAJOR=120, works just fine. However if I reboot and try to load the module, I can't register 120. If I change MY_MAJOR=150 and recompile, works fine. Until I reboot.
Problem 2:
MY_ADDRESS = 0x3f8
MY_RANGE = 8
create_region(MY_ADDRESS, MY_RANGE, "MY_MOD") fails although check_region succeeds.
1) Try with major no between 241 to 255 for testing purposes
for ore detail about device nos see,
documentation/devices.txt (orsomething similar) on source code path
2) check /proc/iomem (i exactly don't remember name as i am sitting on window machine) serch for something similar (in /proc)if not fonund to check wether the region is allocated.
1)MN's in the ranges 60 to 63, 120 to 127, and 240 to 254 are reserved for local and experimental use. No real (serious) driver would be assigned such numbers).
2)Dynamic allocation:
If the major number specified, is set to 0 (register_chrdev), then the function selects a free number and returns it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.