Programming :: Find The Device Name For Ioctl (sd, SIOCGIFINDEX, &ifr) Call?
Feb 12, 2010
Hi I am trying to add the device by using followig code strip and it says that eth1 is not defind in the code.
strncpy(ifr.ifr_name,eth1,IFNAMSIZ);
if (ioctl(sd, SIOCGIFINDEX, &ifr) == -1) {
return 0;
}
How do I write down the DEVICE name in the ifr.ifr_name structure ?
View 2 Replies
ADVERTISEMENT
Apr 6, 2011
I am having the following problem. The following code works fine on my P.C. Ubuntu x64, and on a jetway mini-itx board with an atom processor. The problem is, the same code doesn't work on the intel equivalent of the jetway board. I thought the maybe, I didn't have the port configured right, so I turned on Hardware Flow control and also tried turning on the modem bits I needed with TIOCMBIS. Neither worked. Here is the code. There are two threads, one of them, respsponding to the client, and using the RTS and DTR pins to power two relays. The other, manages listening to CTS and DSR for input. Here is the class with the first thread.
Code:
/*
* DigitalIOCore.cpp
*
* Created on: Nov 1, 2010
* Author: jonathan
[code]....
View 9 Replies
View Related
Apr 8, 2010
I have a kernel function device_ioctl(). How do I define it in file_operations?
1. struct file_operations memory_fops = {
ioctl:device_ioctl
};
2. struct file_operations memory_fops = {
.ioctl=device_ioctl
};
3. struct file_operations memory_fops = {
device_ioctl
};
which one is the right one?
View 1 Replies
View Related
Jul 22, 2011
Please send me the code how to assign ipv6 address using ioctl system call using C.
View 1 Replies
View Related
Nov 1, 2010
I have a write call to a ttyACM serial device that blocks after several hundreds bytes are written.I'm writing in ~25 byte chunks, so I have 5-8 successful writes, then the next write blocks forever.I can bypass the blocked call using select, but I can never call write again without closing and re-opening the port.
The serial port is opened correctly because I can read from it just fine. Write permissions are correct, and it's opened RW.The code is likely correct because I tested the same code using the same device on a pure RS-232 serial port, and it worked fine - no block. Is there anything to know about the linux ACM module?It's my understanding that write calls basically shouldn't block.They're supposed to return -1 if there's an error.
View 1 Replies
View Related
May 24, 2010
I have a problem with USB modem SpeedTouch 330 in SUSE
When I execute:
Code:
I see this:
Code:
I have checked command 'lsmod' and it returns
Code:
In general I see speedtch is several times in the output of lsmod
When I check this:
Code:
I see
Code:
Why I cannot establish a connection to the internet?
View 1 Replies
View Related
Jul 4, 2011
I want to modify ioctl TIOCMWAIT to return the same thing that ioctl TIOCMGET returns. Currently wait returns an int of zero or -1 when a change in status occurs. Why not make it return the new status?
This will make the operation faster by not requiring another call to ioctl.The extra call requires 2 to 16 uSeconds to complete on my x64 laptop. How would I make this proposal to the kernal people?
View 1 Replies
View Related
Jun 24, 2011
Now i have a problem.I want to used a hid usb device under linux 2.6.11.But i can't know how to used ioctl function to send and receive data to a hid device
View 3 Replies
View Related
Jun 13, 2010
I'm having some difficulities with truecrypt and cannot figure out what's wrong since this is my first attempt to create hidden encrypted partition. I'm using ubuntu 9.10 64b with latest 6.3a truecrypt. After using truecrypt gui (just command truecrypt) I've tried: create volume-->create volumne within a partition/drive-->hidden trucrypt volume --> select some /dev/sdX by my choice --> select aes & sha512 --> password --> and format it.
when formating finished message "wrong ss, swith or wrong superblock of /dev/loop0" appeared. I've got no idea what could I do with it neither know whats program trying to do! Ok formating's done, then if you're trying to mount that partition then I would expect prompt for password, but that did not happen ...
EDIT: sudo mount /dev/loop0 /media/tmp/ also complaint about wrong superblock, but that does not ring any bell since i've got no idea what /dev/loop0 is or is for...
EDIT2: I've tried another approach also:
sudo truecrypt -t -c
sudo truecrypt -t /dev/sda3 --filesystem=none
but the first command finished creating 100G drive in 1 sec (nonsense) and latter one prints:
Error: device-mapper: reload ioctl failed: Invalid argument
Command failed
View 3 Replies
View Related
Dec 5, 2010
The error message I keep getting during mounting is:-
device-mapper: remove ioctl failed: Device or resource busy
This is from ane external USB HDD I use as a backup device. I've tried formatting it as ext4 ane encrypting it from the command line
# mkfs.ext4 /dev/sdc1
# cryptestup luksFormat /dev/sdc1
which run without errors but an attempt to mount throws up the above error as well as saying - you must specify the file type (tried that) - and fails to mount. I've tried using YaST to format and encrypt it which throws up the same error when I run mount but actually does actually mount the filesystem Googling around has brought up info saying that it's probably a race condition brought on by invalid udev rules. I've got a (mostly) working system and the udev rules documentation leaves more confused than when I started.
View 8 Replies
View Related
Feb 28, 2011
I was trying to get the ssid of WLAN through the following C program
What is the cause of this error?
View 1 Replies
View Related
Jul 21, 2010
I'm creating a usb device driver that needs to be able to read from two different endpoints. I couldn't see any way of having two read functions in the driver, so I got round this by reading from one of the endpoints with read, and the other with ioctl.However this hasn't worked, the ioctl call from c returns -1. I added a printk command in the driver in the ioctl function, however looking at kern.log I can see that this function is never being called. Does anyone have any ideas as to what the problem called be, or a better method of being able to read from two different endpoints?
View 2 Replies
View Related
Jan 18, 2011
I just want to read and write some values (integer) to my driver. I used put/get user but always getting errors.
driver
Quote:
int Wert;
static int device_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsinged long arg)
int ret;
[code]...
Quote:
int WERT
ret=ioctl(fd, SETIT, WERT)
ret=ioctl(fd, GETIT, WERT)
if i say in C++ WERT is 5 the value arg of the driver becomes 5 but not WERT the returnvalue of get and put user is -1 so it failed.
View 12 Replies
View Related
May 19, 2011
I have a usb to serial converter which i plug in to Ubuntu Natty.I see that on every reboot this seems to come up as a different device name, say ttyUSB0, ttyUSB3 etc.I want to write a simple shell script to get the name of the device in a shellscript.
View 1 Replies
View Related
Sep 10, 2009
I've read hundreds of threads on this problem but they seem to be intermittent and the resolution has been using a different kernel version.
I'm using the latest kernel but I still have this problem
Running Logical Volume Manager gui and attempting to extend the volume results in the same error.
View 3 Replies
View Related
Jul 1, 2010
I use ioctl to get the console window size (the SSH window). I use the following code:
struct winsize ws;
int returnValue = ioctl(pCommandStructure->terminal, TIOCGWINSZ, &ws);
int numberOfColumnsOfTerminalWindow = ws.ws_col;
When I debug on linux pc, it gives me the correct window width. But after I try it on router (this is my enventual place where my code shall run), ioctl always give me 0 width, that is, numberOfColumnsOfTerminalWindow == 0. but the returnValue is 0 which means that the function call succeeds.
View 2 Replies
View Related
Feb 1, 2010
I'm trying to get sound to work on an embedded board. The boot says ALSA is present and sound chip is present. So I try to open the device with:
The hardware manufacturer assures me the device is hw:0,0 so I set device to:
This gives me:
So I'm presuming the advice that I use hw:0,0 must be wrong? So I need to find a way of working out what the device id is. I've tried default, no effect, then tried the command asoundconf list, which returns an error. I'm using a min linux build on an embedded system (busybox) so is there a way to find my sound device.
View 2 Replies
View Related
Jun 23, 2010
I want to know that in my Linux box under "Network Configuration....>Devices" i can see Device eth1 and Nickname eth0.
The ambiguity in my mind is when we want to down network interface we should call it by device name or nick name
Example
Or
Code:
View 4 Replies
View Related
Jul 1, 2010
I use ioctl to get the cosole window size (the SSH window).
I use the following code:
When I debug on linux pc, it gives me the correct window width. But after I try it on router (this is my enventual place where my code shall run), ioctl always give me 0 width, that is, numberOfColumnsOfTerminalWindow == 0. but the returnValue is 0 which means that the function call succeeds.
View 2 Replies
View Related
May 15, 2011
Recently, I created a device sc0 through device mapper. The divice could be found in /dev/mapper/sc0. My problem is that the device doesn't exist in /dev/partitions which will block my following test.BTW, I found dm-0 in /dev/partitions. Is it the same as /dev/mapper/sc0? But the device /dev/dm-0 doesn't exist!
View 2 Replies
View Related
Aug 23, 2011
I've bought an X10 Home Automation USB interface: the CM15.
This is the information lsusb gives:
skerit@KIP-DU-SKER:~$ lsusb Bus 008 Device 002: ID 0bc7:0001 X10 Wireless Technology, Inc. ActiveHome (ACPI-compliant)
But this tells me nothing about where the device file is! How can I find that, or create one myself?
View 1 Replies
View Related
Feb 23, 2009
I was wondering if there was a way to add a switch to a gcc/g++ call everytime. I have a few libraries that I need to compile for different processors. Each has a makefile which calls gcc to compile. Here is the best option I could come up with so far:Include a Makefile and define CC as gcc -mcpu=xxx.
View 4 Replies
View Related
Jan 8, 2010
i have only basic knowledge of C so guys plz help me...is C language support call the C executable inside the C ?example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C <my C program call the executable ( A ) > .
View 9 Replies
View Related
Apr 3, 2011
in below program why was new_args[0], rather than the reference the_cmd, passed to the execvp system call?
Code:
/*
A _very_ limited shell program
[code]....
View 2 Replies
View Related
Jun 1, 2010
I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.
View 4 Replies
View Related
Sep 29, 2010
There are examples everywhere about calling f77 subroutine from IDL, but I have not found any material about IDL calling fortran written in f90 way(free style). I tried the following example, but write the subroutines in free style. When I run the makefile, it gives an error 'undefined reference to main_'.
Code:
SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
INTEGER*4 argc, argv(*) !Argc and Argv are integers
j = LOC(argc) !Obtains the number of arguments (argc)
[code]....
View 1 Replies
View Related
Mar 17, 2011
I just compiled my first own kernel (I'm using Arch Linux), following the tutorial on the german site. Now I tried to boot it, I ended up failing with this message: Code: Waiting 10 seconds for device /dev/sda1 ... Root device '/dev/sda1' doesn't exist, Attempting to create it. ERROR: Unable to determine major/minor number of root device '/dev/sda1' Here is the important part of my menu.lst:
[Code]....
I simply copy&pasted the Arch-entry, i.e. I also had the disk by uuid there. The failure message was the same, just the root device name was the different name Also, at first I did not have the initrd line in my menu.lst (as written in my tutorial that I may not need it). In this case I had this error message:
[Code]....
View 10 Replies
View Related
Nov 29, 2010
In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab
View 4 Replies
View Related
Oct 8, 2010
I am facing issue in my OPENSSL code. I have written openssl client. It sends request to the host and receives response for that request.
My problem is, it connects, sends request successfully to host at first time only in sencond attempt it fails on SSL_write(). where SSL_get_error() returns SSL_ERROR_SYSCALL error.
In that ERR_get_error() returns 0. man page shows "If ret == 0, an EOF was observed that violates the protocol".
Code Snippet.
w=SSL_write(SSLRequestData.ssl,c2s,c2sl);
switch(SSL_get_error(SSLRequestData.ssl,w))
{
case SSL_ERROR_NONE:
if(c2sl!=w)
[Code]....
View 3 Replies
View Related
Dec 8, 2010
I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know.
I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..
View 2 Replies
View Related