For writing a midi (wrapper) library, I'm trying to figure out, where the "name" of a midi device is defined. Is it something given by the device or given by the system that it is connected to?
For instance I'm getting the following output from 'amidi' on a linux machine, to which a midi controller is connected.
amidi -l
Dir Device Name
IO hw:1,0,0 MIDI 1
Its name is always " MIDI 1" (sic!) and I'm not sure if I can assume, that every single device of this vendor/model will have the same name.
For PCI sound cards, the driver knows the name.
For USB devices, the snd-usb-audio driver looks into the device's descriptors to get the device name, and appends " MIDI x" to get the MIDI port name. If there is no device name defined, it constructs a default name from the device number, so this looks as if your MIDI controller explicitly returns an empty string. This results in a nonsensical result in your case, but taking this name is the best your library can do.
(Run "sudo lsusb -v 2>&1 | grep -e iManufacturer -e iProduct" as root to see what your USB devices declare.)
Related
I am trying to set something up like this:
only_if('physical device') do
command('hostnamectl') do
its('stdout') { should match /Chassis: desktop/ }
end
end
describe command('ifquery --list') do
its ('stdout') { should eq "lo\nbond0\neth0\neth1\neth2\n" }
end
because I'm hitting up a group of physical and virtual machines using the same control and I want to check and see that all the physical devices have 3 ethernet interfaces and all the virtual devices has 1.
There's only a handful of places you can go in linux to tell if you're running a vm or baremetal, but they almost all require grepping something out of a file, so I need to check stdout somehow.
So, what I'm wondering is, how do I use stdout with a command to skip something?
Hey.
I'm trying to launch Instruments from shell with iPhone specified as target. As for this apple doc I should be able to specify target with '-w' parameter but I don't know what should be there.
I've tried iPhone name, I've tried its UUID but nothing worked - constantly I get 'Unknown hardware device specified'. I also checked content of some saved trace document, but inside I see UUID of the iPhone. Maybe it is some prefix/suffix that should be added to the UUID ?
In the end i would like to get the following working:
instruments -t /Users/user/Template.tracetemplate -D /Users/user/res.trace -w iPhoneID AppName
The following command worked for me(taken from http://lemonjar.com/blog/?p=69):
instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <full_path_to_application> -e UIASCRIPT <path_to_script.js> -e UIARESULTSPATH <output_results_path>
There a few important things to note though:
the -w parameter is not required unless you want to run the scripts on your device. If you want to run your scripts on the simulator, simply omit this parameter from the command.
full_path_to_application is the path to your .app file that is created by your simulator. For me, the path was
/Users/fwasim/Library/Application Support/iPhone Simulator/5.0/Applications/AA6BA2E1-D505-4864-BECC-29ADEE28194D/name_of_application.app
this path might be different for anyone else depending on what iOS version are you running on your simulator. Also remember to put this path in double quotation marks.
The path_to_script.js should be the FULL PATH to where your automation script written in javascript is saved. Also remember to put this path in double quotation marks.
Lastly output results path is the path where you want to save the output results. Also remember to put this path in double quotation marks.
These were the points I had been missing on and thus was getting some of the errors mentioned above.
The hex "Identifier" value you find in the Organizer in the device's general information pane should work.
In solaris when open call to char special device file is made in user space, the driver's open call is called with only two parameters. 1. major and minor number and 2. flag that contains read/write etc.. Is there any way to the get the name of the opened device file in driver's open call. or Is there any way to get the name of the device file from major and minor number in driver code?
I doubt the OS has any way to retrieve the name of the device file. Actually, this file name is not enforced by the OS and can be any name created with the mknod command. The only things that matter are the major and minor device numbers.
You can go through the lists of entries in /dev or /devices and compare the numbers. But of course in general, the special file could have been created anywhere in the filesystem.
But you shouldn't try doing this. Which problem are you trying to solve by this?
I am new to UNIX and when I was reading a book about UNIX, I came across following two problems that I didn't understand. I would really appreciate your help.
1) Look up the man page for the file command, and then use it on all files in the /dev directory. Can you group these files into two categories?
2) Run the tty command, and note the device name of your terminal. Now use this device name(/dev/pst/6) in the command cp /etc/passwd /dev/pts/6. what do you observe?
Fair question really... it's so easy for us to take so much for granted.
To read the manual page for the command called file, just type...
man file
...which will present a lot of information that will probably be quite confusing, but you'll get used to this stuff pretty quick if you keep at it. Crucially, file is a program that tries to categorise the files you ask it to. If you type...
file /dev/*
...that will do what the question asked, and invoke file with a list of the files in the /dev/ subdirectory. The list is actually prepared by the "shell" program that you're typing into, which then executes the file program and passes it the list. file then outputs some description of the files. On my computer, and where [SHELL-PROMPT] will be different on your computer, I typed file /dev/* and part of the output looked like:
[SHELL-PROMPT] file /dev/*
...lots of stuff...
/dev/cevt: character special (255/176)
/dev/console: character special (5/1)
/dev/core: symbolic link to `/proc/kcore'
/dev/cpqci: character special (10/209)
/dev/cpqhealth: directory
/dev/crom: character special (255/180)
...lots of stuff...
/dev/md8: block special (9/8)
/dev/md9: block special (9/9)
/dev/mem: character special (1/1)
/dev/mice: character special (13/63)
/dev/mouse0: character special (13/32)
/dev/mptctl: character special (10/220)
/dev/net: directory
/dev/nflog: character special (36/5)
/dev/null: character special (1/3)
/dev/parport0: character special (99/0)
...lots of stuff...
There's a filesystem entry for each directory/file combination (known as a path) in the left column, and file is describing the content in the right. Those descriptions may not make a lot of sense, but you can see that some patterns: some entries are "block special", others "character special", some are directory which implies you may find more files underneath (i.e. ls /dev/net/*). The numbers after "special" files are just operating system identifiers to differentiate the files mentioned. The import of this is that input and output from some devices connected to the computer is being made possible as if the device was a file in the filesystem. That "file" abstraction is being used as a general model for input and output. So, /dev/tty for example is tty - or terminal - device. Any data you try to read from there will actually be taken from the keyboard you're using to type into the shell (in the simple case), and anything you write there will become visible in the same terminal you're typing into. /dev/null is another interesting one: you can read and write from it, but it's an imaginary thing that never actually provides data (just indicates and End-of-File condition, and throws away any data written into it). You can keep reading from /dev/random and it will produce random values each time... good if you need random numbers or file content for encryption or some kind of statistical work.
2) Run the tty command, and note the
device name of your terminal. Now use
this device name(/dev/pst/6) in the
command cp /etc/passwd /dev/pts/6.
what do you observe?
By typing "tty" you can ask for the device representing your terminal...
[SHELL-PROMPT] tty
/dev/pts/11
But, I just said /dev/tty is another name for the same thing, so there's normally no need to use the "tty" program to find this more specific name. Still, if you create a couple terminal windows to your host, and type tty in each, you will see that each shell is connected to a different pseudo-terminal device. Still, each shell - and program run from the shell - can by default also refer to its own terminal input and output device as /dev/tty... it's a convenient context-sensitive name. The command...
cp /etc/passwd /dev/pts/6
...where you replace 6 with whatever your tty program really reported (e.g. 11 in my case), does the same thing as...
cp /etc/passwd /dev/tty
...it just reads the contents of the file /etc/passwd and writes them out on your screen. Now, the problem is that /etc/password looks like a lot of unintelligible junk to the average person - it's no wonder you couldn't make sense of what was happening. Try this instead...
echo "i said hello" > /tmp/hello.file
cp /tmp/hello.file /dev/tty
...and you'll see how to direct some specific, recognisable content into a new file (in this case putting it in the tmp "temporary" directory (the file will disappear when you reboot your PC), then copying that file content back to your screen.
(If you have logged on in two terminal windows, you can even go into one shell and copy the file to the /dev/pts/NN device reported by the other shell, effectively sending a message to the other window. You can even bypass the file and echo 'boo' > /dev/tty/NN. You'll only have permissions to do this if the same userid is logged into both windows.)
I am reading docs for VLC Command line programming. there I saw
YUV video output
--yuv-file=<string> device, fifo or filename
device, fifo or filename to write yuv frames too.
What does device and fifo mean? how to specify them?
A FIFO pipe is a "first in first out" pipe handled by the file system. It is also called a named pipe
Essentially, the file system as a record on it that points to a section of RAM that is used to transfer data through between different processes as if it was an actual disk file it was reading and writing from. Of course, there are different behaviours between normal files and pipes, but that's the general idea.
The FIFO, or "first in, first out" is a queue term, which means the first data written to the pipe is the first data read out.
Now, device is a 'device' in your machine that can be specified to write data to or read data from. This can be something like a network device or a capture/display device (such as VIVO video cards). On *nix systems, a device is something you will find in /dev such as /dev/dvd for a DVD device.
It's a named pipe.
Try man mkfifo