printk in driver - linux-device-driver

I am really new to linux module programming.
I need to some how be able to do some tweak to the ath9k driver in linux.
I finally got the compat wireless source code of ath9k to compile in ubuntu 11.04 and was trying to play around with the code.
I tried using printk to tried to get to see what happen.
First I put printk in the init.c file, the message I printed show up when I use dmesg in the terminal. However, when I tried to use the same printk in another file like rc.c it does not show up at all.
I am wondering why is that?
And is there some other way that I could some how log some information from the code similar to the fprintf. What I need is I need to extract somehow the packet header from the driver.
Thank you
Best Regards.

read about the proc fs, it's a great framework to extract data from device drivers.
once you have registered a device node as proc fs, you can read from it.
once the the read function is called, a callback function you defined is creating the output. this is an excellent way to retrieve data from device.
there are also two other methods, one is sysfs, you can google for it. and the second,
if the the device is a char device, you can implement an ioctrl function which returns the info you need.

Related

How to change GPIO.BOARD TO GPIO.BCM for sensor SHT10

I want two scripts integrate in to one script.
Scripts for sensors SHT10 and MAX31855. Both make use of software SPI.
The SHT10 use GPIO.BOARD and the MAX31855 use GPIO.BCM.
The problem is that I get an error "ValueError: A different mode is already been set." I don't know how to resolve this because both sensors used different libraries. I think that the problem is in those libraries.
Is there an easy solution for this problem.
Running the scripts separately than there is no problem
You can try using GPIO.setmode(GPIO.BCM) and then in the other program using GPIO.setmode(GPIO.BOARD).

Is it possible to send HTTP GET Requests from a Simulink Block?

basically the title says it all. I'm working on a model that needs (there is no way around it) to load data from a website, parse it and pass it onto another block. I thought I could use an S-Function written in C++, which didn't properly work, then I tried to use webread()
which also didn't work in Simulink because I can't use extrinsic functions on the device this will run on.
I thought I could work around it by downloading the file externally and then reading it through fscanfbut it turned out that Matlab CODER doesn't support that as well.
After putting 2 1/2 days into this now, I'm asking myself whether it is even possible to do something like an HTTP Request through a Simulink block. That's why I went here to ask that question. Thanks for every answer!
I figured out a way to do it with a C++ S-Function by now.
I also created a GitHub Repo for it. If you're stuck with the same problem as I was, try to take a look at this. I'm pretty sure it will help you.

VxWorks PCI driver - compilation error

I am trying to write a PCI device driver in VXworks. Even though the source file is in place for the pciConfigLib, after compilation, it throws error stating " undefined function reference".
Any help is appreciated.
Thanks
VxNewbee
I am just going to throw this out there, but if you are in fact calling Pcifinddevice then that is wrong, you need pciFindDevice (case matters)
If that doesn't work, then from the vxworks shell can you show me the output of
lkup "pci"
Also be sure to read the device driver developers guide:
http://www.mecatronica.eesc.usp.br/wiki/upload/0/07/Vxworks_device_driver_developers_guide_6.0.pdf
It doesn't really have a good basic example of how to create a basic driver, but if you are using eclipse, then you should be able to create a new device driver project in there, it does give some good advice however, start from an existing template driver. Also there are other docs that you should be able to access from the wind river support site.
http://www.windriver.com/products/vxworks/

Gtkwebkit, save html to pdf

Last days I search for best and shortest way to convert html files to pdf. Since I create my html files with C program and see them through gtkwebkit which uses cairo it should be some efficient and direct way to convert content of showed page to html with C (I think).
But can't find any example or direction to go on the net.
Until now, among different virtual printers, I find only commandline tools which are maded in perl or which depends on qt what is not wanted.
Please for any suggestion, example or advice to get this functionality from gtkwebkit and if not, maybe something with some tiny C library.
As far as I can tell from reading the documentation (haven't tried it out myself):
Get the main frame with webkit_web_view_get_main_frame().
Create a GtkPrintOperation with gtk_print_operation_new().
Set the export-file property on your print operation to be the name of the PDF you want to export to.
Print the frame with webkit_web_frame_print_full(). Make sure to pass GTK_PRINT_OPERATION_ACTION_EXPORT as the 'action' parameter.
I once wrote some code, to accomplish that without opening a window. But then I ran into a problem with using that code from multiple threads (in a webserver e.g.). I made some research and I figured out that gtk itself is single threaded. So I made my code thread safe, by queuing the print operations to the main thread. Anyway, if it helps, check it out... https://github.com/gnudles/wkgtkprinter

Can an Adobe AIR Application run via the command line output to console?

I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?
Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need to create my own log file? Now that'd be silly.
Take a look at CommandProxy. It is a low level wrapper around your AIR application that lets you send command from AS3 back to the proxy for communicating with the underlying OS. You should be able to add a means of writing to the command line via such a method.
I don't think that is possible, but I'm not completely sure though.
There is a flashlog.txt file which you can configure so all trace() statements are logged to it. Check this post http://www.digitalflipbook.com/archives/2005/07/trace_from_the.php for more info on how to set it up. This is for logging from the browser, but I'm pretty sure it should also work from an air app.
Additionally, you could use SOS MAX from Powerflasher to log to an external console through an XML socket.
By default, trace() will output to stdout.
Your AIR application is one, big trace window if you want it to be.