Jump to content

USB sleep then wake "Device Removal" problem


  • Please log in to reply
150 replies to this topic

#141
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts
BugsB, I think you have lost. :( Control method we're talking earlier is _PSW, not _PRW. You don't have to change _PRW, just need to add _PSW control method. Don't need to change anything else. The USB code I post earlier is just an example to show how I modify the _PSW control method.

#142
BugsB

BugsB

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,513 posts
  • Gender:Male
  • Location:Kauai, Hawai'i
OK so are you saying you want me to turn
Device (USB4)
			{
				Name (_ADR, 0x001D0003)
				Method (_PRW, 0, NotSerialized)
				{
					Return (GPRW (0x0E, 0x04))
				}
			}
into
Device (USB4)
			{
				Name (_ADR, 0x001D0003)
				Method (_PRW, 0, NotSerialized)
				{
					Return (GPRW (0x0E, 0x04))
				}
				Method (_PSW, 1, NotSerialized)
						{
							If (Arg0)
							{
								// Store (0x04, U4EN)
								// Disable USB4 capability to wake a sleeping system
								Store (0x00, U4EN)
							}
							Else
							{
								Store (0x00, U4EN)
							}
						}
			}
and
Device (USB1)
			{
				Name (_ADR, 0x001D0000)
				Method (_PRW, 0, NotSerialized)
				{
					Return (GPRW (0x03, 0x04))
				}
			}
into
Device (USB1)
			{
				Name (_ADR, 0x001D0000)
				Method (_PRW, 0, NotSerialized)
				{
					Return (GPRW (0x03, 0x04))
				}
				Method (_PSW, 1, NotSerialized)
						{
							If (Arg0)
							{
								// Store (0x03, U1EN)
								// Disable USB1 capability to wake a sleeping system
								Store (0x00, U1EN)
							}
							Else
							{
								Store (0x00, U1EN)
							}
						}
			}
is this code correct now? The Return (GPRW etc. needs to remain?

[EDIT]: there is no reference whatsoever to UxEN in my DSDT. That must be specific to yours.

wait - I just saw that after patching DTGP, ICH9 USB and IRQ with DSDT Editor which seems to have fixed all other issues, USB1-3 are now looking like this:
Device (USB1)
			{
				Name (_ADR, 0x001D0000)
				Method (_PRW, 0, NotSerialized)
				{
					Return (GPRW (0x03, 0x04))
				}
				Method (_DSM, 4, NotSerialized)
				{
					Store (Package (0x02)
						{
							"device-id", 
							Buffer (0x04)
							{
								0x34, 0x3A, 0x00, 0x00
							}
						}, Local0)
					DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
					Return (Local0)
				}
			}
only USB4 remained unpatched, whyever .. outch ..

Kizwan, can you add the _PSW control method appropriate for my DSDT into above sample so I see what you mean?

#143
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts
Yes but with correction. Which chipset do you have? Was it ICH7? This is your USB1 after modification, based on my DSDT:-
Device (USB1)
			 {
				 Name (_ADR, 0x001D0000)
				 // add for _PSW control method
				 OperationRegion (U1CS, PCI_Config, 0xC4, 0x04)
				 Field (U1CS, DWordAcc, NoLock, Preserve)
				 {
					 U1EN,   2
				 }
				 // end
				 Method (_PRW, 0, NotSerialized)
				 {
					 Return (GPRW (0x03, 0x04))
				 }
				 // add _PSW control method
				 Method (_PSW, 1, NotSerialized)
				 {
					 If (Arg0)
					 {
						 // Store (0x03, U1EN)
						 // Disable USB1 capability to wake a sleeping system
						 Store (Zero, U1EN)
					 }
					 Else
					 {
						 Store (Zero, U1EN)
					 }
				 }
				 // end
				 Method (_DSM, 4, NotSerialized)
				 {
					 Store (Package (0x02)
						 {
							 "device-id", 
							 Buffer (0x04)
							 {
								 0x34, 0x3A, 0x00, 0x00
							 }
						 }, Local0)
					 DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
					 Return (Local0)
				 }
			 }
Same goes to your USB2:-
Device (USB2)
			 {
				 Name (_ADR, 0x001D0001)
				 // add for _PSW control method
				 OperationRegion (U2CS, PCI_Config, 0xC4, 0x04)
				 Field (U2CS, DWordAcc, NoLock, Preserve)
				 {
					 U2EN,   2
				 }
				 // end
				 Method (_PRW, 0, NotSerialized)
				 {
					 Return (GPRW (0x04, 0x04))
				 }
				 // add _PSW control method
				 Method (_PSW, 1, NotSerialized)
				 {
					 If (Arg0)
					 {
						 // Store (0x03, U2EN)
						 // Disable USB2 capability to wake a sleeping system
						 Store (Zero, U2EN)
					 }
					 Else
					 {
						 Store (Zero, U2EN)
					 }
				 }
				 // end
				 Method (_DSM, 4, NotSerialized)
				 {
					 Store (Package (0x02)
						 {
							 "device-id", 
							 Buffer (0x04)
							 {
								 0x35, 0x3A, 0x00, 0x00
							 }
						 }, Local0)
					 DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
					 Return (Local0)
				 }
			 }
Proceed with USB3 & USB4. Hope you see the pattern here.

#144
BugsB

BugsB

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,513 posts
  • Gender:Male
  • Location:Kauai, Hawai'i
Yes, Intel 945GC / ICH7. On compile I get "Error: U1EN/U2EN etc. does not exist". The only other method which uses _PRW at all in this DSDT is Method (PS2K._PSW, 1, NotSerialized). When I use KBFG instead UxEN I get "Error: Object is not accessible from this scope". I looked at where and how KBFG but that is too tricky. Darn - seems I'm stuck now :borg: <-- was referring to code from two postings above. What you posted in your last posting actually compiled, yippie. I am working on a corporate project parallel so please excuse my bit if confusion. Will test aml in the morning and report back, but this looks good now :)

#145
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts

Yes, Intel 945GC / ICH7. On compile I get "Error: U1EN/U2EN etc. does not exist". The only other method which uses _PRW at all in this DSDT is Method (PS2K._PSW, 1, NotSerialized). When I use KBFG instead UxEN I get "Error: Object is not accessible from this scope". I looked at where and how KBFG but that is too tricky. Darn - seems I'm stuck now :)

Please refer to my previous post, I also add OperationRegion code. I managed to add the _PSW control method to your DSDT & it compiled without any error.
EDIT:-

Yes, Intel 945GC / ICH7. On compile I get "Error: U1EN/U2EN etc. does not exist". The only other method which uses _PRW at all in this DSDT is Method (PS2K._PSW, 1, NotSerialized). When I use KBFG instead UxEN I get "Error: Object is not accessible from this scope". I looked at where and how KBFG but that is too tricky. Darn - seems I'm stuck now :borg: <-- was referring to code from two postings above. What you posted in your last posting actually compiled, yippie. I am working on a corporate project parallel so please excuse my bit if confusion. Will test aml in the morning and report back, but this looks good now :)

No problem. :borg:

#146
BugsB

BugsB

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,513 posts
  • Gender:Male
  • Location:Kauai, Hawai'i
yes sorry, had corrected my remark in the meantime, see explanation above .. :borg:

#147
movingmage

movingmage

    InsanelyMac Protégé

  • Members
  • Pip
  • 17 posts
Hi Kizwan,

I have a similar issue and I am hoping you can help. I am on an HP 311, and every time I sleep the computer the WWAN card wakes it up:

8/26/10 2:50:17 PM	kernel	System Sleep
8/26/10 2:50:21 PM	kernel	Wake reason = USB0
8/26/10 2:50:21 PM	kernel	System Wake
8/26/10 2:50:21 PM	kernel	Previous Sleep Cause: 0
8/26/10 2:50:21 PM	kernel	VoodooHDADevice[0x30e04000]::resume
8/26/10 2:50:21 PM	kernel	Resetting controller...
8/26/10 2:50:21 PM	kernel	USB (EHCI):Port 4 on bus 0x24 connected or disconnected: portSC(0x103802)
8/26/10 2:50:21 PM	kernel	USB (EHCI):Port 2 on bus 0x26 connected or disconnected: portSC(0x301803)
8/26/10 2:50:21 PM	kernel	The USB device HP Webcam-50 (Port 2 of Hub at 0x26000000) may have caused a wake by being disconnected
8/26/10 2:50:21 PM	kernel	Recsel fails src=010001c0 oss=00000000
8/26/10 2:50:21 PM	kernel	Enabling output audio routing switching at node 11:
8/26/10 2:50:21 PM	kernel	The USB device HP Integrated Module (Port 4 of Hub at 0x4000000) may have caused a wake by being disconnected
8/26/10 2:50:21 PM	kernel	The USB device AirCard (Port 5 of Hub at 0x4000000) may have caused a wake by being disconnected

My USB0 section looks like this:

Device (USB0)
			{
				Name (_ADR, 0x00040000)
				Method (_S1D, 0, NotSerialized)
				{
					Return (One)
				}

				Method (_S3D, 0, NotSerialized)
				{
					Return (0x03)
				}

				Name (_PRW, Package (0x02)
				{
					0x0D, 
					0x03
				})
				Method (_DSM, 4, NotSerialized)
				{
					Store (Package (0x03)
						{
							"AAPL,device-internal", 
							0x60, 
							Buffer (One)
							{
								0x00
							}
						}, Local0)
					DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
					Return (Local0)
				}

				Device (RHUB)
				{
					Name (_ADR, Zero)
					Device (PRT0)
					{
						Name (_ADR, One)
						Name (_UPC, Package (0x04)
						{
							0xFF, 
							Zero, 
							Zero, 
							Zero
						})
					}

					Device (PRT2)
					{
						Name (_ADR, 0x02)
						Name (_UPC, Package (0x04)
						{
							0xFF, 
							Zero, 
							Zero, 
							Zero
						})
					}

					Device (PRT4)
					{
						Name (_ADR, 0x03)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}

					Device (PRT6)
					{
						Name (_ADR, 0x04)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}

					Device (PRT8)
					{
						Name (_ADR, 0x05)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}

					Device (PT10)
					{
						Name (_ADR, 0x06)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}
				}
			}

Strangely..just following USB0 is USB1, and it seems awfully similar??(there is also a USB2 and a counterpart of that as well)

Device (USB1)
			{
				Name (_ADR, 0x00040001)
				OperationRegion (P020, PCI_Config, 0x49, One)
				Field (P020, AnyAcc, NoLock, Preserve)
				{
					U0WK,   1
				}

				Method (_DSM, 4, NotSerialized)
				{
					Store (Package (0x05)
						{
							"AAPL,clock-id", 
							0x02, 
							"AAPL,device-internal", 
							0x10, 
							Buffer (One)
							{
								0x00
							}
						}, Local0)
					DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
					Return (Local0)
				}

				Method (_PSW, 1, NotSerialized)
				{
					If (Arg0)
					{
						Store (Zero, U0WK)
					}
					Else
					{
						Store (Zero, U0WK)
					}
				}

				Method (_S1D, 0, NotSerialized)
				{
					Return (One)
				}

				Method (_S3D, 0, NotSerialized)
				{
					Return (One)
				}

				Name (_PRW, Package (0x02)
				{
					0x05, 
					Zero
				})
				Device (RHUB)
				{
					Name (_ADR, Zero)
					Device (PRT0)
					{
						Name (_ADR, One)
						Name (_UPC, Package (0x04)
						{
							0xFF, 
							Zero, 
							Zero, 
							Zero
						})
					}

					Device (PRT2)
					{
						Name (_ADR, 0x02)
						Name (_UPC, Package (0x04)
						{
							0xFF, 
							Zero, 
							Zero, 
							Zero
						})
					}

					Device (PRT4)
					{
						Name (_ADR, 0x03)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}

					Device (PRT6)
					{
						Name (_ADR, 0x04)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}

					Device (PRT8)
					{
						Name (_ADR, 0x05)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}

					Device (PT10)
					{
						Name (_ADR, 0x06)
						Name (_UPC, Package (0x04)
						{
							Zero, 
							0xFF, 
							Zero, 
							Zero
						})
					}
				}
			}
Any help you can offer would be greatly appreciated!

#148
BugsB

BugsB

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,513 posts
  • Gender:Male
  • Location:Kauai, Hawai'i
FINALLY, got it WORKING !!

Sorry it took that long. It did not work with kizwan's code instructions - verified each line from USB 1 -4 several times, I had scripted everything right. I got frustrated, then real life had a more-than-tight grip on me ..

Then I did some more research and stumbled across this posting from gsam_fan over at projectosx.com. He made a mistake in his code sample, so before you struggle too long, here's what you need to do for each USB device if you want to disable wake-from-sleep for it:
------------------------------------------------------------------------------------- delete from here
				 Method (_PRW, 0, NotSerialized)
				 {
					 Return (GPRW (0x03, 0x04))
				 }
 -------------------------------------------------------------------------------------  to here
actually, since - for documentation and future guideline, I like to keep code rather than delete it, this is how I did it:
------------------------------------------------------------------------------------- 
				 // Method (_PRW, 0, NotSerialized)
				 // {
				 //	Return (GPRW (0x03, 0x04))
				 // }
 -------------------------------------------------------------------------------------
Thank you kizwan and gsam_fan :rolleyes: ! Working DSDT (based on BIOS v.403) for the ASUS AT3GC-I attached.

@ movingmage: maybe this helps you, too? Don't know, though. You said WLAN but I saw that that the wake event was caused by USB0, so I guess you have a USB WLAN adapter connected?

PS: however, wake-from-sleep via power-button does NOT work when my Dell PS/2 mouse is plugged in (fan starts spinning but blank screen), even though moving or clicking the mouse does NOT invoke a wake-event. Tried ALL PS/2 kexts out there which I could get a hold of (quite a lot, actually).

Wake-from-sleep works with a PS/2 keyboard plugged in, so what the heck. Four USB ports + the 1 port for the kb are enough, I can live with that. On request I would post the PS/2 section of the Asus' DSDT if somebody wants to check it out and fiddle with it.

Attached Files



#149
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts

Hi Kizwan,

I have a similar issue and I am hoping you can help. I am on an HP 311, and every time I sleep the computer the WWAN card wakes it up:

8/26/10 2:50:17 PM	kernel	System Sleep
 8/26/10 2:50:21 PM	kernel	Wake reason = USB0
 8/26/10 2:50:21 PM	kernel	System Wake
 8/26/10 2:50:21 PM	kernel	Previous Sleep Cause: 0
 8/26/10 2:50:21 PM	kernel	VoodooHDADevice[0x30e04000]::resume
 8/26/10 2:50:21 PM	kernel	Resetting controller...
 8/26/10 2:50:21 PM	kernel	USB (EHCI):Port 4 on bus 0x24 connected or disconnected: portSC(0x103802)
 8/26/10 2:50:21 PM	kernel	USB (EHCI):Port 2 on bus 0x26 connected or disconnected: portSC(0x301803)
 8/26/10 2:50:21 PM	kernel	The USB device HP Webcam-50 (Port 2 of Hub at 0x26000000) may have caused a wake by being disconnected
 8/26/10 2:50:21 PM	kernel	Recsel fails src=010001c0 oss=00000000
 8/26/10 2:50:21 PM	kernel	Enabling output audio routing switching at node 11:
 8/26/10 2:50:21 PM	kernel	The USB device HP Integrated Module (Port 4 of Hub at 0x4000000) may have caused a wake by being disconnected
 8/26/10 2:50:21 PM	kernel	The USB device AirCard (Port 5 of Hub at 0x4000000) may have caused a wake by being disconnected

@movingimage, sorry for late reply. It seems I haven't got notification when somebody post over here. Anyway, looks like BugsB have found the solution. I believe you can use the BugsB's solution to solve your problem. Since USB0 wake your computer, just pay attention/change USB0 only. If you have problem making the changes, please post your DSDT here.

#150
CoolFX

CoolFX

    InsanelyMac Protégé

  • Members
  • Pip
  • 21 posts
I dont have any USBE or EHCI , i just have USB0 USB1 USB2 USB3....
I dont even have a 0x001A0007 adress on my dsdt.
How can i still patch this???

I have a intel 945 mobo.

Thanks in advance....


ps : Check out my dsdt.

Attached Files



#151
sekmo

sekmo

    InsanelyMac Protégé

  • Members
  • Pip
  • 18 posts
Have someone fixed this with GA-H61N-USB3? (I know it's a old post, but it's the most accurated I found..)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   Web hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy