Programming :: Block Device Driver ?
Nov 30, 2010Is there an easy example of a block device driver I could follow as a guide to write my own module?
View 5 RepliesIs there an easy example of a block device driver I could follow as a guide to write my own module?
View 5 RepliesHow do you go about getting the raw size of a block device under Linux from within a C program? And I mean the raw size of the block device itself, not a file system that may or may not be installed on it. And I'd like to be able to get the raw size of any block device, from hard drives (e.g., /dev/sda) to LVM partitions (/dev/mapper/vg0-home) to loop devices to anything else that is a Linux block device.
View 3 Replies View RelatedI'm setting up a machine that's going to be used to test randomly connected tape drives one at a time, and as such, I'm writing the test routine using mt in a bash script, for user-friendliness. The problem is the block device name changes on occasion as tape drives are swapped out and busses are rescanned, so I can't "hard code" a block name into the script.
I know programs like lsscsi and hwinfo will give you block device names as part of their output, but I can't seem to grep anything in such a way as to have the final output be just the block name (ie /dev/st2, or optimally 'st2'), so that I can just have the script read said output, and drop it into the necessary variable.
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.
I did searched you tube but my results were not great.I have 2 books on KernelProgramming.I feel I need if some where I can get a video tutorial which can help me to understand how to develop a Linux Device driver that will be great.I had a look at Greg Kroah Hartmans video lecture of developing patches on ......I have been reading books and a lot of stuff.So I wish if I could get a video lecture that would be better
View 1 Replies View RelatedI know, I know..."How long is a piece of string"?
I have one of these devices:
[URL]
Of course, it's Windows only, and XP only at that. However, the data that needs transferred between the device and the computer should be fairly basic, unless it offloads a lot of processing to the computer. I'm not a programmer, nor do I play one on TV, but I have written some fairly complicated microcontroller programs and some basic Java GUIs. Besides writing the actual code, how hard is it to do whatever needs done to make a Linux device driver, apart from the code to make the device work?
How to do device driver programming in Ubuntu 10.04?
View 2 Replies View RelatedI've a problem with character device mounting. I've a character device module code. Here is the code
Code: /* chardev.c: Creates a read-only char device that says how many times
* you've read from the dev file
*/
#if defined(CONFIG_MODVERSIONS) && ! defined(MODVERSIONS)
#include <linux/modversions.h>
#define MODVERSIONS
[Code]...
I wrote a small hello world type of character device driver. When I type echo -n "abcdef" > /dev/bond and do a cat /dev/bond then only last "f" of above input abcdef is displayed rest nothing is displayed. I asked this question earlier and some people suggested me some modifications I have done and experimented all that but I am unable to catch the error.
Here is the code
Code:
/* Necessary includes for device drivers */
#include <linux/init.h>
//#include <linux/config.h>
#include <linux/module.h>
[Code].....
i woul like to know if i could get help in writing a charater device driver for communication between two pc's in linux using RS-232 serial port.
View 5 Replies View RelatedI have a user Application for transferring the data from one PC to the other PC using Ethernet Port, can we create a device driver for that ?? that means it should act like a virtual device, if we write data into /dev/some file, it should go the other PC
View 3 Replies View Relatedi am trying learn to program linux kernel modules and smoothly transition in device driver programming. I have a year and a half worth of programming in C and have been using linux for years!! But my question is how do i compile a module? I got as far as coding it but am stuck as of now.
View 2 Replies View RelatedI am currently using fedora 11 kernel 2.6.29 version, i wanted to write device driver for usb to detect my own device. My project is radio with computer. My fm radio get connected to usb port so i need to write h/w interfacing program.
View 1 Replies View RelatedThe error "USB device 6 (vend/prod 0x603/0xf2) is not claimed by any active driver." is in dmesg every time I connect my Logitech keyboard to my system. I also tried (all with the same error):
- Memory stick
- DVD-burner
- Compaq mouse
I have an external hard disk drive and I would like it to be recognized with the same name (e.g. /dev/sbd) after each boot.
Is there any way to make that?
I want to test LVM+Raid. When I was testing ZFS on Solaris, I was able to create regular files, and use those as disks for testing.I tried creating a regular file full of zeros w/ dd, then partitioning that. fdisk seemed to be able to create a partition on the regular file, but mkfs and parted couldn't work with it. Is there any way to create fake block devices for testing?
View 4 Replies View RelatedWhen I try to mount the /dev/sdd1 device then it give errormount -t ext3 /dev/sdd1 /4hdmount:/dev/sdd1 is not a valid block device
View 9 Replies View RelatedI created LVM and formatted it. But at the time of mounting it getting this error message ".....not a block device".
View 3 Replies View RelatedI have installed live cd on usb pendrive. Everything works great. How can I find out which device driver it is using? Where are the device driver files stored? How do you specify the device driver when mounting a device?
View 3 Replies View RelatedIs it possible somehow to block some bluetooth device with specif address (mac) ?
(like iptables block by mac)?
I built a Raid5 volume with 3 SATA II hard disk drives. Further I have a system disk conected through IDE. During the first setup the IDE disk becomes sda, the SATA II disk sd[bcd] respectively. Now, sometimes the device names change after reboot - why ever... E.g. one of the raid5 disk become sda and so I got an error message during the boot procedure regarding the raid set. Curious, when the system is up and I stop and restart the Raid5 volume it comes up and runs fine. Because I'm currently at work I can't post any more detailed config files at the moment.
View 2 Replies View RelatedI am trying to debug the issue of a desktop that has for the last two weeks started having kernel panics at boot time. This machine has been running flawlessly for the last 8 years, and has had three OS upgrades. I am using memtest to try to understand the issue. The following is part of the memtest output: Reading all physical volumes Buffer I/O error device hdc logical block 0 Buffer I/O error device hdc logical block 15
Illegal node for this track or incompatible media (asc=0x64 ascq=0x00) The failed "Read 10" packet command was /dev/hdc: read failed after 0 of 4096 at 0 Input/output error and similar set of mesaages After this udev checks correctly, and hardware, storage and audio are initialized However sometime in the middle of the boot process, a kernel panic occurs with message Kernel panic -- not symcing : Fatal exception in interrupt
* I am implementing mass storage device on a test board.
* It contains NAND flash.
* Using corresponding "udc driver" and "g_file_storage" I could make my test board enumerate as mass storage device on my Linux machine.
* my 16 MB pen drive (test board) is now ready for read/write.
But there are some Bad Blocks on the NAND.Hence copy is not complete. Although on Linux machine there is no error message. Now , what is there in a normal pen drive which manages the Bad Block or what am I missing so that such Bad Blocks are managed.
Here is the error I get on my test board :
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5664
Buffer I/O error on device mtdblock2, logical block 708
[code]....
I want to keet some data on windows dir. I have tried the below command and giving the below error.
[root@xyz0044 ~]# mount -t cifs //10.48.64.52/jata -o username=domainv.kumar3,password=xxxx /mnt/backup
mount: block device //10.48.64.52/jata is write-protected, mounting read-only
mount: cannot mount block device //10.48.64.52/jata read-only
I am running RHEL5.5 its a fresh install and we are testing Xen Virtualization. We are wanting to use our iSCSI SAN for the VMs. I have created the initiator iqn, and discovered the target address. We are connected to the target, but there is no new block device in /dev.
[root@xxxxxxxx etc]# netstat -a | grep iscsi
tcp 0 0 *:iscsi-target *:* LISTEN
tcp 0 0 xxxxx-netapp.okc-:44840 xxxxxx-iscs:iscsi-target ESTABLISHED
tcp 0 0 *:iscsi-target *:* LISTEN
[Code].....
I have 2 hdds, with encrypted / and /home. Besides there are four other (encrypted ext4) partitions I use rarely. In Fedora 11 at boottime I gave the luks passphrase for / and home and the system booted as intended.
Whenever I needed those extra encrypted partitions I mounted them in Nautilus. Now, in Fedora 12 at boottime dracut tries to open all the encrypted partitions, / and /home are mounted fine, but opening all the other partitions gave the following messages in messages.log:
Quote:
dracut: luksOpen /dev/sdb6 luks-02a0e706-a26f-4019-a2a0-88a0366a994d
kernel: Buffer I/O error on device dm-0, logical block 124
kernel: device-mapper: ioctl: unable to remove open device temporary-cryptsetup-304
kernel: Buffer I/O error on device dm-0, logical block 124
kernel: Buffer I/O error on device dm-0, logical block 124
[code]....
...and these messages are repeated with the other partiitions, and the boot time takes very, very long. How can I tell dracut to ignore those extra encrypted partitions at boottime?
I can browse the iso image easily enough with a loopback mount, but when it comes to mounting the actual CD (which I did first), I get:
Code:
$ sudo mount -t udf,iso9660 /dev/dvd /mnt/dvd
mount: block device /dev/dvd is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/dvd,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
/var/log/messages isn't very helpful, either:
Code:
Jul 15 15:15:56 bkorb-dt kernel: attempt to access beyond end of device
Jul 15 15:15:56 bkorb-dt kernel: sr0: rw=0, want=68, limit=4
Jul 15 15:15:56 bkorb-dt kernel: isofs_fill_super: bread failed, dev=sr0, iso_blknum=16, block=16
$ md5sum openSUSE-11.3-DVD-x86_64.iso
adf5d2a0a03c1e3aaf102fd6a4771b87 openSUSE-11.3-DVD-x86_64.iso
I burned it with K3B and it gets the same result trying to mount it. K3B seems to know that the image is an iso9660 and is able to display the various 9660 id fields just fine. It just won't mount.
i have a inspiron 1520 laptop which is starting to slow down some so i thought linux would help because all i do is internet use, so i download it from another computer and mount it to a usb flash drive like the site says, (netbook remix latest version) then i put it in my laptop and it loads all the way and i press try and after about 10 minutes of loading it lets me try. so that was ok really slow but i thought id install it to hard drive to see if it improved speed. so the next time i start my laptop i get Buffer i/o error on device loop0 logical block xxxxxx so i redo the usbflashdrive no errors switch usb ports and same thing, ive done the switch usb ports and redo the flash drive about 4 times im really getting mad at linux before i even have it installed.
View 1 Replies View RelatedI'm trying to upgrade my kernel. When i get to the step where i should build the img for grub (i guess the command below is doing that) I get this error: yaird error: bad device link in /sys/block/sda (fatal)Since I installed debian using a USB drive, HDD1 was /dev/sdb and HDD2 was /dev/sdc, the USB was /dev/sda. Is there a way to force mkinitrd.yaird to build the img for /dev/sdb?
View 1 Replies View RelatedI had installed the CENT OS 5.3 it is installed when i rebooted it gives me error continuously.
Buffer I/O Error on device sda, Logical Block 0
ata4.00 : exception Emask 0x0 SAct 0x0 action 0x0 frozen ......
ata4.00 : status: { DRDY }
why it has giving the error.i have Intel based hardware Core II Duo with 1 GB ram check with sata hard drive 120 GB.