LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2014, 01:40 AM   #1
gauravpathak129
LQ Newbie
 
Registered: Jan 2014
Location: Pune, Maharashtra
Distribution: Fedora 17, Ubuntu 12.04
Posts: 18

Rep: Reputation: Disabled
Accessing USB device without having entry in /dev & /sys


Hello,
I am running Ubuntu 14.04 on VMware Player.
I have a PSoC device programmed to have two configurations say Config 1 and Config 2.
In Config 1 the device has one Interface and in Config 2 it has two interfaces say interface 1 and interface 2; interface 2 has HID.

Whenever I connect my PSoC device and run "lsusb" command it displays:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 05ac:12aa Apple, Inc. iPod Touch 5.Gen [A1421]
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

But it does not show any entry in /dev & /sys.
All I want is to access the device and change current active configuration to transfer data from HOST(PC) to device.
How should I access the device??
 
Old 09-10-2014, 02:57 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,921

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Apple equipment is notoriously difficult to interface with linux. There is libimobiledevice, and perhaps that can help your comms if you use a program that links to it.
http://www.libimobiledevice.org/
 
Old 09-10-2014, 04:28 AM   #3
gauravpathak129
LQ Newbie
 
Registered: Jan 2014
Location: Pune, Maharashtra
Distribution: Fedora 17, Ubuntu 12.04
Posts: 18

Original Poster
Rep: Reputation: Disabled
Hello business kid,

The device is not an Apple device, the PSoC is programmed in that way so that it behave as an apple device.
If I change the VID and PID in program of PSoC then it will no longer behave as an IPOD.
So the question is if I have a device which when connected to linux machine does not show up in /dev and /sys as well then how one can access it, to change its configuration and interface number.
I have tried using libusb library, but I can't change configuration.
I tried calling "libusb_set_configuration", "libusb_detach_kernel_driver" and then "libusb_claim_interface" but this "libusb_claim_interface" always gives error value -5 or -6.
 
Old 09-10-2014, 01:48 PM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,921

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
There are utilities to make these awkward things available to you under X. I would try that.

If you are faking an apple id without having apple software, these, too will probably fail. You may be able to investigate what you can do with udev to make your device appear - it may just need a rule added. You are really out on your own here. All we know is that your system is not what it is telling the box it is.
 
Old 09-12-2014, 01:01 AM   #5
gauravpathak129
LQ Newbie
 
Registered: Jan 2014
Location: Pune, Maharashtra
Distribution: Fedora 17, Ubuntu 12.04
Posts: 18

Original Poster
Rep: Reputation: Disabled
Accessing USB Device

Quote:
Originally Posted by business_kid View Post
There are utilities to make these awkward things available to you under X. I would try that.

If you are faking an apple id without having apple software, these, too will probably fail. You may be able to investigate what you can do with udev to make your device appear - it may just need a rule added. You are really out on your own here. All we know is that your system is not what it is telling the box it is.
Ok, I referred some links for writing Udev rule to make a node in /dev directory.
But my question is how can I find name of the device assigned by Kernel? So that I can equate it with as:

KERNEL == "device_name"

Any suggestions? I tried dmesg but I can't find any name for the device!

This is the O/P of dmesg:

[ 5515.262776] usb 2-2.1: new full-speed USB device number 8 using uhci_hcd
[ 5515.717484] usb 2-2.1: New USB device found, idVendor=05ac, idProduct=12aa
[ 5515.717495] usb 2-2.1: New USB device strings: Mfr=4, Product=6, SerialNumber=0
[ 5515.717500] usb 2-2.1: Product: iPod
[ 5515.717504] usb 2-2.1: Manufacturer: Apple Inc
[ 5515.894505] usbhid 2-2.1:2.1: can't add hid device: -32
[ 5515.894538] usbhid: probe of 2-2.1:2.1 failed with error -32
 
Old 09-12-2014, 08:02 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,921

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Code:
[ 5515.894505] usbhid 2-2.1:2.1: can't add hid device: -32
[ 5515.894538] usbhid: probe of 2-2.1:2.1 failed with error -32
you have it there. Error 32 is broken pipe. The kernel did not assign you any device - it can't handle it.

I think you missed the import of my 2 previous posts. If you have a design imitating an Apple, COMMS are going to be a major issue. And when the Apple OS changes, that might all change again.
 
Old 09-21-2014, 11:33 PM   #7
gauravpathak129
LQ Newbie
 
Registered: Jan 2014
Location: Pune, Maharashtra
Distribution: Fedora 17, Ubuntu 12.04
Posts: 18

Original Poster
Rep: Reputation: Disabled
Accessing USB Device

I managed to display device node in /dev directory. I wrote a driver in which I registered the device by its VID and PID and now I can perform some operations such as IOCTL.
But I cannot change the interface number of the device using USB Core APIs. I used usb_set_interface(); but I cannot send data to the changed interface.
I can only send data to default interface i.e. interface 0.
How can I change interface from Interface 0 to Interafce 1??
 
Old 09-22-2014, 06:57 AM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 6,723
Blog Entries: 12

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
I don't know if it's different now, but past experience showed me that it's not just merely USB and VID/PID, there's authentication which applies to be able to communicate with an IOS device; either you have their authentication chip or the software to emulate it. You can "see" the devices, but not all the capabilities of their profile unless you pass their authentication. And unfortunately they tend to become more closed rather than open about allowances. That's one of the reasons why some companies become MFI approved so that they can see the standards and be allowed to purchase the authentication chips to include in their peripheral devices to allow them to talk to the various IOS devices.
 
Old 09-22-2014, 07:47 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165Reputation: 3165
Quote:
Originally Posted by rtmistler View Post
I don't know if it's different now, but past experience showed me that it's not just merely USB and VID/PID, there's authentication which applies to be able to communicate with an IOS device; either you have their authentication chip or the software to emulate it. You can "see" the devices, but not all the capabilities of their profile unless you pass their authentication. And unfortunately they tend to become more closed rather than open about allowances. That's one of the reasons why some companies become MFI approved so that they can see the standards and be allowed to purchase the authentication chips to include in their peripheral devices to allow them to talk to the various IOS devices.
That's called, "trade secrets," and every electronics manufacturer has them. It's part of what gives a company a competitive edge, however briefly. It's also what drives the businesses of "reverse engineering" and "industrial espionage."
 
  


Reply

Tags
usb


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 release /dev entry of unplugged storage device while a program has a file open 10110111 Linux - Software 4 11-09-2009 02:21 PM
Error.../Desktop/Floppy Device is of type FSDevice but has no Dev=...entry suejohn Linux - Newbie 1 04-30-2009 06:01 AM
creation of dynamic device node entry in /dev balalin Linux - Kernel 0 04-10-2007 04:29 AM
usb flash drive: no /dev entry zarg Slackware 3 09-21-2004 03:39 PM
HP Deskjet (USB) & CUPS & Slackware 9.1: Unable to open USB device "usb:/dev/usb/lp0&qu arnostienen Slackware 2 01-29-2004 03:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:27 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