简体   繁体   中英

How can we turn off the smart card reader buzzer off?

Im a newbie with smart card readers. I have bought a ACR1252u and got stuck in disabling the buzzer and led. I have tried this code: https://the--semicolon.blogspot.it/p/this-is-simple-way-to-restart-your.html?showComment=1468833507200

  public void turnOffBuzzer()
        {
                retCode = Card.SCardConnect(hContext, readername, Card.SCARD_SHARE_SHARED, Card.SCARD_PROTOCOL_T0 | Card.SCARD_PROTOCOL_T1, ref hCard, ref Protocol);
                byte data=  0x00 ;
                byte[] control = new byte[] { 0xE0, 0x00, 0x00, 0x28, 0x01 };
                uint value = BitConverter.ToUInt32(control, 0);
                byte receivedBytes = new byte();
                int pcbBytesReturned = 0;
                long status = Card.SCardControl(hCard, value, ref data, 1,ref receivedBytes , 1, ref  pcbBytesReturned);
                MessageBox.Show(status.ToString());
        }

but status gives me 1 not 0

Umm I have found out how its working!

For turning off the buzzer:

 retCode = Card.SCardConnect(hContext, readername, Card.SCARD_SHARE_SHARED,
                  Card.SCARD_PROTOCOL_T0 | Card.SCARD_PROTOCOL_T1, ref hCard, ref Protocol);

            Byte[] setBuzzerLoud = new Byte[6];
            setBuzzerLoud[0] = 0xE0;
            setBuzzerLoud[1] = 0x00;
            setBuzzerLoud[2] = 0x00;
            setBuzzerLoud[3] = 0x21;
            setBuzzerLoud[4] = 0x01;
            setBuzzerLoud[5] = 0x77;
            uint pcBytesReturned = 0;
            Byte[] RecieveBuff = new Byte[64];
            uint controlcode = 3225264;
            int status = Card.SCardControl(hCard, controlcode, ref setBuzzerLoud[0], 6, ref RecieveBuff[0], RecieveBuff.Length, ref pcBytesReturned);

            MessageBox.Show(status.ToString());

For turning off the led:

  retCode = Card.SCardConnect(hContext, readername, Card.SCARD_SHARE_SHARED,
               Card.SCARD_PROTOCOL_T0 | Card.SCARD_PROTOCOL_T1, ref hCard, ref Protocol);

            Byte[] setLEDOFF = new Byte[6];
            setLEDOFF[0] = 0xE0;
            setLEDOFF[1] = 0x00;
            setLEDOFF[2] = 0x00;
            setLEDOFF[3] = 0x21;
            setLEDOFF[4] = 0x01;
            setLEDOFF[5] = 0x79;
            uint pcBytesReturned = 0;
            Byte[] RecieveBuff = new Byte[64];
            uint controlcode = 3225264;
            int status = Card.SCardControl(hCard, controlcode, ref setLEDOFF[0], 6, ref RecieveBuff[0], RecieveBuff.Length, ref pcBytesReturned);

            MessageBox.Show(status.ToString());

For turning off the RF:

 retCode = Card.SCardConnect(hContext, readername, Card.SCARD_SHARE_SHARED,
             Card.SCARD_PROTOCOL_T0 | Card.SCARD_PROTOCOL_T1, ref hCard, ref Protocol);

            Byte[] setRFOff = new Byte[6];
            setRFOff[0] = 0xE0;
            setRFOff[1] = 0x00;
            setRFOff[2] = 0x00;
            setRFOff[3] = 0x23;
            setRFOff[4] = 0x01;
            setRFOff[5] = 0x80;
            uint pcBytesReturned = 0;
            Byte[] RecieveBuff = new Byte[64];
            uint controlcode = 3225264;
            int status = Card.SCardControl(hCard, controlcode, ref setRFOff[0], 6, ref RecieveBuff[0], RecieveBuff.Length, ref pcBytesReturned);

            MessageBox.Show(status.ToString());

The interesting thing is the control code where i have debugged the c++ code mentioned in the link to find it for this smart card reader:

DWORD controlcode = SCARD_CTL_CODE(3500);

The escape code was written in page 41/77.

SCARD_CTL_CODE(3500)

The only problem is how to turn off the settings without the rfid on the card reader. I have also found an article which talks about changing some registry key in the usb parameters which Im gonna try it also. any one who can help me about this i would be glad also.

Done! Enjoy

如果您想在读卡器附近没有任何 rfid 标签时发送一些 ScardControl 命令,您可以尝试在 Card.SCardConnect 函数中使用“Card.SCARD_SHARE_DIRECT”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM