LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-22-2013, 06:49 PM   #1
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,360

Rep: Reputation: 127Reputation: 127
Write a udev rule with 2 actions


I have an agilent 82357b clone. The linux-gpib software from sourceforge comes with hotplug stuff. I found a site that has an example udev for an NI device, but this one is a bit different. You have to load the firmware twice, and both times it changes the usb address/id (whatever it's called).

For example: Say that the device is this:
Code:
Bus 002 Device 031: ID 0957:0718 Agilent Technologies, Inc.
When you run install the firmware with fxload it becomes
Code:
Bus 002 Device 032: ID 0957:0718 Agilent Technologies, Inc.
But you need to run fxload a second time and it becomes
Code:
Bus 002 Device 033: ID 0957:0718 Agilent Technologies, Inc.
How can I change "99-linux_82357a.rules" so that it runs "/lib/firmware/agilent_82357a" a second time with the updated DEVNAME? (Assuming that's the file I need to change.)

NOTE: The origin of /lib/firmware file assumes that the device first appears with idProduct=="0715", but I'm not seeing that with mine.


Here is what I have so far:

/etc/udev/rules.d/99-linux_82357a.rules
Code:
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="0957", ATTR{idProduct}=="0718", MODE="660", GROUP="gpib", SYMLINK+="usb_gpib"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="0957", ATTR{idProduct}=="0718", RUN+="/lib/udev/agilent_82357a"
KERNEL=="gpib[0-9]*", ACTION=="add", MODE="660", GROUP="gpib"
/lib/udev/agilent_82357a
Code:
#!/bin/sh

GPIB_CONFIG_OPTIONS="--minor 0"
DATADIR=/lib/firmware
FXLOAD=/sbin/fxload
GPIB_CONFIG=/usr/local/sbin/gpib_config
FXLOAD_OPTIONS=

PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin
FIRMWARE=
SS_LOADER=

# pre-renumeration device IDs
case $PRODUCT in
# 82357a with firmware already loaded
957/107/*)
	$GPIB_CONFIG $GPIB_CONFIG_OPTIONS
	;;

# 82357a without firmware
957/7/*)
	FIRMWARE=$DATADIR/agilent_82357a/82357a_fw.hex
	SS_LOADER=$DATADIR/agilent_82357a/82357a_fw.hex
	;;

# 82357b with firmware already loaded
957/518/*)
	$GPIB_CONFIG $GPIB_CONFIG_OPTIONS
	;;

# 82357b without firmware
957/718/*)
	FIRMWARE=$DATADIR/measat_releaseX1.8.hex
	SS_LOADER=$DATADIR/measat_releaseX1.8.hex
	FXLOAD_OPTIONS="-t fx2"
	;;

esac

# quit unless we were called to download some firmware 
if [ "$FIRMWARE" = "" ]; then
    # OR:  restructure to do other things for
    # specific post-renumeration devices
    exit 0
fi

# missing firmware?
if [ ! -r $FIRMWARE ]; then
    if [ -x /usr/bin/logger ]; then
	/usr/bin/logger -t $0 "missing $FIRMWARE for $PRODUCT ??"
    fi
    exit 1
fi

# missing second stage loader?
if [ ! -r $SS_LOADER ]; then
    if [ -x /usr/bin/logger ]; then
        /usr/bin/logger -t $0 "missing $SS_LOADER for $PRODUCT ??"
    fi
    exit 1
fi

# missing fxload?
if ! which $FXLOAD; then
    if [ -x /usr/bin/logger ]; then
	/usr/bin/logger -t $0 "missing $FXLOAD ??"
    fi
    exit 1
fi

if [ -x /usr/bin/logger ]; then
    /usr/bin/logger -t $0 "load $FIRMWARE for $PRODUCT to $DEVICE"
fi

$FXLOAD -v $FSLOAD_OPTIONS -D ${DEVNAME} -I $FIRMWARE -s $SS_LOADER

Last edited by Quakeboy02; 08-23-2013 at 11:29 PM. Reason: vsload s/b fxload
 
Old 08-24-2013, 06:00 PM   #2
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
One of these?

http://www.home.agilent.com/en/pd-10...?&cc=US&lc=eng

This isn't much of an answer to your udev rules question, but here is another source for GPIB interfaces:

https://launchpad.net/~v-kukol/+archive/gpib-testing


Whatcha plugging the GPIB end into? I've got a few HP/Agilent LA's (a 16500b and a couple of 16702a's) here.
 
Old 08-25-2013, 05:44 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,360

Original Poster
Rep: Reputation: 127Reputation: 127
Hi rootboy,

I've got a couple of counters, an SA, and a voltmeter that I'd like to hookup. I'm not sure what direction I'm going to have to take, as linux-gpib just doesn't like my adapter on Debian. I tried setting up Scientific Linux in a virtual box and installing both linux-gpib and NI-VISA, but I clearly haven't cast the appropriate spells, because that's not working either. This will take a back seat for awhile, as I have other projects, but eventually I'm going to have to find a way to make it work. I'll checkout that link to the fork of linux-gpib and see if it has anything to offer.
 
Old 08-26-2013, 10:24 PM   #4
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
This is the one that I will be getting: http://prologix.biz/gpib-ethernet-controller.html. I'm not even going to attempt to get the USB version going.

Try over at the "hp_agilent_equipment" group on Yahoo. Someone there might know how to get it working. With all of this test equipment floating around, you would think that one of us would have hooked up and figured it out by now. LOL
 
Old 08-26-2013, 11:25 PM   #5
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,360

Original Poster
Rep: Reputation: 127Reputation: 127
I've been in the hp_agilent_equipment group for awhile, and no-one seems interested in helping setup this device on linux. The linux_gpib group asked me a couple of questions, but didn't respond with any help after I posted a long reply. I think it's effectively a moribund group.

I've setup a Scientific Linux virtualbox and tried to load ni-visa on it with mixed results. The software can detect the controller, but can't see the counter I have it plugged into. SL doesn't look like a bad distro, and I'd even consider jumping ship from Debian if I could just get this working. =) Loading the software is always the easiest part. It's the configuration bits and bobs that always kill you.

So, what I have is the sourcecode for linux-gpib and a seemingly very steep learning curve for ScientificLinux plus NI-VISA. I'm going to play with SL for awhile, but if I can't figure out how to see an instrument soon, I'm just going to go play with the sourcecode for linux-gpib. It's been a very long time since I played with linux device drivers, but that might be the most productive route.

As to my original question. I had figured out a way to do it in a manually run script before I posted this question. I'll probably just meld that script with the udev script and call it good, if I can get somewhere with the linux-gpib. My manual script works so it's very low on my priority list.

Added:

Oh, and the Prologix stuff looks good. There's no complicated interface: just send the commands and it works. I took a chance on something less than half that price and I'm paying for it with my time.

Last edited by Quakeboy02; 08-26-2013 at 11:27 PM.
 
Old 08-27-2013, 12:04 AM   #6
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
Quote:
Originally Posted by Quakeboy02 View Post
I've been in the hp_agilent_equipment group for awhile, and no-one seems interested in helping setup this device on linux. The linux_gpib group asked me a couple of questions, but didn't respond with any help after I posted a long reply. I think it's effectively a moribund group.
The problem with the group (as I see it) is that it is too generalized. It really should be broken up into sub-groups where things are a bit more focused. Waaay too much traffic...


Quote:
Originally Posted by Quakeboy02 View Post
I've setup a Scientific Linux virtualbox and tried to load ni-visa on it with mixed results. The software can detect the controller, but can't see the counter I have it plugged into. SL doesn't look like a bad distro, and I'd even consider jumping ship from Debian if I could just get this working. =) Loading the software is always the easiest part. It's the configuration bits and bobs that always kill you.
That's why I have partition after partition after partiton available on this box. It isn't a big deal to set up a distro for testing. I am distro agnostic, so I will try anything once.


Quote:
Originally Posted by Quakeboy02 View Post
So, what I have is the sourcecode for linux-gpib and a seemingly very steep learning curve for ScientificLinux plus NI-VISA. I'm going to play with SL for awhile, but if I can't figure out how to see an instrument soon, I'm just going to go play with the sourcecode for linux-gpib. It's been a very long time since I played with linux device drivers, but that might be the most productive route.
You are a better man than I, Gunga Din.

I am a Controls Engineer, aka, a PLC jockey. I couldn't spell "C" if you told me it was settled in between the "B" and the "D" in the alphabet...


Quote:
Originally Posted by Quakeboy02 View Post
As to my original question. I had figured out a way to do it in a manually run script before I posted this question. I'll probably just meld that script with the udev script and call it good, if I can get somewhere with the linux-gpib. My manual script works so it's very low on my priority list.
Yeah, if it works, don't fight it.


Quote:
Originally Posted by Quakeboy02 View Post
Added:

Oh, and the Prologix stuff looks good. There's no complicated interface: just send the commands and it works. I took a chance on something less than half that price and I'm paying for it with my time.
Something that I learned *not* to do a long time ago. I work a 50 - 60 hour week normally, and I find myself with more disposable income than time (maybe not a *huge* amount of disposable income, but still more than I have of time). So any device that doesn't perform either gets donated, or parted out. I really enjoy firing up my xytronic solder/desolder station and taking out my frustrations on a miscreant board.

As for your SA, I'm envious. We got a Rigol SA here at work (which I suppose I could take home and play with if I like), and while it is nice, it ain't a HP/Agilent...

And my SA is coming in from Israel, it's a, umm, Afedri SDR (if you squint real hard it kinda-sorta looks like a SA )
 
Old 08-27-2013, 12:44 AM   #7
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,360

Original Poster
Rep: Reputation: 127Reputation: 127
"Something that I learned *not* to do a long time ago. I work a 50 - 60 hour week normally, and I find myself with more disposable income than time"

I've been disabled for quite some time, so I have to manage things in the other direction. =)

And don't be too jealous of my old gear, especially my SA, which is an 8558B. I've got a 5334B, a 5335A, an 853A with the 8558B plugin, an 8640B, an 8444A, and a nice 3456A DMM. The SA's not much, but it satisfies what few needs I have for it. About half of this was received not working, so I traded my time for the cost difference. But, it's a good, enjoyable hobby, and keeps me occupied, rather than watching soap operas. LOL Why couldn't I have had some of this stuff back in the day, instead of all the Heathkit stuff I've owned? =)
 
Old 08-29-2013, 12:47 AM   #8
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
Quote:
Originally Posted by Quakeboy02 View Post
"Something that I learned *not* to do a long time ago. I work a 50 - 60 hour week normally, and I find myself with more disposable income than time"

I've been disabled for quite some time, so I have to manage things in the other direction. =)
I am sorry to hear that. Another long day for me (12 hours), but that's better than not being able to work.


Quote:
Originally Posted by Quakeboy02 View Post
And don't be too jealous of my old gear, especially my SA, which is an 8558B.
Yeah, I saw it in the the Radio Museum: http://www.radiomuseum.org/r/hewlett...r_hp8558b.html Looks a lot like the gear that we had in High school in the 70's.

Since you are into antiques, can I interest you in a Nicolet npc-764 logic analyzer? As far as I know, it even works (it was tossed in as part of a deal for a Tek quad trace scope. I've never turned it on). PM me with an address of where you want it sent and it's yours.


Quote:
Originally Posted by Quakeboy02 View Post
I've got a 5334B, a 5335A, an 853A with the 8558B plugin, an 8640B, an 8444A, and a nice 3456A DMM. The SA's not much, but it satisfies what few needs I have for it. About half of this was received not working, so I traded my time for the cost difference. But, it's a good, enjoyable hobby, and keeps me occupied, rather than watching soap operas. LOL Why couldn't I have had some of this stuff back in the day, instead of all the Heathkit stuff I've owned? =)
Ain't that the truth!
 
Old 08-29-2013, 06:22 AM   #9
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,360

Original Poster
Rep: Reputation: 127Reputation: 127
Thanks for the offer, but I don't know where I'd put it.
 
Old 08-29-2013, 11:00 PM   #10
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
Quote:
Originally Posted by Quakeboy02 View Post
Thanks for the offer, but I don't know where I'd put it.
I can't believe that you are going to pass up on the opportunity to sharpen your CP/M skills. You know, just like DOS, only lamer...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to write an udev rule for auto mounting crypted LUKS hd with ZFS filesystem? cybtrash Linux - Software 1 03-25-2013 08:01 AM
[SOLVED] Write udev rule to change harddisk timeout EricTRA Linux - Virtualization and Cloud 9 06-11-2010 07:55 AM
udev rule: need help DPenguin Linux - Hardware 0 08-04-2008 08:29 PM
Udev Rule Help Please Toods Slackware 1 11-23-2007 09:55 AM
need help: write udev rule for LIRC, digital setopbox NoMoreReinstallMS Linux - Hardware 0 11-24-2006 04:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration