C - Linux create sound in kernel mode [closed] - c

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need o write a kernel mode driver that plays a note when a key is pressed. I can capture keystrokes but I have no idea how to play sound from kernel. What do I have to do to play a sound? I am brand new to creating drivers.

I need o write a kernel mode driver that plays a note when a key is pressed.
Why?
Seriously, why. What's the reasoning behind this "need"? What's the true reason for the need to play a sound? Maybe there is a better way.
Assuming a PC, with the pcspkr module loaded, you can of course call its functions. But if you want to play something through the soundcard, you'll essentially have to "open" an ALSA device (inside the kernel), and call its fops, all along while user space may do the same thing.

Related

Build a File Monitoring System [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have just started programming and would like to implement a file monitoring system from scratch in C.
I have used the Watch Service API in java but I would like to learn how to build one from scratch. I would really appreciate some assistance and guidance.
Thanks.
You can:
either rely on existing system calls that will push you notifications on file system modifications (eg: inotify)
implement your own kernel module that will intercept file system modification and notify you (if you really want to reimplement the wheel)
use a polling-approach, rebuild the filesystem tree in-memory and compare it every second or so. This will be very cpu/io/memory consuming, but it can be instructive.

Redirect messages directed at the GPU [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is there anything as low level as that on any Linux distribution? My overall goal is to redirect the message (instruction) meant for the GPU.
That means I would have to be able to program a driver between the CPU and the GPU which redirects any message to where I'd like (like a packet sniffer, but for GPU instructions and one that would stop the info there).
Is there any native Linux support for this kind of thing? Where do I start and what OS is most recommended for this kind of access?
You would need to modify the GPU driver. There you can insert logging or whatever other redirection you have in mind. Since many graphics drivers on Linux are open-source, this should be possible for many graphics cards. But take note that it won't be portable--you'll need to write some separate code for each major variant of GPU you want to support.
If you have something more specific, like that you're trying to capture OpenGL commands, that might make things easier.

How to write my own virtual machine like VirtualBox? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to write virtual machine. Ideally I want to write program, which will be run(emulate) windows 7(from .iso) and show it in window on Windows 7 parent. But I can't understand how to do it. I understand how to emulate cpu, for example, just write wrapper(interface) which will be provide real cpu resources(http://www.codeproject.com/Articles/43176/How-to-create-your-own-virtual-machine), but what next? how to run OS, which will be use this abstraction interface of cpu. Bios starts OS, should I emulate bios? how to do it? From what should I start? Please, describe me the basic steps to implement my task.
Thank you very much!
I'm sure years and years of work go into these type of programs. However, to get a taste of emulating CPU and coding it yourself, have a look at nand2tetris.
It starts by looking at the logic and arithmetic first, slowly working your way towards program control, high-level language and making a operating system.
Hope this helps!
(BTW it provides all materials and software for free!)

Save data in memory on LPC1768 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying save data in memory on LPC1768. I want to load data when I put on the microcontroller. I expect data don't erase when I put off the machine.
I'm programming in C. I would need a example code in C but I fount a example code in C++ only: http://developer.mbed.org/users/okano/code/IAP/
Thanks everybody. Bye.
You can write data to the flash on the LPC1768 using the IAP commands documented in the user manual in Chapter 32 "Flash memory interface and programming". Specifically, section 32.8 documents the IAP (In Application Programming) commands that let the program running on the device write to flash. Or you can write to the flash using the ISP (In-System Programming) serial port protocol documented starting in section 32.3.
You can use a tool like Flash Magic or lpc21isp to program using the ISP protocol if you don't want to roll your own.

Licensing c program [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How would i licence my c command line program, e.g limited functionality without a serial number?
Depends what licensing means ...
Write the license text into the source code resp. show the license text when installing or starting the program.
If you want prevent users from copying the program, things get complicated, you might need some hardware dongle.
Or just make it GPL and give the source code away ...
Include a EULA (End User License Agreement) in your program which users will have to accept while installing/using your application. You can get lots of sample EULAs in Internet. Replace the Names appropriately. But remember, you are gonna do things at your own risk. Read the EULA well, modify it to suit your needs.

Resources