I would like to programmatically set a CAN device through C.
I can do this using IP Link through the terminal with:
ip link set can0 up type can bitrate 500000
How can I achieve this using C
I've looked around the iplink code on GitHub but I can't seem to work it out.
Could you please send me in the right direction or even provide an example? I am far from fluent in C
Related
I have set #define DEBUG 1 in sicslowmac.c
but the debug messages are not being printed in packet capture display of
cooja simulator. I have tried using printf in every function of sicslowmac.c. Also tried #define DEBUG DEBUG_PRINT but no success.
I have used sky motes for udp-server.c and udp-client.c in
rpl-udp. I
am using latest build of contiki. What might I be doing wrong?
I am able to print debug messages from cc2420.c and sicslowpan.c but not from sicslowmac.c.
P.S: I have not made even a single change to any of the other files. So let not the question be treated as too broad or primarily opinion-based.
I got help from contiki mailing list.
We need to tell contiki which RDC driver to use. By default it is nullrdc_driver. I changed it to sicslowmac_driver.
But then I got undefined reference to sicslowmac_driver in contiki-sky-main.c of sky platform. I could solve it by adding core/net/mac/sicslowmac in Modules of Makefile.sky.
There is an input format option to ffmpeg -- x11grab which allows one to capture specified region and output it to file/stream. I'm trying to do the same thing programmatically, but i haven't found any non-basic tutorials/reference for ffmpeg API.
I wonder, how it is possible to open x11 region with avformat_input_file or something like this. Or should i do it with XCopyArea/etc?
(Any programming language will satisfy)
There are many applications that take a screenshot. Major hint: it's open source, use the source. If you can't find the code in ffmpeg, any example application will do:
http://git.gnome.org/browse/gnome-screenshot/tree/src/screenshot-utils.c#n425
This is gnome-screenshot source code. This example uses gdk_get_default_root_window().
I am working under Linux, with two physical ethernet interfaces.
I have grouped the two interfaces to a bonding interface for backup... and it works.
I would like to know if there is any way to know, from my C user program, what is the active interface.
Thanks
Look at /sys/class/net/bond0/bonding/active_slave and read it using a program or code of your choice. (Replace path accordingly if using an interface name different from bond0.)
Another method to know it (tested on Debian) is looking at the file /proc/net/bonding/bondX. Replace bondX with the name of your interface.
Is there any way to retrieve the mac-address for the given ip-address from the ARP table without providing the Interface name ??
I do know the procedure of retrieving the mac address using ioctl call but in that case I should provide the interface name .. :(
One Crude Solution: Read /proc/net/arp file ... :( .. other than that .. any system call or anything else where i can retrieve the mac-address without the need of interface name ??
NOTE: Simple C based solution not interested in scripting libraries.
NOTE: I am expecting a *NUX based solution rather than WINDOWS based one.
I do know the procedure of retrieving
the mac address using ioctl call but
in that case I should provide the
interface name
So all you need is a way to find the interface name associated with a given IP. The ioctl SIOCGIFCONF will give you that.
i am trying to run a source code of win avr . after making the makefile when i try to send it using avrdude it is giving me error.
Please any one can help me
See the avrdude homepage for more information http://savannah.nongnu.org/projects/avrdude/
Check that you are setting the correct part no, port and programmer when calling avrdude, eg:
avrdude -p m8 -c stk200 -P lpt1 ...etc
If you're using MFile to generate the Makefile, then these should be set for you. Open the generated Makefile using your editor and check the values of
MCU
AVRDUDE_PROGRAMMER
AVRDUDE_PORT
Make sure they correspond to your microcontroller and programmer.
In the absence of better information on the actual error, here's a list of things to check when programming microcontrollers:
Is the power supply correct?
Is the oscillator running?
Is reset correctly configured?
Do you have proper bypass capacitors on the power pins of the target chip?
Are the programming wires correctly connected?
Are there any electrical conflicts on the programming lines?
Is the avrdude powering it, or is the project self powered?
What's the voltage at the pins on the microcontroller? Is it correct?
What's the overall circuit current draw? If it's high or low, look for shorts and opens.
Did you specify an erase command before a program command?
Does the mass erase or blank command work?
Can you see the programmer on the serial/usb/etc port?
Have you swapped out the target chip?
-Adam