You are on page 1of 10

4/10/2016

LinuxUSBdevelopmentandusers()

LinuxUSBdevelopmentandusers()
DanielePalmas|26Nov10:422012
RETURN

headers

cdcacmandremotewakeup

Returntogmane.linux.usb.general.

ADVERTISEMENT

Hello,

I'musingthemodemTelitHE910withcdcacmdriver.
PROJECTWEBPAGE
LinuxUSBdevelopmentandusers()

I'vefoundthatafterasuspendandresumeoftheoperatingsystem
(e.g.pmsuspend),themodemdoesnotansweranymore.

SEARCHARCHIVE

Search

Collectinglogswithanusbsniffer,itseemsthat,unliketheWindows
driver,thehostdoesnotsendthepacketSET_FEATUREDEVICE_REMOTE
WAKEUP,neededbythemodem.

LANGUAGE
Changelanguage

OPTIONS
Currentview:Threadsonly/Showingonly20
lines/Nothidingcitedtext.
ChangetoAllmessages,wholemessages,or
hidecitedtext.
Postamessage
NNTPNewsgroup
ClassicGmanewebinterface
RSSFeed
ListInformation

I'veaddedfewlinesofcode(intheacm_suspendfunction)forsending
thispacketandnowthingswork.

AccordingtotheUSB2.0specsitseemstomethatthisfeatureshould
bealwaysrequestedwhensuspendingadevice,soprobablythedriver
behaviorisnotcorrect.

DoescdcacmreallynotsupportthisfeatureoramImissingsome
configurationparametersthatenablethesendingofthisrequest?

AboutGmane

Thanks,
Daniele

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"in
thebodyofamessagetomajordomo@...
Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.html

Permalink|Reply|Reportthisasspam

OliverNeukum|26Nov11:592012

headers

Re:cdcacmandremotewakeup

OnMonday26November201210:42:48DanielePalmaswrote:
>Hello,
>
>I'musingthemodemTelitHE910withcdcacmdriver.
>
>I'vefoundthatafterasuspendandresumeoftheoperatingsystem
>(e.g.pmsuspend),themodemdoesnotansweranymore.
>
>Collectinglogswithanusbsniffer,itseemsthat,unliketheWindows
>driver,thehostdoesnotsendthepacketSET_FEATUREDEVICE_REMOTE
>WAKEUP,neededbythemodem.

Thisisanewquirk.

>I'veaddedfewlinesofcode(intheacm_suspendfunction)forsending
>thispacketandnowthingswork.

acm_suspendisdefinitelynottheplacetoputthis,evenifitfixes

http://comments.gmane.org/gmane.linux.usb.general/75417

1/10

4/10/2016

LinuxUSBdevelopmentandusers()
yourparticularusage.

>AccordingtotheUSB2.0specsitseemstomethatthisfeatureshould
>bealwaysrequestedwhensuspendingadevice,soprobablythedriver
>behaviorisnotcorrect.

Hm.Whichpartofthespecdoyoubasethison?

>DoescdcacmreallynotsupportthisfeatureoramImissingsome
>configurationparametersthatenablethesendingofthisrequest?

Foramodemthisfeaturemakesrelativelylittlesense.I'venever

(Continuereading)
Permalink|Reply|Reportthisasspam

DanielePalmas|26Nov13:292012

headers

Re:cdcacmandremotewakeup

HelloOliver,

2012/11/26OliverNeukum<oneukum@...>:
>OnMonday26November201210:42:48DanielePalmaswrote:
>>Hello,
>>
>>I'musingthemodemTelitHE910withcdcacmdriver.
>>
>>I'vefoundthatafterasuspendandresumeoftheoperatingsystem
>>(e.g.pmsuspend),themodemdoesnotansweranymore.
>>
>>Collectinglogswithanusbsniffer,itseemsthat,unliketheWindows
>>driver,thehostdoesnotsendthepacketSET_FEATUREDEVICE_REMOTE
>>WAKEUP,neededbythemodem.
>
>Thisisanewquirk.
>

Ok.

>>I'veaddedfewlinesofcode(intheacm_suspendfunction)forsending
>>thispacketandnowthingswork.
>
>acm_suspendisdefinitelynottheplacetoputthis,evenifitfixes
>yourparticularusage.
>

Ok.Doyouhaveanyhintforaddingthecodeintheproperplace?

>>AccordingtotheUSB2.0specsitseemstomethatthisfeatureshould

(Continuereading)
Permalink|Reply|Reportthisasspam

OliverNeukum|26Nov14:522012

headers

Re:cdcacmandremotewakeup

OnMonday26November201213:29:09DanielePalmaswrote:

>Ok.Doyouhaveanyhintforaddingthecodeintheproperplace?

http://comments.gmane.org/gmane.linux.usb.general/75417

2/10

4/10/2016

LinuxUSBdevelopmentandusers()
Firstweneedtodefineanewquirk.

>>>AccordingtotheUSB2.0specsitseemstomethatthisfeatureshould
>>>bealwaysrequestedwhensuspendingadevice,soprobablythedriver
>>>behaviorisnotcorrect.
>>
>>Hm.Whichpartofthespecdoyoubasethison?
>>
>
>Thedocis"UniversalSerialBusSpecification"revision2.0paragraph
>10.5.4.5,ifIamnotmisunderstandingthetopic.
>
>Here
>
>http://msdn.microsoft.com/enus/library/windows/hardware/ff537628%28v=vs.85%29.aspx
>
>thereisaninterpretationcomingfromMicrosoft
>
>"InUSBterminology,aUSBdeviceisenabledforremotewakeupwhen
>itsDEVICE_REMOTE_WAKEUPfeatureisset.TheUSBspecification
>specifiesthathostsoftwaremustsettheremotewakeupfeatureona
>device"onlyjustprior"toputtingthedevicetosleep."

Well,thattellsuswhentosetDEVICE_REMOTE_WAKEUP,ifwewantremote
wakeup,notwhetherwewantitatall.

(Continuereading)
Permalink|Reply|Reportthisasspam

DanielePalmas|26Nov17:042012

headers

Re:cdcacmandremotewakeup

2012/11/26OliverNeukum<oneukum@...>:
>OnMonday26November201213:29:09DanielePalmaswrote:
>
>>Ok.Doyouhaveanyhintforaddingthecodeintheproperplace?
>
>Firstweneedtodefineanewquirk.
>
>>>>AccordingtotheUSB2.0specsitseemstomethatthisfeatureshould
>>>>bealwaysrequestedwhensuspendingadevice,soprobablythedriver
>>>>behaviorisnotcorrect.
>>>
>>>Hm.Whichpartofthespecdoyoubasethison?
>>>
>>
>>Thedocis"UniversalSerialBusSpecification"revision2.0paragraph
>>10.5.4.5,ifIamnotmisunderstandingthetopic.
>>
>>Here
>>
>>http://msdn.microsoft.com/enus/library/windows/hardware/ff537628%28v=vs.85%29.aspx
>>
>>thereisaninterpretationcomingfromMicrosoft
>>
>>"InUSBterminology,aUSBdeviceisenabledforremotewakeupwhen
>>itsDEVICE_REMOTE_WAKEUPfeatureisset.TheUSBspecification
>>specifiesthathostsoftwaremustsettheremotewakeupfeatureona

http://comments.gmane.org/gmane.linux.usb.general/75417

3/10

4/10/2016

LinuxUSBdevelopmentandusers()
>>device"onlyjustprior"toputtingthedevicetosleep."
>
>Well,thattellsuswhentosetDEVICE_REMOTE_WAKEUP,ifwewantremote
>wakeup,notwhetherwewantitatall.

(Continuereading)
Permalink|Reply|Reportthisasspam

AlanStern|26Nov17:162012

headers

Re:cdcacmandremotewakeup

OnMon,26Nov2012,OliverNeukumwrote:

>>Iunderstandthatprobablythereareproblemsinthefirmwareofthe
>>modem(becauseitshouldnotbrick),butI'mtryingtofinda
>>workaroundtohavethingsworking.
>
>Iamattachingapatchtointroduceanewquirktype.Youneedtoadd
>yourdevicetothelistofquirkydevicesindrivers/usb/core/quirks.c
>withthenewquirktype.
>Youcannotsolvethisinthecdcacmdriverbecausethereisan
>unsolvableraceifyoursystemissuspendedafterthedeviceisenumerated
>butbeforethedriverisloaded.

Therearesomeproblemsinyourpatch.Foronething,youprevented
do_remote_wakeupfrombeingturnedoffinanunlikelypath,butyou
neverturneditoninthelikelypath.Foranother,it'simpossibleto
enableremotewakeupforanunconfigureddevice.

AlanStern

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"in
thebodyofamessagetomajordomo@...
Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.html

Permalink|Reply|Reportthisasspam

DanielePalmas|29Nov15:102012

headers

Re:cdcacmandremotewakeup

2012/11/26OliverNeukum<oneukum@...>:
>OnMonday26November201213:29:09DanielePalmaswrote:
>
>Iamattachingapatchtointroduceanewquirktype.Youneedtoadd
>yourdevicetothelistofquirkydevicesindrivers/usb/core/quirks.c
>withthenewquirktype.
>Youcannotsolvethisinthecdcacmdriverbecausethereisan
>unsolvableraceifyoursystemissuspendedafterthedeviceisenumerated
>butbeforethedriverisloaded.
>
>Wouldyoutestthis?
>

Itestedyourpatch,butstillIcannotseethesetremotewakeup
requestwiththesniffer.

NowI'mtryingtodebugthings,butitseemstomethatthefunction

http://comments.gmane.org/gmane.linux.usb.general/75417

4/10

4/10/2016

LinuxUSBdevelopmentandusers()
usb_control_msg(udev,usb_sndctrlpipe(udev,0),
USB_REQ_SET_FEATURE,USB_RECIP_DEVICE,
USB_DEVICE_REMOTE_WAKEUP,0,
NULL,0,
USB_CTRL_SET_TIMEOUT);

isnotsendinganything.IwillupdateyouifIunderstandtheissue.

Regards,
Daniele

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"in

(Continuereading)
Permalink|Reply|Reportthisasspam

AlanStern|26Nov17:082012

headers

Re:cdcacmandremotewakeup

OnMon,26Nov2012,DanielePalmaswrote:

>MaybeIhavetoexplainbettermyscenario:
>
>Modemisregisteredtothenetwork.Hostsuspended,Iwantmydevice
>towakeupthehostwhenitreceives,forexample,acalloransms.

Whatifthemodemisn'tregisteredtothenetwork?Forexample,ifthe
cdcacmdriverisunloaded.Doesitneedremotewakeuptobeenabled
then?

>Thisdoesn'thappenifthedriverdoesn'tsendthe
>DEVICE_REMOTE_WAKEUPrequest.Moreoverwithoutthisrequestthemodem
>isbricked.

Areyousurethat"bricked"istherightword?Itmeansthatthe
modem'sfirmwaregotcorruptedsothatitisimpossibleevertousethe
modemagainunlessanEPROMchipisreplaced.Maybeyoujustmeant
thatthemodemcrashed.

AlanStern

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"in
thebodyofamessagetomajordomo@...
Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.html

Permalink|Reply|Reportthisasspam

DanielePalmas|26Nov17:322012

headers

Re:cdcacmandremotewakeup

HelloAlan,

2012/11/26AlanStern<stern@...>:
>OnMon,26Nov2012,DanielePalmaswrote:
>
>>MaybeIhavetoexplainbettermyscenario:
>>
>>Modemisregisteredtothenetwork.Hostsuspended,Iwantmydevice

http://comments.gmane.org/gmane.linux.usb.general/75417

5/10

4/10/2016

LinuxUSBdevelopmentandusers()
>>towakeupthehostwhenitreceives,forexample,acalloransms.
>
>Whatifthemodemisn'tregisteredtothenetwork?Forexample,ifthe
>cdcacmdriverisunloaded.Doesitneedremotewakeuptobeenabled
>then?
>

Thatisagoodquestion:inmyspecificscenarioitisnotusefulto
havetheremotewakeupenabledifthecdcacmdriverisunloaded.But,
thoughatthemomentIcannotidentifyany,maybetherearesituations
inwhichitisusefultohavetheremotewakeupenabledevenifthe
driverisnotloaded.

>>Thisdoesn'thappenifthedriverdoesn'tsendthe
>>DEVICE_REMOTE_WAKEUPrequest.Moreoverwithoutthisrequestthemodem
>>isbricked.
>
>Areyousurethat"bricked"istherightword?Itmeansthatthe
>modem'sfirmwaregotcorruptedsothatitisimpossibleevertousethe
>modemagainunlessanEPROMchipisreplaced.Maybeyoujustmeant
>thatthemodemcrashed.
>

(Continuereading)
Permalink|Reply|Reportthisasspam

AlanStern|26Nov18:062012

headers

Re:cdcacmandremotewakeup

OnMon,26Nov2012,DanielePalmaswrote:

>>Whatifthemodemisn'tregisteredtothenetwork?Forexample,ifthe
>>cdcacmdriverisunloaded.Doesitneedremotewakeuptobeenabled
>>then?
>>
>
>Thatisagoodquestion:inmyspecificscenarioitisnotusefulto
>havetheremotewakeupenabledifthecdcacmdriverisunloaded.But,
>thoughatthemomentIcannotidentifyany,maybetherearesituations
>inwhichitisusefultohavetheremotewakeupenabledevenifthe
>driverisnotloaded.

Withoutadriver,andwithoutbeingregisteredwiththenetwork,I
don'tseehowthemodemcouldeversendawakeuprequestinthefirst
place.

Still,thisisanimportantconsideration.Itmeansthatremotewakeup
doesn'tneedtobeenabledwhenthedriverisn'tpresent.Whichmeans
thatthecdcacmdriverisindeedtherightplacetofixthisproblem
althoughthewayyoudiditisn'ttherightway.Therightwayis
tohavecdcacmturnontheneeds_remote_wakeupflaginthe
usb_interfacestructure.

Andbytheway,/proc/acpi/wakeupisdeprecated.Toallowthemodemto
wakeupthesystem,youshoulddo:

echoenabled>/sys/bus/usb/devices/.../power/wakeup

wherethe"..."partisfilledinwiththedevicenamecorrespondingto

http://comments.gmane.org/gmane.linux.usb.general/75417

6/10

4/10/2016

LinuxUSBdevelopmentandusers()

(Continuereading)
Permalink|Reply|Reportthisasspam

DanielePalmas|26Nov18:192012

headers

Re:cdcacmandremotewakeup

2012/11/26AlanStern<stern@...>:
>OnMon,26Nov2012,DanielePalmaswrote:
>
>>>Whatifthemodemisn'tregisteredtothenetwork?Forexample,ifthe
>>>cdcacmdriverisunloaded.Doesitneedremotewakeuptobeenabled
>>>then?
>>>
>>
>>Thatisagoodquestion:inmyspecificscenarioitisnotusefulto
>>havetheremotewakeupenabledifthecdcacmdriverisunloaded.But,
>>thoughatthemomentIcannotidentifyany,maybetherearesituations
>>inwhichitisusefultohavetheremotewakeupenabledevenifthe
>>driverisnotloaded.
>
>Withoutadriver,andwithoutbeingregisteredwiththenetwork,I
>don'tseehowthemodemcouldeversendawakeuprequestinthefirst
>place.
>
>Still,thisisanimportantconsideration.Itmeansthatremotewakeup
>doesn'tneedtobeenabledwhenthedriverisn'tpresent.Whichmeans
>thatthecdcacmdriverisindeedtherightplacetofixthisproblem
>althoughthewayyoudiditisn'ttherightway.Therightwayis
>tohavecdcacmturnontheneeds_remote_wakeupflaginthe
>usb_interfacestructure.

Ok,I'lltrytotakealookatthat.

>Andbytheway,/proc/acpi/wakeupisdeprecated.Toallowthemodemto
>wakeupthesystem,youshoulddo:
>

(Continuereading)
Permalink|Reply|Reportthisasspam

OliverNeukum|26Nov18:432012

headers

Re:cdcacmandremotewakeup

OnMonday26November201212:06:21AlanSternwrote:
>Still,thisisanimportantconsideration.Itmeansthatremotewakeup
>doesn'tneedtobeenabledwhenthedriverisn'tpresent.Whichmeans
>thatthecdcacmdriverisindeedtherightplacetofixthisproblem
>althoughthewayyoudiditisn'ttherightway.Therightwayis
>tohavecdcacmturnontheneeds_remote_wakeupflaginthe
>usb_interfacestructure.

Well,no.Youcannotbesurethatthedeviceisquietifnodriverisbound.
Itisperfectlypossibletoaccessadevicethroughusbfsandcauselasting
effects.
WecoulduseRESET_RESUME,butitseemswrongtousethatquirk
whilegentleralternativesareavailable.

http://comments.gmane.org/gmane.linux.usb.general/75417

Regards

7/10

4/10/2016

LinuxUSBdevelopmentandusers()

Oliver

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"in
thebodyofamessagetomajordomo@...
Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.html

Permalink|Reply|Reportthisasspam

AlanStern|26Nov19:402012

headers

Re:cdcacmandremotewakeup

OnMon,26Nov2012,OliverNeukumwrote:

>OnMonday26November201212:06:21AlanSternwrote:

>>Still,thisisanimportantconsideration.Itmeansthatremotewakeup
>>doesn'tneedtobeenabledwhenthedriverisn'tpresent.Whichmeans
>>thatthecdcacmdriverisindeedtherightplacetofixthisproblem
>>althoughthewayyoudiditisn'ttherightway.Therightwayis
>>tohavecdcacmturnontheneeds_remote_wakeupflaginthe
>>usb_interfacestructure.
>

>Well,no.Youcannotbesurethatthedeviceisquietifnodriverisbou

>Itisperfectlypossibletoaccessadevicethroughusbfsandcauselasti
>effects.

True,butyoucanblamethebadeffectsontheprogramthatconfigured
themodemviausbfsandthendidn'tunconfigurethemodemwhenitwas
finished.

Ofcourse,therewouldstillbeaproblemifthesystemwassuspended
whilethisprogramwasrunningandusingthemodem.There'snowayto
tellusbfsthatremotewakeupisrequired.

AlanStern

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"in
thebodyofamessagetomajordomo@...
Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.html

(Continuereading)
Permalink|Reply|Reportthisasspam

OliverNeukum|27Nov06:412012

headers

Re:cdcacmandremotewakeup
OnMonday26November201213:40:28AlanSternwrote:

>Ofcourse,therewouldstillbeaproblemifthesystemwassuspende

>whilethisprogramwasrunningandusingthemodem.There'snoway
>tellusbfsthatremotewakeupisrequired.

Exactly.Alsothere'sanunavoidablewindowwhenkickingoffthe

driverviasysfs.Thisproblemneedstobehandledbyaquirkinusbco

http://comments.gmane.org/gmane.linux.usb.general/75417

Regards

Oliver

8/10

4/10/2016

LinuxUSBdevelopmentandusers()

Tounsubscribefromthislist:sendtheline"unsubscribelinuxusb"i
thebodyofamessagetomajordomo@...
Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.html

Permalink|Reply|Reportthisasspam

AlanStern|27Nov16:302012

headers

Re:cdcacmandremotewakeup

OnTue,27Nov2012,OliverNeukumwrote:

>OnMonday26November201213:40:28AlanSternwrote:

>>Ofcourse,therewouldstillbeaproblemifthesystemwass

>>whilethisprogramwasrunningandusingthemodem.There's
>>tellusbfsthatremotewakeupisrequired.
>

>Exactly.Alsothere'sanunavoidablewindowwhenkickingoffth

>driverviasysfs.Thisproblemneedstobehandledbyaquirki

Idisagree.Theusbfsinterfaceisnotascapableasthekernel'

internalAPI;thathasalwaysbeentrue.Oneofitslimitations

inabilitytorequestremotewakeups.Wecouldaddthattousbfs,
fornowitisn'tthere.

Ifthatlimitationmeansthebuggymodemwillcrashwheneveriti

beingdrivenbyauserprogramandthesystemsuspends,sobeit.

shouldn'texpectthekerneltoworkaroundhardwarebugswhenthe

deviceinquestionisn'tevenunderthecontrolofakerneldrive

AlanStern

Tounsubscribefromthislist:sendtheline"unsubscribelinuxu
thebodyofamessagetomajordomo@...

Moremajordomoinfoathttp://vger.kernel.org/majordomoinfo.htm

Permalink|Reply|Reportthisasspam

OliverNeukum|27Nov16:562012

headers

Re:cdcacmandremotewakeup
OnTuesday27November201210:30:02AlanSternwrote:

>Idisagree.Theusbfsinterfaceisnotascapableasthe

>internalAPI;thathasalwaysbeentrue.Oneofitslimit

>inabilitytorequestremotewakeups.Wecouldaddthatto
>fornowitisn'tthere.

Yes.

>Ifthatlimitationmeansthebuggymodemwillcrashwhenev

>beingdrivenbyauserprogramandthesystemsuspends,so

Asfarasthedeviceisundercontrolofusbfsthatisadef

>shouldn'texpectthekerneltoworkaroundhardwarebugsw

>deviceinquestionisn'tevenunderthecontrolofakerne

http://comments.gmane.org/gmane.linux.usb.general/75417

9/10

4/10/2016

LinuxUSBdevelopmentandusers()

Thatisnotapositionthatisuseful.Inparticularthere's

(ifyouuseamodularkernel)awindowwhereadeviceiscon

duetothekernel'saction,butnotyetboundtoadriver.W

deviceifwegotoasystemsuspendthen.Thatisnogoodan
reasonthismustbehandledinusbcore,notincdcacm.

Regards

Oliver

Tounsubscribefromthislist:sendtheline"unsubscribeli
thebodyofamessagetomajordomo@...

Moremajordomoinfoathttp://vger.kernel.org/majordomoinf

(Continuereading)
Permalink|Reply|Reportthisasspam

AlanStern|27Nov17:142012

headers

Re:cdcacmandremotewakeup

OnTue,27Nov2012,OliverNeukumwrote:

>OnTuesday27November201210:30:02AlanSternwrot
>

>>Idisagree.Theusbfsinterfaceisnotascapable

>>internalAPI;thathasalwaysbeentrue.Oneofi

>>inabilitytorequestremotewakeups.Wecouldadd
>>fornowitisn'tthere.
>
>Yes.
>

>>Ifthatlimitationmeansthebuggymodemwillcras

>>beingdrivenbyauserprogramandthesystemsusp
>

>Asfarasthedeviceisundercontrolofusbfsthat
>

>>shouldn'texpectthekerneltoworkaroundhardwar

>>deviceinquestionisn'tevenunderthecontrolof
>

>Thatisnotapositionthatisuseful.Inparticular

>(ifyouuseamodularkernel)awindowwhereadevic

>duetothekernel'saction,butnotyetboundtoad
>deviceifwegotoasystemsuspendthen.

Infact,itwouldnotcrash.Danielesaidso;thecra

whenthemodemisattachedtoanetwork.Ifithasn't
driveryet,itcan'tbeattached.

>Thatisnogoodandonemore

>reasonthismustbehandledinusbcore,notincdca

(Continuereading)
Permalink|Reply|Reportthisasspam

Gmane

http://comments.gmane.org/gmane.linux.usb.general/75417

10/10

You might also like