Re: Problems sending AV/C commands
From: Jeff Henkels (jeff_at_mapson.privatemail.com)
Date: 08/26/04
- Next message: Robby Tanner: "Serial.sys"
- Previous message: Mark Roddy: "Re: Qn: Why does h/w wizard search for my USB driver sys file every ti"
- In reply to: nospam_at_cristalink.com: "Re: Problems sending AV/C commands"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 26 Aug 2004 19:25:43 -0400
Setting SubunitAddrFlag & SubunitAddr did the trick. It took a couple of
tries to get SubunitAddr right, but it's working now; commands 0x30, 0x31,
and 0xB2 all work.
Thanks for your help -- I've been beating my head against the wall on this
for days.
<nospam@cristalink.com> wrote in message
news:uKDSG76iEHA.632@TK2MSFTNGP12.phx.gbl...
> If you look at the DDK documentation, you'll see that the 1394 stack looks
> like the following:
>
> AVC
> 61883
> 1394
>
> AVC is above 61883, because AVC is based on 61883. The latter is based on
> 1394. So successful 1394/61883 IOCTLs don't mean you are sending AVC
IOCTLs
> to the right driver. However, since you get AVC_RESPONSE_NOTIMPL, not
> STATUS_something, then you are probably sending IOCTLs to the AVC driver.
>
> You don't seem to set SubunitAddr and SubunitAddrFlag, which are required,
> even if you send commands to the unit. At least, I set these members and
all
> works fine.
>
>
> for( ULONG ulRetry = 0;
> ( ulRetry < c_ulRetryCnt ) && !NT_SUCCESS( st );
> ulRetry++ )
> {
> if( ulRetry > 0 ) Sleep( c_ulRetryDelay );
>
> AcquireMutex aqm( m_Mutex );
>
> fUnitType = AVC::fSubunitType_Invalid;
> ulCompanyId = 0;
>
> RequestT& Req = m_aRequest[ fRequest_Command ];
> const UCHAR aucOperands[] = { 5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
>
> st = executeCommand( AVC_CTYPE_STATUS,
> AVC::fCommand_UnitInfo, aucOperands, NULL,
> AVC::SubunitAddress( AVC::fSubunitType_Unit ) );
>
> if( NT_SUCCESS( st ) )
> {
> if( Req.m_Irb.Operands[ 0 ] != 0x07 ) return
> STATUS_AVC_INVALID_RESPONSE;
> fUnitType = AVC::fSubunitTypeT( Req.m_Irb.Operands[ 1 ] >> 3 );
> if( fUnitType == AVC::fSubunitType_Extended ) return
> STATUS_AVC_UNSUPPORTED_EXTENSION;
> ulCompanyId = swapl3( Req.m_Irb.Operands + 2 );
> break;
> }
> }
>
>
>
>
> "Jeff Henkels" <jeff@mapson.privatemail.com> wrote in message
> news:OaFDlj2iEHA.556@tk2msftngp13.phx.gbl...
> >I am sending Av61883_GetUnitInfo successfully, but it doesn't return the
> > same info an AV/C Unit Info command does. I've also tried sending AV/C
> > subunit info (0x31) and power (0xB2) commands, with the same result
> > (response code AVC_RESPONSE_NOTIMPL) -- both commands work when sent
from
> > a
> > Mac.
> >
> > Also, I'm able to send AVC_FUNCTION_GET_UNIQUE_ID and
> > AVC_FUNCTION_GET_PIN_COUNT commands successfully using the method below,
> > so
> > I have some level of communication with avc.sys. Also, I use the same
> > basic
> > method and same device object to send 1394 and 61883 commands, which are
> > at
> > different levels in the driver stack (presumably above and below avc.sys
> > respectively); why would they work with the same DO, but AV/C fail?
> >
> > <nospam@cristalink.com> wrote in message
> > news:%233bnfBuiEHA.3288@TK2MSFTNGP10.phx.gbl...
> >> You should be sending AVC commands to a device with the GUID_AVC_CLASS
> >> interface. It's one more device object above 61883. I'm not sure about
> >> the
> >> 0x30 command, but perhaps you want Av61883_GetUnitInfo?
> >>
> >>
> >>
> >> "Jeff Henkels" <jeff@mapson.privatemail.com> wrote in message
> >> news:uIti7AriEHA.4092@TK2MSFTNGP10.phx.gbl...
> >> > I'm developing an AV/C tuner subunit driver, using the 1394dcam
driver
> >> > from
> >> > the Windows Server 2003 DDK (3790) as a basis. I'm able to send 1394
> > and
> >> > 61883 commands to the device using IOCTL_1394_CLASS and
> > IOCTL_61883_CLASS
> >> > respectively. However, when I try to send an AV/C command using
> >> > IOCTL_AVC_CLASS, I always get a response code of
AVC_RESPONSE_NOTIMPL,
> >> > even
> >> > with commands that I know work, having tested them using the Apple
> >> > FireWire
> >> > SDK on a Mac running OS X.
> >> >
> >> > Is there anyone out there who's gotten AV/C commands to work, and if
> >> > so,
> >> > what's the secret?
> >> >
> >> >
> >> > Here's the code I use to send the AV/C command:
> >> >
> >> > NTSTATUS TunerIssueAVCCommandCR(IN PDEVICE_OBJECT DeviceObject, IN
PIRP
> >> > pIrp, IN PVOID pCtx)
> >> > {
> >> > DbgMsg3(("\'TunerIssueAVCCommandCR: pIrp->Pending = %u\r\n",
> >> > pIrp->PendingReturned));
> >> > KeSetEvent((PKEVENT)pCtx, 0, FALSE);
> >> > return STATUS_MORE_PROCESSING_REQUIRED;
> >> > }
> >> >
> >> > NTSTATUS TunerGetAVCUnitInfo(PTUNER_EXTENSION pDevExt)
> >> > {
> >> > KEVENT Event;
> >> > NTSTATUS status;
> >> > PIO_STACK_LOCATION NextIrpStack;
> >> > BOOL bCanWait = KeGetCurrentIrql() <
DISPATCH_LEVEL;
> >> > AVC_COMMAND_IRB irb;
> >> > PIRP pIrp;
> >> >
> >> > pIrp = IoAllocateIrp(pDevExt->BusDeviceObject->StackSize, FALSE);
> >> >
> >> > NextIrpStack = IoGetNextIrpStackLocation(pIrp);
> >> > NextIrpStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
> >> > NextIrpStack->Parameters.DeviceIoControl.IoControlCode =
> >> > IOCTL_AVC_CLASS;
> >> > NextIrpStack->Parameters.Others.Argument1 = &irb;
> >> >
> >> > RtlZeroMemory(&irb, sizeof(AVC_COMMAND_IRB));
> >> > irb.Function = AVC_FUNCTION_COMMAND;
> >> > irb.CommandType = (UCHAR)AVC_CTYPE_CONTROL;
> >> > irb.Opcode = (UCHAR)0x30; // AV/C Unit Info command
> >> > irb.OperandLength = 5;
> >> > irb.Operands[0] = 0xFF;
> >> > irb.Operands[1] = 0xFF;
> >> > irb.Operands[2] = 0xFF;
> >> > irb.Operands[3] = 0xFF;
> >> > irb.Operands[4] = 0xFF;
> >> >
> >> > KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
> >> >
> >> > DbgMsg3(("GetAVCUnitInfo: before command, Rspcode = %02X, opcode =
> >> > %02X,
> >> > oplength = %08X\r\n",
> >> > irb.ResponseCode, irb.Opcode, irb.OperandLength));
> >> >
> >> > IoSetCompletionRoutine(pIrp, TunerIssueAVCCommandCR, &Event, TRUE,
> >> > TRUE,
> >> > TRUE);
> >> >
> >> > status = IoCallDriver(pDevExt->BusDeviceObject, pIrp);
> >> >
> >> > DbgMsg3(("\'GetAVCUnitInfo: pIrp is pending(%s); will
wait(%s)\r\n",
> >> > status == STATUS_PENDING ? "Y":"N", bCanWait?
"Y":"N"));
> >> >
> >> > if (STATUS_PENDING == status)
> >> > {
> >> > if (bCanWait)
> >> > {
> >> > //
> >> > // Still pending, wait for the IRP to complete
> >> > //
> >> >
> >> > KeWaitForSingleObject( // Only in <= IRQL_DISPATCH_LEVEL;
> > can
> >> > only in DISPATCH if Timeout is 0
> >> > &Event,
> >> > Executive,
> >> > KernelMode,
> >> > FALSE,
> >> > NULL
> >> > );
> >> > status = pIrp->IoStatus.Status;
> >> > DbgMsg3(("\'GetAVCUnitInfo: Irp status = %08X, Rspcode =
> > %02X,
> >> > opcode = %02X, oplength = %08X\r\n",
> >> > pIrp->IoStatus.Status, irb.ResponseCode, irb.Opcode,
> >> > irb.OperandLength));
> >> > DbgMsg3(("\'GetAVCUnitInfo: rsp = %02X %02X %02X %02X
> >> > %02X\r\n",
> >> > irb.Operands[0], irb.Operands[1], irb.Operands[2],
> >> > irb.Operands[3], irb.Operands[4]));
> >> > IoFreeIrp(pIrp);
> >> > return status;
> >> > }
> >> > else
> >> > {
> >> > IoFreeIrp(pIrp);
> >> > return STATUS_PENDING;
> >> > }
> >> > }
> >> > else
> >> > {
> >> > DbgMsg3(("\'GetAVCUnitInfo: command finished immediately,
status
> >> > %08X\r\n", status));
> >> > if (STATUS_SUCCESS == status)
> >> > {
> >> > DbgMsg3(("\'GetAVCUnitInfo: Irp status = %08X, Rspcode =
> > %02X,
> >> > opcode = %02X, oplength = %08X\r\n",
> >> > pIrp->IoStatus.Status, irb.ResponseCode, irb.Opcode,
> >> > irb.OperandLength));
> >> > DbgMsg3(("\'GetAVCUnitInfo: rsp = %02X %02X %02X %02X
> >> > %02X\r\n",
> >> > irb.Operands[0], irb.Operands[1], irb.Operands[2],
> >> > irb.Operands[3], irb.Operands[4]));
> >> > }
> >> > IoFreeIrp(pIrp);
> >> > return status;
> >> > }
> >> > }
> >> >
> >> >
> >>
> >>
> >
> >
>
>
- Next message: Robby Tanner: "Serial.sys"
- Previous message: Mark Roddy: "Re: Qn: Why does h/w wizard search for my USB driver sys file every ti"
- In reply to: nospam_at_cristalink.com: "Re: Problems sending AV/C commands"
- Messages sorted by: [ date ] [ thread ]