devices - Is there a kind of '/dev/null' to fake output file path?

Let says that I have a CLI which transforms a file_a into a file_b like so:transform --input /path/to/file_a --ouptut /path/to/file_bI have developed a program that use this CLI and need to unit test it when the CLI is executed. But I don't want my tests to deals with disk writing operation.Does a fake drive exist on Linux where I can write useless files with no persistence?...Read more

ssd - ECC on a single block device

I have an SSD that I suspect failing silently now and then. I have run badblocks on it and it is clear that it is not bad sectors but might instead be some race condition in the electronics, in which case a retry would probably read the data correctly.Normal magnetic disks have some ECC to correct errors by taking up more space. Can Linux add an ECC layer on top of my block device?I am thinking of something similar to device mapper, so maybe:dmsetup create-ecc /dev/orig /dev/mapper/with_eccso any read and write to /dev/mapper/with_ecc will be c...Read more

look up the device from its tty file?

Here is from my Ubuntu$ ls /dev/*tty*/dev/tty /dev/tty17 /dev/tty26 /dev/tty35 /dev/tty44 /dev/tty53 /dev/tty62 /dev/ttyS12 /dev/ttyS21 /dev/ttyS30/dev/tty0 /dev/tty18 /dev/tty27 /dev/tty36 /dev/tty45 /dev/tty54 /dev/tty63 /dev/ttyS13 /dev/ttyS22 /dev/ttyS31/dev/tty1 /dev/tty19 /dev/tty28 /dev/tty37 /dev/tty46 /dev/tty55 /dev/tty7 /dev/ttyS14 /dev/ttyS23 /dev/ttyS4/dev/tty10 /dev/tty2 /dev/tty29 /dev/tty38 /dev/tty47 /dev/tty56 /dev/tty8 /dev/ttyS15 /dev/ttyS24 /dev/ttyS5/dev/tty11 /de...Read more

devices - Command to generate /dev/disk/-by-path/ name on a system without udev daemon

On most Linux systems udev usually creates symlinks in/dev/disk/by-uuid//dev/disk/by-path/which point to actual device nodes (/dev/sda, /dev/sdb, etc).I don't have udev on my system, and I would like to generate these symlinks manually. I know I can use blkid to generate the by-uuid name.But how can I generate the by-path name for a given disk (e.g. /dev/sda1) without using udev?Specifically, I am looking for a way to find which of my disks is the disk connected via iSCSI from host 10.1.14.22. It could be sdb, or sdc or perhaps other, since I a...Read more

devices - static /dev/name instead of /dev/sda /dev/sdb

I have a problem with boot process where my system partition starting as /dev/sda sometimes as /dev/sdb and it's causing for me a problem with disk which I'm connecting On the controller I have connected 5 drives and 1 esata port for dock.System is installed on the ssd driveRaid md0 is created from 4 drives.For all other devices I`ve created static entry in /etc/fstab #### Automount for any other devices - experimental/dev/sdf1 /media/user/HDD1 auto rw,user,noauto 0 0/dev/sdg1 /media/user/HDD2 auto rw,user,noauto 0 0/dev/sdh1 /media/user/HD...Read more

Get video device on embedded Linux SoC

I'm trying to find the camera module device of an IP camera (running Linux), without much success.My main objective is to find the camera stream, so I can attach an RTSP server.Update 26/02/2019Found libs related to OpenMAX (OMX). I've been trying to cross compile GStreamer with gst-omx to see what I can do with this, but still without success.Someone familiarized with OMX that doesn't mind giving some pointers?$ find / -iname "*omx*"/lib/libOMX_VSRC.so/lib/libOMX_AVQE_A.so/lib/libOMX_BELA.so/lib/libOMX_IJPE_ENC_HW.so/lib/libOMX_VMFE.so/lib/lib...Read more

devices - Why I have two /dev/sdx entries with a single disk?

In my laptop (running Linux) I have only one SSD, connected to the SATA3 port. Why I have two sdx entries in /dev directory?In particular I see /dev/sda and /dev/sdb, and /dev/sda is the SSD:# fdisk -lDisk /dev/sda: 128.0 GB, 128035676160 bytes, 250069680 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesIdentificativo disco: 0x00034e4bDispositivo Boot Start End Blocks Id System/dev/sda1 * 2048 125954047 62976000 ...Read more

disk - How do I get my DVD-RW to mount as a writable device instead of ROM?

I am trying to use my laptop (running Debian Jessie) and an external USB DVD reader/writer to burn an ISO to a DVD-RW.However, upon inserting my disk, it appears to have been detected as read-only:# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsr0 11:0 1 700.1M 0 romThe following appears in dmesg when I connect the reader:[10549.386006] usb 1-1: new high-speed USB device number 10 using xhci_hcd[10549.522596] usb 1-1: New USB device found, idVendor=152e, idProduct=2571[10549.522618] usb 1-1: New USB d...Read more

devices - Is it OK to just copy /dev/random and /dev/urandom?

I'm setting up some stuff - exactly what probably does not matter.Anyhow I got an error from my application that indicated that /dev/random and /dev/urandom were needed but missing.So I copied them over from a Linux build that had them, and then everything worked fine.Is this OK? What problems might occur because I did this? If this is not oK, is there a "correct" way to create /dev/random and /dev/urandom?...Read more

How can I disable an input device?

I have a broken laptop built-in keyboard (The shift-button sometimes gets stuck down). I exclusively use an external keyboard, but the internal keyboard interferes with it. (I can not unplug the device.)I can disable with xinput, but it becomes enabled again (see Permanently disable keyboard).I have identified the device.sudo lsinput/dev/input/event0 bustype : BUS_I8042 vendor : 0x1 product : 0x1 version : 43841 name : "AT Translated Set 2 keyboard" phys : "isa0060/serio0/input0" bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP...Read more

Creating a device similar to /dev/random from a script

I am writing a program for which I will create a script to generate test data in a specific format. How can I create a /dev/myprogram device that would work similar to /dev/random (preferably in the subdirectory of /dev/, e.g.: /dev/test/myprogram)? Can I attach any script to such device or do I have to make a C program using some (which?) low level APIs?Do I have to return one byte at a time or can I setup the device to always return specified amount of bytes, greater than 1?I am using Ubuntu 14.04, though I am looking for a generic answer tha...Read more

Is it possible read every serial device's data?

Reading serial data is something ordinary when comes from devices connected by direct serial 9-pin cables. But happens with usb devices ? Considering that actually USB is a Universal Serial Bus, is it possible to read data from any device, like USB flash drives, USB keyboards & mice, USB DVB-T ?...Read more

List processes accessing device after `umount --lazy`

I want to remove my external HDD as safely as possible.I want to use umount --lazy: Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)Then after a short delay I plan to kill any processes with open files on the device where the filesystem is still quasi-mounted.I can't use lsof for an accurate list of the open files as the filesystem has become invisible to new processes.If I use lsof before ...Read more