LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 05-17-2010, 09:40 PM   #1
xwhbin
LQ Newbie
 
Registered: Feb 2010
Location: china
Posts: 5

Rep: Reputation: 0
using libusb find device VID & PID on Solaris


i saw http://www.sun.com/io_technologies/usb/USB-Faq.html #Ugen
and i found solaris 10 is supported libusb
i modify /kernel/drv/scsa2usb.conf
add: attribute-override-list = "vid=0x96 reduced-cmd-support=true";
reboot
#protconf -v |grep 96
value='usb96e,6.109' + 'usb96e,6' + 'usbif96e,class3.0.0' + 'usbif96e,class3.0' + 'usbif96e,class3' + 'usbif,class3.0.0' + 'usbif,class3.0' + 'usbif,class3' + 'usb,device'
[root@solaris10:/usr/hongbin/source]#uname -a
SunOS solaris10 5.11 snv_79a i86pc i386 i86pc Solaris
[root@solaris10:/usr/hongbin/source]#cat Makefile
CC=gcc
CFLAGS=-I/usr/sfw/include
LDFLAGS=-L/usr/sfw/lib -R/usr/sfw/lib -lusb

SearchDevice:SearchDevice.o
$(CC) -o SearchDevice SearchDevice.o $(LDFLAGS)
SearchDevice.o:SearchDevice.c
$(CC) $(CFLAGS) -c SearchDevice.c
clean:
rm -fr *.o SearchDevice a.out core
[root@solaris10:/usr/hongbin/source]#cat SearchDevice.c
#include <stdio.h>
#include </usr/sfw/include/usb.h>

int main()
{
struct usb_bus *busses ;
struct usb_bus *bus ;

usb_init();
usb_find_busses();
usb_find_devices();

busses=usb_get_busses();

for (bus = busses; bus; bus = bus->next) {
struct usb_device *dev;
printf("111111\n");

for (dev = bus->devices; dev; dev = dev->next) {
struct usb_device_descriptor *desc;
printf("2222\n");

desc = &(dev->descriptor);
printf("Vendor/Product ID: %04x04x\n", desc->idVendor,
desc->idProduct);
}
}

return 0;
}
[root@solaris10:/usr/hongbin/source]#

[root@solaris10:/usr/hongbin/source]#make
gcc -I/usr/sfw/include -c SearchDevice.c
gcc -o SearchDevice SearchDevice.o -L/usr/sfw/lib -R/usr/sfw/lib -lusb
[root@solaris10:/usr/hongbin/source]#./SearchDevic e
111111
[root@solaris10:/usr/hongbin/source]#

now i want to find device vid and pid on solaris ,but output msg is wrong, i can't understand..
who can give me suggest,my english is poor! ^_^ thank you!
 
Old 05-18-2010, 04:40 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
You are calling solaris10 a machine running a distribution based on SunOS 5.11. This is quite confusing.
You are also using an outdated build (79a). The latest stable is 111b and latest dev is 134.

With it, libusb is integrated and your code seems to work with a couple of changes:
Code:
#include <usb.h>
...
printf("Vendor/Product ID: %04x%04x\n", desc->idVendor,
...
$ ./SearchDevice      
111111
2222
Vendor/Product ID: 0000/0000
2222
Vendor/Product ID: 04f2/b096
2222
Vendor/Product ID: 08ff/1600
2222
Vendor/Product ID: 0b97/7772
 
Old 05-19-2010, 02:05 AM   #3
xwhbin
LQ Newbie
 
Registered: Feb 2010
Location: china
Posts: 5

Original Poster
Rep: Reputation: 0
wonderful!jlliagre!
thank you for help me .
now, i want to try update my solaris 5.11

but i don't know how can i update to (The latest stable is 111b and latest dev is 134)

updatemanager?
smpatch ?

i try it, but it doesn't work!the message is don't need mend!
i'am new guy, thanks for your help again!
 
  


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
USB device driver notification using libusb v0.1 API marioatallah Linux - Hardware 1 01-19-2010 04:26 AM
Unable to read from my usb device using libusb on rhel4 bergy8 Linux - Hardware 2 10-13-2009 12:03 PM
How to : Find Account Lockout Setting in Solaris 5.8 & 5.9 avklinux Solaris / OpenSolaris 1 12-12-2008 02:09 PM
usb bluetooth modify vid & pid scan73 Linux - Newbie 1 02-11-2008 11:35 PM
device file for scanner with libusb fredgt Linux - Hardware 0 04-08-2004 11:47 AM


All times are GMT -5. The time now is 06:55 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration