InDashPC.org Forum Index InDashPC.org
In Dash Car PC forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

API for Car2PC adapters and list of commands
Goto page 1, 2  Next
 
Post new topic   Reply to topic    InDashPC.org Forum Index -> Drivers
View previous topic :: View next topic  
Author Message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Tue Jun 28, 2005 9:26 am    Post subject: API for Car2PC adapters and list of commands Reply with quote

Guys,
Just wanted to share the latest plugin for VAG USB HU adapters.
Here are 3 files:
1. FTDI generic wrapper lib - to be used by other apps which embeds the supports. Static linking.
2. WinAmp plugin source - to be used via WinAmp. Just an example how the the lib can be used
3. WinAmp plugin installation

The libusbhu API as follows:

int HU_Init( void );
Quote:
Returns a number of HU adapters attached. Error indicated by -1

HU_Connection* HU_Open( int iIndex, char* sParams );
Quote:
Opens up HU adapter by its number. The first attached adapter is 0, the second is 1 and so on. In case if success, returns non NULL pointer to a structure.

void HU_Close( HU_connection *conn );
Quote:
Closes HU adapter opende via HU_Open()

char *HU_GetState( HU_connection *conn );
Quote:
Returns state of the HU adapter as a \n delimited string. In some modes adapter stores current track or disk numbers. Also such flags as MIX, REPEAT and SCAN can be captured by HU_GetState.

char *HU_GetEvent( HU_connection *conn );
Quote:
Returns a string of events came from the HU. This call is a non blocking call and in case if there was no event from HU, it returns empty string. In case there was an error, it returns NULL. To retrieve an error code use HU_GetLastError().
Event string has the following format: "{CMD}\t{PARAM}\n{CMD1}\t{PARAM1}...."

int HU_SetState( HU_connection *conn, char *txt);
Quote:
Set status to HU. This function will block until all data is sent to HU. The format of state string (txt) is shown below:
"{CMD}\t{PARAM}\n{CMD1}\t{PARAM1}...."

The full list of commands and parameters shown below:
Quote:
TR\tXXX\n track number was changed to XXX (in/out)
DS\tXXX\n disk number was changed to XXX (in/out)
PL\t{0|1}\n play started (1) or stopped (0) (in)
PA\t{0|1}\n pause was turned on (1) or off (0) (in)
FF\t{0|1}\n fast forward was turned on (1) or off (0) (in)
FR\t{0|1}\n fast reverse was turned on (1) or off (0) (in)
NT\n next track button pressed (in)
PT\n previous track button was pressed (in)
ND\n next disk button pressed (in)
PD\n previous disk button was pressed (in)
MX\t{0|1}\n MIX button was pressed (in)
RP\t{0|1}\n REPEAT button was pressed (in)
SC\t{0|1}\n SCAN button was pressed (in)
TM\tHHMMSS\n Track time (out)
NM\tSTRING\n Track name for those HU which supports text (out)
AL\tSTRING\n Album name for those HU which supports text (out)
AR\tSTRING\n Artist name for those HU which supports text (out)
DB\t{0|1}\n Turn off/on the debug mode. In that mode some additional info is coming from the car bus. Actual data depends on car stereo(out).
VR\n Return the firmware version (in/out)
SN\t{0|1}\n Turn the passthrough sound on/off(out)


In case if you do not wish to use library you're welcome to read/write directly from USB com prot.
The message format as follows:
Quote:
FF<len><CMD><PARAM>
For instance TR command will look like: FF 05 T R 0 0 1
PL command as follows: FF 02 T R


Thanks,
Dmitry/


Last edited by jbors on Sat Jun 30, 2007 7:44 am; edited 4 times in total
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Sun Aug 13, 2006 8:22 am    Post subject: Reply with quote

For the latest version of a libusbhu library use the code below:
Code:
 cvs -d:pserver:anonymous@pymedia.cvs.sourceforge.net:/cvsroot/pymedia login
cvs -z3 -d:pserver:anonymous@pymedia.cvs.sourceforge.net:/cvsroot/pymedia co -P libusbhu

I'll post direct download after we complete new functions such as passthrough and sniffing Wink
Back to top
View user's profile Send private message
lincomatic
Newbie


Joined: 07 Oct 2005
Posts: 17

PostPosted: Wed Nov 08, 2006 12:44 pm    Post subject: Reply with quote

jbors wrote:
For the latest version of a libusbhu library use the code below:
Code:
 cvs -d:pserver:anonymous@pymedia.cvs.sourceforge.net:/cvsroot/pymedia login
cvs -z3 -d:pserver:anonymous@pymedia.cvs.sourceforge.net:/cvsroot/pymedia co -P libusbhu

I'll post direct download after we complete new functions such as passthrough and sniffing Wink


Is this still the place to get the latest library? Sorry for the incredibly long delay, but I'm ready to integrate it into AutoHotKey http://www.autohotkey.com/ now. This will make it a lot easier for people to make their HU control arbitrary functions under Windows.
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Wed Nov 08, 2006 1:03 pm    Post subject: Reply with quote

Yes, CVS contains the latest Windows library.
Back to top
View user's profile Send private message
lincomatic
Newbie


Joined: 07 Oct 2005
Posts: 17

PostPosted: Wed Nov 08, 2006 1:31 pm    Post subject: Reply with quote

jbors wrote:
Yes, CVS contains the latest Windows library.


I've been trying to log into cvs for the past hour, and it is stuck. would you mind emailing it to me? lincomatic at hotmail.com
Back to top
View user's profile Send private message
dupa2
Newbie


Joined: 17 Sep 2006
Posts: 22

PostPosted: Thu Jan 18, 2007 9:39 pm    Post subject: Reply with quote

I'm writing xmms plugin to receive events from HU and send commands to xmms or execute shell command. Main plugin framework is ready, now I'm plugging in some code from libusbhu and I'm wondering how current the code is.
Anybody tried to compile it with latest kernels, udev, etc?

I have my system based on kernel 2.6.18 compiled for via epia-tc 10000, with udev, and didn't try to compile the library on that system yet ( the reason is that I keep my carputer in the car, but do development on some test machine with 2.4 kernel at home).

Jbors, do you have any feedback on libusbhu on newer linux distros?

Regards,

Jack
________
Medical marijuana grow


Last edited by dupa2 on Wed Mar 09, 2011 1:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Thu Jan 18, 2007 10:59 pm    Post subject: Reply with quote

It should be ok. I did testing on 2.4 and 2.6. It works fine.
Basically I would recommend using standard kernel driver for ftdi_ser or something and just change 2 functions in libusbhu to read from serial device instead of d2x.
Back to top
View user's profile Send private message
dupa2
Newbie


Joined: 17 Sep 2006
Posts: 22

PostPosted: Fri Jan 19, 2007 6:26 am    Post subject: Reply with quote

I didn't analyze libusbhu with details, all I found there is that it just uses regular kernel driver prototypes, so I think it should work fine.

The other thing is that I wanted to implement a function that sends some text to HU to be displayed. With my monsoon single din radio it's not going to work, but there are other ones that can accept some text to display. Any good reference to protocols for HU's?
________
Marijuana Joint


Last edited by dupa2 on Wed Mar 09, 2011 1:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Fri Jan 19, 2007 8:08 am    Post subject: Reply with quote

Usually text is sent to HU via NM, AR, AL commands. There is no way to send generic text to HU. The only exception is BMW.
Back to top
View user's profile Send private message
clarkie
Newbie


Joined: 02 Mar 2007
Posts: 7

PostPosted: Mon Mar 05, 2007 8:58 am    Post subject: Reply with quote

Have you got a download for the latest libusbhu libary, I dont have the gnu compiler ?
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Mon Mar 05, 2007 12:34 pm    Post subject: Reply with quote

Which platform ?
Back to top
View user's profile Send private message
clarkie
Newbie


Joined: 02 Mar 2007
Posts: 7

PostPosted: Mon Mar 05, 2007 2:08 pm    Post subject: Reply with quote

Should have mentioned that windows.
Back to top
View user's profile Send private message
Nerve
Newbie


Joined: 11 Jan 2008
Posts: 23

PostPosted: Fri Jan 11, 2008 12:26 pm    Post subject: Reply with quote

Why do you recommend talking to the com port directly. Is the library buggy or something?!
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Fri Jan 11, 2008 12:42 pm    Post subject: Reply with quote

No, just D2X is EOLd so no reason to use another layer of API Smile
Back to top
View user's profile Send private message
Nerve
Newbie


Joined: 11 Jan 2008
Posts: 23

PostPosted: Fri Jan 11, 2008 1:15 pm    Post subject: Reply with quote

Sorry I'm new here. I didn't understand a word of that Confused Embarassed

D2X is the driver?
EOLd? end of lined? You mean it's not used anymore?

*Brushes dust of com port handling memory banks*

Does that hueml work with the grom console app or should I just hook up to a port using a terminal program? Just wanna see what happens when I hit a button in the emulator (trying to make sure things are working before I start).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    InDashPC.org Forum Index -> Drivers All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group