forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

detect access via usb

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Wed Aug 20, 2008 3:52 am    Post subject: detect access via usb Reply with quote

hello everybody!
I wanted to know how to know ( =) ) when data is tranferring over usb during an usb-pc connection.

in other words, do you remember the bar that goes to the left and to the right on the vsh when usb connection to memory stick is active? ok, how can i detect that event? how can i know that there is "something happening" at the usb port?

i think maybe is easier to look at the memory stick led, and detect when it is flashing, but how to do this?
would this work when flashes and umd are toggled via usb as well?

thanks very much!
_________________
Ciao! from Italy
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Aug 20, 2008 9:37 pm    Post subject: Reply with quote

Just run a timer thread and check the amount of data transferred at regular intervals. If its increasing then its transferring.

Unless you're trying to monitor another apps USB connection...then I dunno.
Back to top
View user's profile Send private message
homemister



Joined: 24 Mar 2008
Posts: 25

PostPosted: Wed Aug 20, 2008 9:50 pm    Post subject: Reply with quote

how do u check the data being transfered from the psp?
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Wed Aug 20, 2008 9:57 pm    Post subject: Reply with quote

thanks, but how can i "check the amount of data transferred"
_________________
Ciao! from Italy
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Aug 20, 2008 10:03 pm    Post subject: Reply with quote

phobox wrote:
thanks, but how can i "check the amount of data transferred"


I had some sample code showing how to read the bytes transferred. Can't seem to find it. Its only applicable if YOUR app started the USB.
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Wed Aug 20, 2008 10:08 pm    Post subject: Reply with quote

Torch wrote:
phobox wrote:
thanks, but how can i "check the amount of data transferred"


I had some sample code showing how to read the bytes transferred. Can't seem to find it. Its only applicable if YOUR app started the USB.


yes my app DID start usb.
I wrote a working usb utility, now i want to add the possibility to know if data is tranferring over osb...

where did you get that sample code?
_________________
Ciao! from Italy
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Aug 20, 2008 10:09 pm    Post subject: Reply with quote

phobox wrote:
Torch wrote:
phobox wrote:
thanks, but how can i "check the amount of data transferred"


I had some sample code showing how to read the bytes transferred. Can't seem to find it. Its only applicable if YOUR app started the USB.


yes my app DID start usb.
I wrote a working usb utility, now i want to add the possibility to know if data is tranferring over osb...

where did you get that sample code?


I dunno :S
Ask Hellcat or Cory1492. Both of their apps show the bytes transferred.
Back to top
View user's profile Send private message
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Wed Aug 20, 2008 10:49 pm    Post subject: Reply with quote

???
I've never added bytes transfer to USB before... in fact, I was curious to see how this topic turned out. If I had to guess and start somewhere, I'd look for a function I could hook so I could monitor len/size info before dispatching to the original function.

Maybe Torch meant jas0nuk?
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Aug 20, 2008 10:51 pm    Post subject: Reply with quote

cory1492 wrote:
???
I've never added bytes transfer to USB before... in fact, I was curious to see how this topic turned out. If I had to guess and start somewhere, I'd look for a function I could hook so I could monitor len/size info before dispatching to the original function.

Maybe Torch meant jas0nuk?

Oh... Its definitely in Hellcats EPBM.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Aug 21, 2008 2:11 am    Post subject: Reply with quote

I guess hooking sceIoRead to msstor0: could work, but the vsh probably uses another approach, I bet they use one of these functions with unkown prototype:

Code:

0x16173D42   sceUSB_Stor_Ms_driver_16173D42
0x18EB011A   sceUSB_Stor_Ms_driver_18EB011A
0x4B10A7F5   sceUsbstorMsRegisterEventFlag
0x56AA41EA   sceUSB_Stor_Ms_driver_56AA41EA
0x762F7FDF   sceUsbstorMsNotifyEventDone
0x9569F268   sceUsbstorMsSetVSHInfo
0x9C029B16   sceUSB_Stor_Ms_driver_9C029B16
0xABE9F2C7   sceUsbstorMsGetApInfo
0xFF0C3873   sceUsbstorMsUnregisterEventFlag
Back to top
View user's profile Send private message
Hellcat



Joined: 24 Jan 2007
Posts: 84

PostPosted: Thu Aug 21, 2008 2:45 am    Post subject: Reply with quote

I remember doing this, including counting the ammount of data transfered, im my old pandora menu....

I hooked somewhere in the IoRead/IoWrite functions of the driver IIRC, set a flag to tell my other functions about a transfer in progress and counted the bytes in a global variable....

The solution I puzzled together wasn't all that nice (I'd guess there are way better ways to do it) but it worked pretty nicely :)

I'm not at home ATM, but when I am, I can see to dig out the code that did it....
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Thu Aug 28, 2008 12:17 am    Post subject: Reply with quote

hellcat, news?
thanks
bye
_________________
Ciao! from Italy
Back to top
View user's profile Send private message
Hellcat



Joined: 24 Jan 2007
Posts: 84

PostPosted: Thu Aug 28, 2008 6:06 pm    Post subject: Reply with quote

Here's some good, old, well known xD USB code snipped, that I had modified a while back for checking USB access and counting the ammount of data.

Not too nice, but does the job.

http://pb.area-42.net/?show=22
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Sun Sep 07, 2008 9:12 pm    Post subject: Reply with quote

you wrote that PspIoDrv *FindDriver(char *drvname) is a 1.50 specific function.

I think it is that because of u32 text_addr = *(mod+27);
and
u32 *(* GetDevice)(char *) = (void *)(text_addr+0x16D4);

how to obtain those values?
_________________
Ciao! from Italy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group