# Detecting SIM card in laptop



## balanga (Feb 26, 2020)

Is there any way of detecting the presence of a SIM card in my laptop?


----------



## tingo (Feb 26, 2020)

Are you asking about the SIM card itself, or the SIM card slot / reader?


----------



## balanga (Feb 26, 2020)

Both...


----------



## Phishfry (Feb 26, 2020)

Yes. Use the modems serial console and issue AT commands.
For a Sierra Modem the AT command is
AT!ICCID
This will return the SIM chips ICC ID (Integrated Circuit Card ID)
To show if SIM is ready:
AT+CPIN?

To find the modems serial console check with `ls /dev` and look for cuaU*.* ports and ttyU*.* ports.
For example:
`cu -l /dev/ttyU0.2`
Connected
at
OK
ati
Manufacturer: Sierra Wireless, Incorporated
Model: MC7700
Revision: SWI9200X_03.05.29.03ap r6485 CNSHZ-ED-XP0031 2014/12/02 17:53:15
IMEI: 012626000778$$$
IMEI SV: 23
FSN: CDC0183099710
3GPP Release 8
+GCAP: +CGSM,+DS,+ES
at
AT+CPIN?
+CPIN:READY
OK
at
AT+CPIN?
+CME ERROR: SIM not inserted


----------



## balanga (Feb 27, 2020)

Doesn't pciconf() show the presence of a SIM socket?


----------



## tingo (Feb 27, 2020)

only if it is connected via pci.


----------



## Phishfry (Feb 27, 2020)

balanga said:


> Doesn't pciconf() show the presence of a SIM socket?


There are no OS tools to show a SIM slot.
SIM card slots use special circuitry and tie directly into the MiniPCIe socket for a modem.
Cellular Modems use special MiniPCIe sockets that have USB Signaling connections.
Most all cellular modems use this USB Signaling.

```
usbconfig ugen1.3
ugen1.3: <Sierra Wireless, Incorporated MC7700> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (0mA)
```
So Cellular Modem slots are not the same as a slot for MiniPCIe WiFi socket.
WiFi Cards and TV tuners use pure MiniPCIe signaling.
There are a few exceptions for WiFi cards that actually do use USB Signaling MiniPCIe sockets.
RALink makes one. Some of the really cheap no-name router boxes from China use these.


----------



## Phishfry (Feb 27, 2020)

Here is an example of a box that uses USB Signaling Wifi Cards:





						Amazon.com: Protectli Vault 4 Port, Firewall Micro Appliance/Mini PC - Intel Quad Core, Barebone: Industrial & Scientific
					

Amazon.com: Protectli Vault 4 Port, Firewall Micro Appliance/Mini PC - Intel Quad Core, Barebone: Industrial & Scientific



					www.amazon.com
				



Notice in the fine print:


> Optional Wireless card kit is available from Protectli. Card is USB Channel and fits in a designated PCIe form factor slot with USB communications



Theoretically you could use a cellular modem in this slot.
Problem is No SIM slot.
Well they do make a cool little widget that overcomes this problem.








						Usim SIM Card Socket Slot Solderless Holder For Mini PCI-E Module 3G WWAN Modem  | eBay
					

Find many great new & used options and get the best deals for Usim SIM Card Socket Slot Solderless Holder For Mini PCI-E Module 3G WWAN Modem at the best online prices at eBay! Free shipping for many products!



					www.ebay.com
				



This fits in the MiniPCIE socket and folds over the Cellular Modem connectors.


----------



## balanga (Mar 14, 2020)

I've noticed under Windows, that it detects a Sierra Wireless AirCard HSDPA Modem under Device Manager. What would I use under FreeBSD to identify the same item? I don't see anything in `dmesg` which looks relevant to it.


----------



## Phishfry (Mar 14, 2020)

Query it under Windows with Putty or Hyperterm and send it AT commands.
ATI will show the model number.


----------

