Setting up NI GPIB-USB-HS under Linux

26 Jul

NI GPIB-USB-HS

Mostly stolen from: http://www.cl.cam.ac.uk/~osc22/tutorials/gpib_usb_linux.html

Note unlike the ni_usb_b, this is the ni_usb_hs so no firmware has to be loaded at boot, thus gpib_config can be called directly.

 

Get latest from http://linux-gpib.sourceforge.net/

Typical build in /usr/local/src with:

./configure

make

sudo make install

 

sudo vi /etc/gpib.conf

board_type = “ni_usb_b”

name = “gpib0″

 

sudo vi /etc/udev/rules.d/99-linux_gpib_ni_usb.rules

SUBSYSTEM==”usb”, ACTION==”add”, ENV{DEVTYPE}==”usb_device”, ATTR{idVendor}==”3923″, ATTR{idProduct}==”709b”, MODE=”660″, GROUP=”username”, SYMLINK+=”usb_gpib”
SUBSYSTEM==”usb”, ACTION==”add”, ENV{DEVTYPE}==”usb_device”, ATTR{idVendor}==”3923″, ATTR{idProduct}==”709b”, RUN+=”/usr/local/sbin/gpib_config”
KERNEL==”gpib[0-9]*”, ACTION==”add”, MODE=”660″, GROUP=”username”

sudo udevadm control –reload-rules

 

Note udev will not run the gpib_config at boot, so add it in rc.local:

sudo vi /etc/rc.d/rc.local

#!/bin/sh
/usr/local/sbin/gpib_config
exit 0

sudo chmod +x /etc/rc.d/rc.local

sudo systemctl enable rc-local.service

systemctl status rc-local.service

 

Now plug in the adapter and run ibtest

Reboot and run ibtest

 

Linux Multimedia

19 Jul


Logitech C615 HD Webcam

sudo vi /etc/udev/rules.d/99-webcam.rules

SUBSYSTEMS==”usb”, ATTRS{idVendor}==”046d”, ATTRS{idProduct}==”082c”, MODE:=”0666″

sudo udevadm control –reload-rules

 

Dell XPS 13 Webcam

sudo vi /etc/udev/rules.d/99-webcam.rules

SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bda”, ATTRS{idProduct}==”5752″, MODE:=”0666″

sudo udevadm control –reload-rules

 

RPM Fusion Repository

sudo yum localinstall –nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

 

GUVCView Webcam Recording

sudo yum install libwebcam guvcview

Change resolution to 1280×720 on XPS-13

Set sound device to hw:2,0 for Logitech webcam

 

Screen Recording

sudo yum install gtk-recordmydesktop

Set sound device to hw:2,0 for Logitech webcam

 

Video Editing

sudo yum install openshot

 

Setting up the Ettus USRP B200

10 Jun

Using a Syba SD-PEX20122 (VLI VL80x chipset) PCIE USB 3.0 controller and 1 meter cable

Add udev Rules

sudo vi /etc/udev/rules.d/99-usrp.rules

SUBSYSTEMS==”usb”, ATTRS{idVendor}==”2500″, ATTRS{idProduct}==”0020″, MODE:=”0666″

sudo udevadm control –reload-rules

Realtime Priority
sudo vi /etc/security/limits.conf
# Add for USRP realtime priority
myusername – rtprio 99
Will require re-login

Update Firmware

sudo /usr/local/lib64/uhd/utils/uhd_images_downloader.py

Probe

uhd_find_devices –args=”type=b200″

Benchmark

cd /usr/local/lib64/uhd/examples
./benchmark_rate –rx_rate 45E6 –args “type=b200, master_clock_rate=45E6″

Baudline Tips

20 Apr

Fedora fonts:

sudo yum install xorg-x11-fonts-misc

sudo yum install xorg-x11-fonts-ISO8859-1-75dpi

 

Reading data file from GNU Radio:

GNU Radio file sink with input type complex writes IEEE 754 single-precision floats:

gr.sizeof_gr_complex: 4 bytes per sample as floating point real and imaginary, f = scipy.fromfile(open("filename"), dtype=scipy.complex64)

Baudline file raw paramaters:

Decompression: OFF

Initial byte offset: 0

Sample Rate: custom

Channels: 2

Quadrature: ON

Flip Complex: ON

Decode Format: 32 bit float, little endian

Normalization: 1 maximum sample value

GNURadio Tricks

20 Apr

Dynamic recording of files:

Create a QT GUI Check Box with ID “Record” and set type to Boolean, and Default Value to False.

Create a variable with ID “file_name” and set Value to:

‘data.bin’ if Record==True else ‘/dev/null’

Create a File Sink with file “file_name”

 

MAME on the LeapsterGS

24 Nov

http://sg.danny.cz/sg/sg3_utils.html

git clone https://github.com/jrspruitt/OpenLFConnect.git

cd OpenLFConnect

sudo cp extras/udev_rules/99-LeapFrog-* /etc/udev/rules.d/

sudo chmod 644 /etc/udev/rules.d/99-LeapFrog-*

Turn on GS then plug in USB.

Verify /dev/leapster exists

dmesg

usb 1-1: new high speed USB device using ehci_hcd and address 14
usb 1-1: New USB device found, idVendor=0f63, idProduct=001c
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1: Product: Leapster GS Explorer
usb 1-1: Manufacturer: LeapFrog Enterprises, Inc.
scsi14 : usb-storage 1-1:1.0

sd 13:0:0:0: [sdb] ASC=0x11 ASCQ=0x0
sd 13:0:0:0: [sdb] CDB: cdb[0]=0x28: 28 00 00 00 00 40 00 00 08 00
end_request: I/O error, dev sdb, sector 64
sd 13:0:0:0: [sdb] Unhandled sense code
sd 13:0:0:0: [sdb] Result: hostbyte=0x00 driverbyte=0x08
sd 13:0:0:0: [sdb] Sense Key : 0x3 [current]
Info fld=0x40

./OpenLFConnect.py

OpenLFConnect Version 1.0.5
local> device_profile_load Extras/Profiles/leapstergs.cfg

local> device_profile_default
Saved leapstergs.cfg as default profile.

local> cd Downloads/

local> package_download surgeon
Downloading: GAM2-0x00210003-000000.lfp

local> package_download firmware
Downloading: GAM2-0x00210004-000000.lfp

local> package_download bulk
Downloading: GAM2-0x00210004-000002.lfp

local> package_extract GAM2-0x00210003-000000.lfp
Extracting lfp: GAM2-0x00210003-000000.lfp

local> package_extract GAM2-0x00210004-000000.lfp
Extracting lfp: GAM2-0x00210004-000000.lfp

local> package_extract GAM2-0x00210004-000002.lfp
Extracting lfp: GAM2-0x00210004-000002.lfp

local> ls
Firmware-Base/
Firmware-BulkEmpty/
Surgeon/
GAM2-0x00210003-000000.lfp
GAM2-0x00210004-000000.lfp
GAM2-0x00210004-000002.lfp

~ # find / -iname “lfd*” -exec tar -rvf /LF/Bulk/backup.tar {} \;
tar: Removing leading `/’ from member names
/etc/init.d/lfd
tar: Removing leading `/’ from member names
/var/lib/opkg/info/lfd.control
tar: Removing leading `/’ from member names
/var/lib/opkg/info/lfd.list
tar: Removing leading `/’ from member names
tar: /var/volatile/run/lfd-control: socket ignored
tar: Removing leading `/’ from member names
/usr/bin/lfd
tar: Removing leading `/’ from member names
/usr/bin/lfd-ctrl

~ # find / -iname “fbctrl*” -exec tar -rvf /LF/Bulk/backup.tar {} \;
tar: Removing leading `/’ from member names
/usr/bin/fbctrl

~ # tar -tvf /LF/Bulk/backup.tar
-rwxr-xr-x root/root 462 2012-09-26 20:13 etc/init.d/lfd
-rw-r–r– root/root 422 2012-08-17 03:35 var/lib/opkg/info/lfd.control
-rw-r–r– root/root 31 2012-09-26 20:25 var/lib/opkg/info/lfd.list
-rwxr-xr-x root/root 13960 2012-08-17 03:35 usr/bin/lfd
-rwxr-xr-x root/root 4804 2012-08-17 03:35 usr/bin/lfd-ctrl
-rwxr-xr-x root/root 9272 2012-08-17 03:35 usr/bin/fbctrl

Power off GS

Power on into USB boot mode via holding L+R+? then toggle power.  Hold L+R+? until info is displayed.

local> cd Surgeon/

local> surgeon_boot surgeon.cbf
Booting surgeon.

0 interesting pixels in 320×240 image
vbus now is 1

local> dftp_connect

Connecting with DFTP v2 Mass Storage.

remote> ls
bin/
boot/
dev/
etc/
LF/
lib/
mnt/
proc/
sbin/
sys/
tmp/
usr/
var/
.ash_history
init
linuxrc
surgeon-blacklist.txt

Flashing new kernel and rootfs

cp ~/uImage /usr/local/src/OpenLFConnect/files/LXGS/kernel.bin

cp ~/rootfs.ubi /usr/local/src/OpenLFConnect/files/LXGS/erootfs.ubi

remote> local

local> cd ..

local> cd ..

local> cd LXGS/

local> dftp_update
Uploading: kernel.bin
Bytes sent: 2418640
Uploading: erootfs.ubi
Bytes sent: 87031808

Jan 8 14:39:54 Emerald Base DFTP: DFTP err: 550 Path not found: /LF/fuse/Firmware-Base

Jan 8 14:39:54 Emerald Base DFTP: Flashing kernel.bin to /dev/mtd4 (2418640 bytes). UBI=0

Jan 8 14:39:54 Emerald Base DFTP: flash_erase /dev/mtd4 0 0 &> /dev/console
Erasing 1024 Kibyte @ f00000 — 100 % complete
Jan 8 14:39:54 Emerald Base DFTP: nandwrite -p /dev/mtd4 – &> /dev/console
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x100000
Writing data to block 2 at offset 0x200000
Jan 8 14:40:00 Emerald Base DFTP: Flashing erootfs.ubi to /dev/mtd5 (87031808 bytes). UBI=1

local> dftp_reboot

Restore procedure for kernel and rootfs:

remote> local

local> cd Downloads/Firmware-Base/

local> dftp_update
Uploading: 4,2253104,kernel.bin
Bytes sent: 2253104
Uploading: 5,53477376,C2G-E1M-W4K-erootfs.ubi
Bytes sent: 53477376

~ # Jan 8 14:14:13 Emerald Base DFTP: DFTP err: 550 Path not found: /LF/fuse/Firmware-Base

Jan 8 14:14:13 Emerald Base DFTP: Flashing kernel.bin to /dev/mtd4 (2253104 bytes). UBI=0

Jan 8 14:14:13 Emerald Base DFTP: flash_erase /dev/mtd4 0 0 &> /dev/console
Erasing 1024 Kibyte @ f00000 — 100 % complete
Jan 8 14:14:13 Emerald Base DFTP: nandwrite -p /dev/mtd4 – &> /dev/console
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x100000
Writing data to block 2 at offset 0x200000
Jan 8 14:14:19 Emerald Base DFTP: Flashing erootfs.ubi to /dev/mtd5 (53477376 bytes). UBI=1

local> dftp_reboot

Image

rx_test_bladerf_1.png

7 Aug

Follow

Get every new post delivered to your Inbox.